UIM030300.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. namespace Core.LZMes.Client.UIM.UIM03
  11. {
  12. public partial class UIM030300 : FrmBase
  13. {
  14. public UIM030300()
  15. {
  16. InitializeComponent();
  17. }
  18. public override void ToolBar_Click(object sender, string ToolbarKey)
  19. {
  20. switch (ToolbarKey)
  21. {
  22. case "Query":
  23. this.DoQuery();
  24. break;
  25. case "Export":
  26. this.DoExport();
  27. break;
  28. case "Exit":
  29. this.Close();
  30. break;
  31. }
  32. }
  33. private void DoQuery()
  34. {
  35. try
  36. {
  37. this.dataSet1.Tables[0].Clear();
  38. string queryDate = this.ultraDateTimeEditor1.Value == null ? "" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  39. string queryDate1 = this.ultraDateTimeEditor2.Value == null ? "" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  40. if (queryDate1.Substring(0, 6) != queryDate.Substring(0, 6))
  41. {
  42. MessageBox.Show("请确保两个查询日期在同一月份", "错误");
  43. return;
  44. }
  45. string queryDate2 = "";//月累统计截止日期
  46. if (queryDate.Substring(0, 6) == DateTime.Today.ToString("yyyyMM"))//查询日期为当月
  47. queryDate2 = DateTime.Today.ToString("yyyyMMdd");
  48. else
  49. {
  50. DateTime date = ultraDateTimeEditor2.DateTime;
  51. queryDate2 = date.AddDays(1 - date.Day).AddMonths(1).AddDays(-1).ToString("yyyyMMdd");
  52. }
  53. CoreClientParam ccp = new CoreClientParam();
  54. ccp.ServerName = "UIM.UIM02.UIM020010";
  55. ccp.MethodName = "queryCalCoilOfDay";
  56. ccp.ServerParams = new object[] { queryDate, queryDate1, queryDate2};
  57. ccp.SourceDataTable = this.dataSet1.Tables[0];
  58. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  59. }
  60. catch (Exception EX)
  61. {
  62. MessageBox.Show(EX.ToString());
  63. }
  64. }
  65. private void DoExport()
  66. {
  67. try
  68. {
  69. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  70. {
  71. string fileName = this.saveFileDialog1.FileName;
  72. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  73. System.Diagnostics.Process.Start(fileName);
  74. }
  75. }
  76. catch (Exception EX)
  77. {
  78. MessageBox.Show(EX.ToString());
  79. }
  80. }
  81. private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
  82. {
  83. }
  84. }
  85. }