| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- 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 UIK030060 : FrmBase
- {
- public UIK030060()
- {
- 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()
- {
-
- try
- {
- string mc_id = this.ultraTextMC_ID.Text.ToString();
-
- CoreClientParam ccp = new CoreClientParam();
- DataTable dt = new DataTable();
- if (mc_id == "")
- {
- MessageBox.Show("请输入主体设备名称");
- }
- else
- {
- this.ultraTextMC_ID.Clear();
- ccp.ServerName = "UIK.UIK03.UIK030060";
- ccp.MethodName = "DoQuery";
- ccp.ServerParams = new object[] { mc_id };
- ccp.SourceDataTable = dt;
- //CoreClientParam obj = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- this.ultraGrid1.DataSource = dt;
- if (dt.Rows.Count <= 0)
- {
- MessageBox.Show("该主体设备名称不存在!");
- }
- return;
- }
- }
- catch (Exception Ex)
- {
- MessageBox.Show(Ex.ToString());
- }
- }
- 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"].Value.ToString() == "True")
- {
- string mcid, IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, 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_NAME = this.ultraTextMC_NAME.Text;
- IMC_STAT = this.ultraComboMC_STAT.Text;
- IMC_MODEL = this.ultraTextMC_MODEL.Text;
- IMC_SPEC = this.ultraTextMC_SPEC.Text;
- IMC_PRICE = this.ultraTextPRICE.Text;
- IMC_IN_DTIME = this.ultraCalendarMC_IN_DTIME.Text;
- IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
- IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
- IMC_UNIT = this.ultraTextMC_UNIT.Text;
- IMC_TAI = this.ultraTextMC_TAI.Text;
- IMC_ACT = this.ultraTextMC_ACT.Text;
- IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
- IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
- IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
- IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
- IMC_FACTORY = this.ultraTextMC_FACTORY.Text;
- IMC_STARTTIME = this.ultraCalendarMC_STARTTIME.Text;
- IMC_OPER_ID = this.ultraTextMC_OPER_ID.Text;
- IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.ServerName = "UIK.UIK03.UIK030060";
- ccp2.MethodName = "DoUpdate";
- ccp2.ServerParams = new object[] { IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, 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.ultraTextMC_NAME.Clear();
- this.ultraComboMC_STAT.Clear();
- this.ultraTextMC_MODEL.Clear();
- this.ultraTextMC_SPEC.Clear();
- this.ultraTextMC_CARE_SECTOR.Clear();
- this.ultraTextMC_NOM_CAP.Clear();
- this.ultraTextMC_UNIT.Clear();
- this.ultraTextMC_TAI.Clear();
- this.ultraTextMC_ACT.Clear();
- this.ultraTextMC_MFACTUR_UNITS.Clear();
- this.ultraTextMC_USE_YEAR.Clear();
- this.ultraCalendarMC_USE_TIME.Text = "";
- this.ultraTextMC_INSTAL_LOCAL.Clear();
- this.ultraTextMC_FACTORY.Clear();
- this.ultraCalendarMC_IN_DTIME.Text = "";
- this.ultraTextPRICE.Clear();
- this.ultraCalendarMC_STARTTIME.Text = "";
- this.ultraTextMC_OPER_ID.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.UIK030060";
- 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.ultraComboMC_STAT.Text = dr["MC_STAT"].ToString();
- this.ultraTextMC_MODEL.Text = dr["MC_MODEL"].ToString();
- this.ultraTextMC_SPEC.Text = dr["MC_SPEC"].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_TAI.Text = dr["MC_TAI"].ToString();
- this.ultraTextMC_ACT.Text = dr["MC_ACT"].ToString();
- this.ultraTextMC_MFACTUR_UNITS.Text = dr["MC_MFACTUR_UNITS"].ToString();
- this.ultraTextMC_USE_YEAR.Text = dr["MC_USE_YEAR"].ToString();
- this.ultraCalendarMC_USE_TIME.Text = dr["MC_USE_TIME"].ToString();
- this.ultraTextMC_INSTAL_LOCAL.Text = dr["MC_INSTAL_LOCAL"].ToString();
- this.ultraTextMC_FACTORY.Text = dr["MC_FACTORY"].ToString();
- this.ultraCalendarMC_IN_DTIME.Text = dr["MC_IN_DTIME"].ToString();
- this.ultraTextPRICE.Text = dr["MC_PRICE"].ToString();
- this.ultraCalendarMC_STARTTIME.Text = dr["MC_STARTTIME"].ToString();
- this.ultraTextMC_OPER_ID.Text = dr["MC_OPER_ID"].ToString();
- this.ultraTextMAIN_MC_NAME.Text = dr["MAIN_MC_NAME"].ToString();
- }
- }
- else
- {
- this.ultraTextMCID2.Enabled = true;
- this.ultraTextMCID2.Clear();
- this.ultraTextMC_NAME.Clear();
- this.ultraComboMC_STAT.Clear();
- this.ultraTextMC_MODEL.Clear();
- this.ultraTextMC_SPEC.Clear();
- this.ultraTextMC_CARE_SECTOR.Clear();
- this.ultraTextMC_NOM_CAP.Clear();
- this.ultraTextMC_UNIT.Clear();
- this.ultraTextMC_TAI.Clear();
- this.ultraTextMC_ACT.Clear();
- this.ultraTextMC_MFACTUR_UNITS.Clear();
- this.ultraTextMC_USE_YEAR.Clear();
- this.ultraCalendarMC_USE_TIME.Text = "";
- this.ultraTextMC_INSTAL_LOCAL.Clear();
- this.ultraTextMC_FACTORY.Clear();
- this.ultraCalendarMC_IN_DTIME.Text = "";
- this.ultraTextPRICE.Clear();
- this.ultraCalendarMC_STARTTIME.Text ="";
- this.ultraTextMC_OPER_ID.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_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, IREG_IN_DTIME, IMAIN_MC_NAME;
- mcid = this.ultraTextMCID2.Text;
- IMC_NAME = this.ultraTextMC_NAME.Text;
- IMC_STAT = this.ultraComboMC_STAT.Text;
- IMC_MODEL = this.ultraTextMC_MODEL.Text;
- IMC_SPEC = this.ultraTextMC_SPEC.Text;
- IMC_PRICE = this.ultraTextPRICE.Text;
- IMC_IN_DTIME = this.ultraCalendarMC_IN_DTIME.Text;
- IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
- IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
- IMC_UNIT = this.ultraTextMC_UNIT.Text;
- IMC_TAI = this.ultraTextMC_TAI.Text;
- IMC_ACT = this.ultraTextMC_ACT.Text;
- IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
- IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
- IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
- IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
- IMC_FACTORY = this.ultraTextMC_FACTORY.Text;
- IMC_STARTTIME = this.ultraCalendarMC_STARTTIME.Text;
- IMC_OPER_ID = this.ultraTextMC_OPER_ID.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.UIK030060";
- 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.UIK030060";
- ccp2.MethodName = "DoInsert";
- ccp2.ServerParams = new object[] { mcid, IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, 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.ultraTextMC_NAME.Clear();
- this.ultraComboMC_STAT.Clear();
- this.ultraTextMC_MODEL.Clear();
- this.ultraTextMC_SPEC.Clear();
- this.ultraTextMC_CARE_SECTOR.Clear();
- this.ultraTextMC_NOM_CAP.Clear();
- this.ultraTextMC_UNIT.Clear();
- this.ultraTextMC_TAI.Clear();
- this.ultraTextMC_ACT.Clear();
- this.ultraTextMC_MFACTUR_UNITS.Clear();
- this.ultraTextMC_USE_YEAR.Clear();
- this.ultraCalendarMC_USE_TIME.Text = "";
- this.ultraTextMC_INSTAL_LOCAL.Clear();
- this.ultraTextMC_FACTORY.Clear();
- this.ultraCalendarMC_IN_DTIME.Text = "";
- this.ultraTextPRICE.Clear();
- this.ultraCalendarMC_STARTTIME.Text = "";
- this.ultraTextMC_OPER_ID.Clear();
- this.ultraTextMAIN_MC_NAME.Clear();
- }
- }
- }
- }
- }
- private void UIK030060_Load(object sender, EventArgs e)
- {
- this.ultraCalendarMC_IN_DTIME.Text = "";
- this.ultraCalendarMC_STARTTIME.Text = "";
- this.ultraCalendarMC_USE_TIME.Text = "";
- }
-
- }
- }
|