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; using CoreFS.CA06; using System.Collections; namespace Core.LZMes.Client.UIK { public partial class UIK030050 : FrmBase { public UIK030050() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Insert": this.DoInsert(); break; case "Update": this.DoUpdate(); break; } } private void DoQuery() { if (this.ultraCalendarENDTIME.Enabled == false && this.ultraCalendarSTRATTIME.Enabled == false) { this.ultraCalendarENDTIME.Text = ""; this.ultraCalendarSTRATTIME.Text = ""; } try { string mc_id = this.ultraTextMC_ID.Text.ToString(); string starttiem = this.ultraCalendarSTRATTIME.Text.ToString(); string endtime = this.ultraCalendarENDTIME.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); DataTable dt = new DataTable(); if (mc_id == "" && starttiem == "" && endtime == "") { MessageBox.Show("请选择查询条件!"); } else { //if (this.ultraCheckAll.Checked) //{ // this.ultraCheckAll.Checked = false; // ccp.ServerName = "UIK.UIK03.UIK030050"; // ccp.MethodName = "DoQuery"; // ccp.ServerParams = new object[] { mc_id, starttiem, endtime, flag }; // ccp.SourceDataTable = dt; // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); // this.ultraGrid1.DataSource = dt; // if (dt.Rows.Count <= 0) // { // MessageBox.Show("暂无记录!"); // } // return; //} //else //{ // flag = true; if (this.ultraTextMC_ID.Text != "" || this.ultraCheckEditor1.Checked == true) { if (this.ultraTextMC_ID.Text == "") { this.ultraTextMC_ID.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK03.UIK030050"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { mc_id, starttiem, endtime}; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该时间内没有维修信息!"); } this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; return; } if (this.ultraCheckEditor1.Checked == false) { this.ultraTextMC_ID.Clear(); ccp.ServerName = "UIK.UIK03.UIK030050"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { mc_id, starttiem, endtime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("该设备编号不存在!"); } this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; return; } if (this.ultraTextMC_ID.Text != "" && this.ultraCheckEditor1.Checked == true) { this.ultraTextMC_ID.Clear(); this.ultraCheckEditor1.Checked = false; ccp.ServerName = "UIK.UIK03.UIK030050"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { mc_id, starttiem, endtime }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.ultraGrid1.DataSource = dt; if (dt.Rows.Count <= 0) { MessageBox.Show("记录不存在,请查证后查询!"); } this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; return; } } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { if (this.ultraCheckEditor1.Checked) { this.ultraCalendarENDTIME.Enabled = true; this.ultraCalendarSTRATTIME.Enabled = true; } if (!this.ultraCheckEditor1.Checked) { this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; this.ultraCalendarSTRATTIME.Text = ""; this.ultraCalendarENDTIME.Text = ""; } } private void UIK030050_Load(object sender, EventArgs e) { this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; this.ultraCalendarSTARTSERVERICE_DTIME.Text = ""; this.ultraCalendarENDSERVERICE_DTIME.Text = ""; this.ultraCalendarMC_USE_TIME.Text = ""; } private void DoUpdate() { if (this.ultraTextMCID2.Text == "") { MessageBox.Show("请选中需要修改的项"); } else { if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True") { string mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME; mcid = ugr.Cells["MC_ID"].Value.ToString(); this.ultraTextMCID2.Enabled = false; IREG_IN_DTIME = ugr.Cells["REG_IN_DTIME"].Value.ToString(); IMC_STAT = this.ultraComboMC_STAT.Text; IMC_NAME = this.ultraTextMC_NAME.Text; IMC_MODEL = this.ultraTextMC_MODEL.Text; IMC_SPEC = this.ultraTextMC_SPEC.Text; IMC_SERVICEREASON = this.ultraTextMC_SERVICEREASON.Text; IMC_STARSERVICE = this.ultraCalendarSTARTSERVERICE_DTIME.Text; IMC_ENDESERVICE = this.ultraCalendarENDSERVERICE_DTIME.Text; IMC_SERVICE_ID = this.ultraTextSERVERICE_ID.Text; IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text; IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text; IMC_UNIT = this.ultraTextMC_UNIT.Text; IMC_ACT = this.ultraTextMC_ACT.Text; IMC_TAI = this.ultraTextMC_TAI.Text; IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text; IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text; IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text; IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text; IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text; CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK03.UIK030050"; ccp2.MethodName = "DoUpdate"; ccp2.ServerParams = new object[] { IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("修改失败!"); } else { MessageBox.Show("修改成功!"); this.ultraTextMCID2.Enabled = true; this.ultraTextMCID2.Clear(); this.ultraComboMC_STAT.Clear(); this.ultraTextMC_NAME.Clear(); this.ultraTextMC_MODEL.Clear(); this.ultraTextMC_SPEC.Clear(); this.ultraTextMC_SERVICEREASON.Clear(); this.ultraCalendarENDSERVERICE_DTIME.Text = ""; this.ultraCalendarSTARTSERVERICE_DTIME.Text = ""; this.ultraTextSERVERICE_ID.Clear(); this.ultraCalendarMC_USE_TIME.Text = ""; this.ultraTextMC_NOM_CAP.Clear(); this.ultraTextMC_UNIT.Clear(); this.ultraTextMC_ACT.Clear(); this.ultraTextMC_TAI.Clear(); this.ultraTextMC_MFACTUR_UNITS.Clear(); this.ultraTextMC_USE_YEAR.Clear(); this.ultraTextMC_INSTAL_LOCAL.Clear(); this.ultraTextMC_CARE_SECTOR.Clear(); this.ultraTextMAIN_MC_NAME.Clear(); } } else { MessageBox.Show("请选择修改行!"); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key == "SELECT_ITEM") { if (e.Cell.Text == "True") { string mcid, IREG_IN_DTIME; ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text; this.ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text; mcid = e.Cell.Row.Cells["MC_ID"].Text; this.ultraTextMCID2.Enabled = false; IREG_IN_DTIME = e.Cell.Row.Cells["REG_IN_DTIME"].Text; DataTable dt = new DataTable(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK03.UIK030050"; ccp.MethodName = "DoSelect"; ccp.ServerParams = new object[] { IREG_IN_DTIME }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); foreach (DataRow dr in dt.Rows) { this.ultraTextMC_NAME.Text = dr["MC_NAME"].ToString(); this.ultraTextMC_MODEL.Text = dr["MC_MODEL"].ToString(); this.ultraTextMC_SPEC.Text = dr["MC_SPEC"].ToString(); this.ultraTextMC_SERVICEREASON.Text = dr["MC_SERVICEREASON"].ToString(); this.ultraTextSERVERICE_ID.Text = dr["MC_SERVICE_ID"].ToString(); this.ultraCalendarSTARTSERVERICE_DTIME.Text = dr["MC_STARSERVICE"].ToString(); this.ultraCalendarENDSERVERICE_DTIME.Text = dr["MC_ENDESERVICE"].ToString(); this.ultraCalendarMC_USE_TIME.Text = dr["MC_USE_TIME"].ToString(); this.ultraTextMC_CARE_SECTOR.Text = dr["MC_CARE_SECTOR"].ToString(); this.ultraTextMC_NOM_CAP.Text = dr["MC_NOM_CAP"].ToString(); this.ultraTextMC_UNIT.Text = dr["MC_UNIT"].ToString(); this.ultraTextMC_ACT.Text = dr["MC_ACT"].ToString(); this.ultraTextMC_TAI.Text = dr["MC_TAI"].ToString(); this.ultraTextMC_MFACTUR_UNITS.Text = dr["MC_MFACTUR_UNITS"].ToString(); this.ultraTextMC_USE_YEAR.Text = dr["MC_USE_YEAR"].ToString(); this.ultraTextMC_INSTAL_LOCAL.Text = dr["MC_INSTAL_LOCAL"].ToString(); this.ultraComboMC_STAT.Text = dr["MC_STAT"].ToString(); this.ultraTextMAIN_MC_NAME.Text = dr["MAIN_MC_NAME"].ToString(); } } else { this.ultraTextMCID2.Enabled = true; this.ultraTextMCID2.Clear(); this.ultraComboMC_STAT.Clear(); this.ultraTextMC_NAME.Clear(); this.ultraTextMC_MODEL.Clear(); this.ultraTextMC_SPEC.Clear(); this.ultraTextMC_SERVICEREASON.Clear(); this.ultraCalendarENDSERVERICE_DTIME.Text = ""; this.ultraCalendarSTARTSERVERICE_DTIME.Text = ""; this.ultraTextSERVERICE_ID.Clear(); this.ultraCalendarMC_USE_TIME.Text = ""; this.ultraTextMC_NOM_CAP.Clear(); this.ultraTextMC_UNIT.Clear(); this.ultraTextMC_ACT.Clear(); this.ultraTextMC_TAI.Clear(); this.ultraTextMC_MFACTUR_UNITS.Clear(); this.ultraTextMC_USE_YEAR.Clear(); this.ultraTextMC_INSTAL_LOCAL.Clear(); this.ultraTextMC_CARE_SECTOR.Clear(); this.ultraTextMAIN_MC_NAME.Clear(); } } } private void DoInsert() { if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { string mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME,IREG_IN_DTIME; mcid = this.ultraTextMCID2.Text; IMC_STAT = this.ultraComboMC_STAT.Text; IMC_NAME = this.ultraTextMC_NAME.Text; IMC_MODEL = this.ultraTextMC_MODEL.Text; IMC_SPEC = this.ultraTextMC_SPEC.Text; IMC_SERVICEREASON = this.ultraTextMC_SERVICEREASON.Text; IMC_STARSERVICE = this.ultraCalendarSTARTSERVERICE_DTIME.Text; IMC_ENDESERVICE = this.ultraCalendarENDSERVERICE_DTIME.Text; IMC_SERVICE_ID = this.ultraTextSERVERICE_ID.Text; IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text; IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text; IMC_UNIT = this.ultraTextMC_UNIT.Text; IMC_ACT = this.ultraTextMC_ACT.Text; IMC_TAI = this.ultraTextMC_TAI.Text; IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text; IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text; IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text; IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text; IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text; IREG_IN_DTIME = DateTime.Now.ToString(); if (mcid == "") { MessageBox.Show("设备编号必须输入!"); } else { DataTable dt = new DataTable(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK03.UIK030050"; ccp.MethodName = "DoSelect"; ccp.ServerParams = new object[] { IREG_IN_DTIME }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (dt.Rows.Count > 0) { MessageBox.Show("该编设备号已经存在,请重新输入"); } else { CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK03.UIK030050"; ccp2.MethodName = "DoInsert"; ccp2.ServerParams = new object[] { mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("添加失败!"); } else { MessageBox.Show("添加成功!"); this.ultraTextMCID2.Enabled = true; this.ultraTextMCID2.Clear(); this.ultraComboMC_STAT.Clear(); this.ultraTextMC_NAME.Clear(); this.ultraTextMC_MODEL.Clear(); this.ultraTextMC_SPEC.Clear(); this.ultraTextMC_SERVICEREASON.Clear(); this.ultraCalendarENDSERVERICE_DTIME.Text = ""; this.ultraCalendarSTARTSERVERICE_DTIME.Text = ""; this.ultraTextSERVERICE_ID.Clear(); this.ultraCalendarMC_USE_TIME.Text = ""; this.ultraTextMC_NOM_CAP.Clear(); this.ultraTextMC_UNIT.Clear(); this.ultraTextMC_ACT.Clear(); this.ultraTextMC_TAI.Clear(); this.ultraTextMC_MFACTUR_UNITS.Clear(); this.ultraTextMC_USE_YEAR.Clear(); this.ultraTextMC_INSTAL_LOCAL.Clear(); this.ultraTextMC_CARE_SECTOR.Clear(); this.ultraTextMAIN_MC_NAME.Clear(); } } } } } } }