| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- /*******************************************************************************
- * Copyright(c) 2014 dongke All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_040101.cs
- * 2.功能描述:在产品备份时点
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2017/08/08 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.SystemModule
- {
- /// <summary>
- /// 在产品备份时点
- /// </summary>
- public partial class F_MST_040101 : FormBase
- {
- /// <summary>
- /// 在产品备份时点
- /// </summary>
- public F_MST_040101()
- {
- InitializeComponent();
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void F_MST_040101_Load(object sender, EventArgs e)
- {
- try
- {
- // 异步处理,获取系统参数信息
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "MST040101";
- cre.Name = "GetData";
- // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
- {
- return CommonModuleProxy.Service.DoRequest(cre);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success &&
- sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
- {
- DataRow jobRow = sre.Data.Tables[0].Rows[0];
- string[] infos = jobRow["REPEAT_INTERVAL"].ToString().Split(';');
- foreach (string item in infos)
- {
- if (item.StartsWith("ByMonthDay="))
- {
- this.txtCDay.Text = item.Replace("ByMonthDay=", "");
- this.txtSDay.Value = int.Parse(this.txtCDay.Text);
- }
- else if (item.StartsWith("ByHour="))
- {
- this.txtCHour.Text = item.Replace("ByHour=", "");
- this.txtSHour.Value = int.Parse(this.txtCHour.Text);
- }
- else if (item.StartsWith("ByMinute="))
- {
- this.txtCMi.Text = item.Replace("ByMinute=", "");
- if ("30" == this.txtCMi.Text)
- {
- this.txtSMi.SelectedIndex = 1;
- }
- else
- {
- this.txtSMi.SelectedIndex = 0;
- }
- }
- }
- this.lblRunInfo.Text = string.Format("上次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
- jobRow["LAST_START_DATE"]);
- this.lblRunInfo2.Text = string.Format("下次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
- jobRow["NEXT_RUN_DATE"]);
- if ("TRUE" == jobRow["ENABLED"].ToString())
- {
- this.chkEnabled.Checked = true;
- }
- else
- {
- this.lblRunInfo2.Text = "下次执行时间:【】";
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- DialogResult dialogResult = MessageBox.Show("保存后将直接修改设置,是否继续", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- if (dialogResult != System.Windows.Forms.DialogResult.Yes)
- {
- return;
- }
- if (this.chkClearData.Checked)
- {
- dialogResult = MessageBox.Show("确定清除当月备份数据", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- if (dialogResult != System.Windows.Forms.DialogResult.OK)
- {
- this.chkClearData.Checked = false;
- }
- }
- // 异步处理,获取系统参数信息
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "MST040101";
- cre.Name = "SetData";
- cre.Request = string.Format("Freq=Monthly;Interval=1;ByMonthDay={0:00};ByHour={1:00};ByMinute={2:00}", this.txtSDay.Value, this.txtSHour.Value, this.txtSMi.Text);
- cre.Properties["DeleteMonthBackup"] = (this.chkClearData.Checked ? "1" : "0");
- cre.Properties["Enabled"] = (this.chkEnabled.Checked ? "1" : "0");
- cre.Properties["Run"] = (this.chkRun.Checked ? "1" : "0");
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
- {
- return CommonModuleProxy.Service.DoRequest(cre);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 关闭窗体
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|