private void LoginForm_Load(object sender, EventArgs e) { try { frm = new MainForm("Guest"); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form_MouseMove); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form_MouseUp); this.panelEx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown); this.panelEx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form_MouseMove); this.panelEx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form_MouseUp); Pwd_Textbox.PasswordChar = '*'; this.warningBox1.Visible = false; if (XMLGetModel.CheckUpdate())//仍有更新标志,需关闭软件 { timer1.Interval = 20000; timer1.Enabled = true; MessageBox.Show("由于版本更新,若长时间无法打开,请联系AED相关工程师!", "提示"); this.warningBox1.Visible = true; this.warningBox1.Text = "<b>Warning Box</b> if not opened for long time,please contact AED <i>POLC -AED</i> support."; this.Close(); } //Console.WriteLine("登录界面载入成功!"); } catch (Exception ex) { MessageBox.Show("登录界面载入时发生异常:" + ex.Message); } }
static void Main() { //AllocConsole();//调用系统API,调用控制台窗口 try { ManagerProgram mp = new ManagerProgram(); mp.InitialMTmanager(); } catch (Exception ex) { MessageBox.Show("ManagerProgram exception error:" + ex.Message); } XMLGetModel.XMLRead(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginForm()); //FreeConsole();//释放控制台 }
private void ManulImport_MainBom() { try { XMLGetModel.XMLRead(); string category_Str = ""; string category_chn = ""; StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Maingage_dt.Copy()); for (int m = 0; m < 2; m++) { if (m == 0) { category_Str = "AnalogLC"; category_chn = "模拟传感器"; } else { category_Str = "DigitalLC"; category_chn = "数字传感器"; } DataTable model_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_MODEL from MT_CZ_ASSORTMENTTYPE where CATEGORY='{0}' and ME is not null", category_Str), null); for (int k = 0; k < model_dt.Rows.Count; k++) { DataTable Assmely_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct GENERIC_ASSEMBLY from MT_CZ_ASSORTMENTTYPE where GENERIC_MODEL='{0}' and GENERIC_ASSEMBLY is not null and ME is not null", model_dt.Rows[k][0]), null); for (int i = 0; i < Assmely_dt.Rows.Count; i++) { DataTable bom_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct ME from MT_CZ_ASSORTMENTTYPE where GENERIC_ASSEMBLY='{0}' and ME is not null", Assmely_dt.Rows[i][0]), null); for (int j = 0; j < bom_dt.Rows.Count; j++) { sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (lcbom_meaid,lcbom,lcassembly,lcproductclass,lcproductmodel,lcbominfo,lcbominfo_test,modifieddate)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", Constant.MainBom_sqlname, Guid.NewGuid(), bom_dt.Rows[j][0], Assmely_dt.Rows[i][0], category_chn, model_dt.Rows[k][0], strconn, strconn, DateTime.Now), null); } } } } MessageBox.Show("done"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ManulImport_sgseries() { try { XMLGetModel.XMLRead(); StringBuilder strconn = DgdDealHelper.GetCombineInfo(Constant.Sgseries_dt.Copy()); DataTable gage_dt = sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("select distinct gagebom from {0} where isactive='1'", "MT_CZ_PRODUCTION_GAGE"), null); for (int i = 0; i < gage_dt.Rows.Count; i++) { sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("insert into {0} (sgseriesbom,sgseriesinfo,sgseriesinfo_test,modifiedby,modifieddate)values('{1}','{2}','{3}','{4}','{5}')", Constant.SGseries_sqlname, gage_dt.Rows[i][0], strconn, strconn, "HT", DateTime.Now), null); } MessageBox.Show("done1"); //this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }