using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmBcPipeManage.Entity; using CoreFS.CA06; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.YdmBcPipeManage { public partial class FrmCrmBaseMaterial : FrmBase { public FrmCrmBaseMaterial() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); IsLoadUserView = true; //startDateTime.DateTime = startDateTime.DateTime.AddDays(-7.0); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Export": doExport(); break; case "Close": this.Close(); break; } } private void doExport() { GridHelper.ulGridToExcel(ultraGrid1, "crm物料信息"); } private void doQuery() { String material = ""; String startDate = ""; String endDate = ""; if (materialCheck.Checked) { material = materialText.Text; } if (crateDateCheck.Checked) { startDate = startDateTime.DateTime.ToString("yyyy-MM-dd") + " 00:00:00"; ; endDate = endDateTime.DateTime.ToString("yyyy-MM-dd") + " 23:59:59"; } if (!materialCheck.Checked && !crateDateCheck.Checked) { MessageUtil.ShowTips("请选择至少一个筛选条件!"); return; } TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(startDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks); TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(endDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks); if (ts2.Subtract(ts1).Days > 30) { MessageUtil.ShowTips("最大查询30天的数据!"); return; } List listSource = EntityHelper.GetData( "com.steering.pss.crm.server.CrmBaseMaterialServer.Query", new object[] { material, startDate, endDate }, this.ob); crmBaseMaterialEntityBindingSource.DataSource = listSource; } } }