F_MST_040101.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*******************************************************************************
  2. * Copyright(c) 2014 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_040101.cs
  5. * 2.功能描述:在产品备份时点
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/08/08 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.SystemModule
  19. {
  20. /// <summary>
  21. /// 在产品备份时点
  22. /// </summary>
  23. public partial class F_MST_040101 : FormBase
  24. {
  25. /// <summary>
  26. /// 在产品备份时点
  27. /// </summary>
  28. public F_MST_040101()
  29. {
  30. InitializeComponent();
  31. }
  32. private void btnCancel_Click(object sender, EventArgs e)
  33. {
  34. this.Close();
  35. }
  36. private void F_MST_040101_Load(object sender, EventArgs e)
  37. {
  38. try
  39. {
  40. // 异步处理,获取系统参数信息
  41. ClientRequestEntity cre = new ClientRequestEntity();
  42. cre.NameSpace = "MST040101";
  43. cre.Name = "GetData";
  44. // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
  45. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
  46. {
  47. return CommonModuleProxy.Service.DoRequest(cre);
  48. }
  49. );
  50. if (sre.Status == Constant.ServiceResultStatus.Success &&
  51. sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  52. {
  53. DataRow jobRow = sre.Data.Tables[0].Rows[0];
  54. string[] infos = jobRow["REPEAT_INTERVAL"].ToString().Split(';');
  55. foreach (string item in infos)
  56. {
  57. if (item.StartsWith("ByMonthDay="))
  58. {
  59. this.txtCDay.Text = item.Replace("ByMonthDay=", "");
  60. this.txtSDay.Value = int.Parse(this.txtCDay.Text);
  61. }
  62. else if (item.StartsWith("ByHour="))
  63. {
  64. this.txtCHour.Text = item.Replace("ByHour=", "");
  65. this.txtSHour.Value = int.Parse(this.txtCHour.Text);
  66. }
  67. else if (item.StartsWith("ByMinute="))
  68. {
  69. this.txtCMi.Text = item.Replace("ByMinute=", "");
  70. if ("30" == this.txtCMi.Text)
  71. {
  72. this.txtSMi.SelectedIndex = 1;
  73. }
  74. else
  75. {
  76. this.txtSMi.SelectedIndex = 0;
  77. }
  78. }
  79. }
  80. this.lblRunInfo.Text = string.Format("上次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
  81. jobRow["LAST_START_DATE"]);
  82. this.lblRunInfo2.Text = string.Format("下次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
  83. jobRow["NEXT_RUN_DATE"]);
  84. if ("TRUE" == jobRow["ENABLED"].ToString())
  85. {
  86. this.chkEnabled.Checked = true;
  87. }
  88. else
  89. {
  90. this.lblRunInfo2.Text = "下次执行时间:【】";
  91. }
  92. }
  93. }
  94. catch (Exception ex)
  95. {
  96. // 对异常进行共通处理
  97. ExceptionManager.HandleEventException(this.ToString(),
  98. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  99. }
  100. }
  101. private void btnSave_Click(object sender, EventArgs e)
  102. {
  103. try
  104. {
  105. DialogResult dialogResult = MessageBox.Show("保存后将直接修改设置,是否继续", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
  106. if (dialogResult != System.Windows.Forms.DialogResult.Yes)
  107. {
  108. return;
  109. }
  110. if (this.chkClearData.Checked)
  111. {
  112. dialogResult = MessageBox.Show("确定清除当月备份数据", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
  113. if (dialogResult != System.Windows.Forms.DialogResult.OK)
  114. {
  115. this.chkClearData.Checked = false;
  116. }
  117. }
  118. // 异步处理,获取系统参数信息
  119. ClientRequestEntity cre = new ClientRequestEntity();
  120. cre.NameSpace = "MST040101";
  121. cre.Name = "SetData";
  122. 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);
  123. cre.Properties["DeleteMonthBackup"] = (this.chkClearData.Checked ? "1" : "0");
  124. cre.Properties["Enabled"] = (this.chkEnabled.Checked ? "1" : "0");
  125. cre.Properties["Run"] = (this.chkRun.Checked ? "1" : "0");
  126. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
  127. {
  128. return CommonModuleProxy.Service.DoRequest(cre);
  129. }
  130. );
  131. if (sre.Status == Constant.ServiceResultStatus.Success)
  132. {
  133. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
  134. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  135. // 关闭窗体
  136. this.Close();
  137. }
  138. else
  139. {
  140. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "保存"),
  141. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  142. }
  143. }
  144. catch (Exception ex)
  145. {
  146. // 对异常进行共通处理
  147. ExceptionManager.HandleEventException(this.ToString(),
  148. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  149. }
  150. }
  151. }
  152. }