private void btKetNoi_Click(object sender, EventArgs e) { #region Test // CD1800Connect a = new CD1800Connect(); // string ChuoiHuyetHoc = @"0301 // // // // // //-------------- //S02 //CBC //DIFF //TCBC //04 //G01 //0A //DATE 08/12/14 //TIME 16:14:22 //ID1 TRAN CHAU LAI //CASSPOS M //ID1STATUS //C/PSTATUS P //SASTATUS COMPLETE //INST Instrument 1 //OPR LABADMIN //DFACT 1.00 //G02 //0A //WBC 6.6 //RBC 4.98 //HGB 144BD0026 //HCT 44.9 //MCV 90.1 //MCH 29.3 //MCHC 32.5 L //RDW 13.3 //PLT 269 //MPV 6.5 L //G08 //01 //CONDITION AutoValidated //G0A //01 //RP 02 //TDIFF //02 //G03 //05 //LY# 1.8 //MO# 0.4 //NE# 3.9 //EO# 0.4 //BA# 0.1 //G04 //05 //LY% 26.9 //MO% 5.9 //NE% 59.5 //EO% 6.6 H //BA4EC503% 1.1 // // //-------------- // 6AD3"; // a.LuKetQuaHuyetHoc(ChuoiHuyetHoc); // return; #endregion string error = ""; AppParams.serverConfig.Name = txtSever.Text.Trim(); AppParams.serverConfig.DBName = txtDataBase.Text.Trim(); AppParams.serverConfig.User = txtUser.Text.Trim(); AppParams.serverConfig.Pass = txtPass.Text.Trim(); AppParams.serverConfig.Write(); if (ServerConnect.I.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với cơ sở dữ liệu trên server.!"; } if (listView1.Items[0].Checked) { AppParams.cd1800Config.PortName = cbCD1800_Com.Text.Trim(); AppParams.cd1800Config.BaudRate = cbCD1800_Rate.Text.Trim(); AppParams.cd1800Config.DataBits = cbCD1800_DataBits.Text.Trim(); AppParams.cd1800Config.ParityType = cbCD1800_Parity.Text.Trim(); AppParams.cd1800Config.StopBit = cbCD1800_StopBit.Text.Trim(); AppParams.cd1800Config.MaMayCLS = txtCD1800_MaMay.Text.Trim(); AppParams.cd1800Config.GRAN = txtCD1800_GRAN.Text; AppParams.cd1800Config.MID = txtCD1800_MID.Text; AppParams.cd1800Config.LYM = txtCD1800_LYM.Text; AppParams.cd1800Config.RBC = txtCD1800_RBC.Text; AppParams.cd1800Config.GRANPer = txtCD1800_GRANPer.Text; AppParams.cd1800Config.MIDPer = txtCD1800_MIDPer.Text; AppParams.cd1800Config.HCT = txtCD1800_HCT.Text; AppParams.cd1800Config.HGB = txtCD1800_HGB.Text; AppParams.cd1800Config.LYMPer = txtCD1800_LYMPer.Text; AppParams.cd1800Config.WBC = txtCD1800_WBC.Text; AppParams.cd1800Config.MPV = txtCD1800_MPV.Text; AppParams.cd1800Config.PLT = txtCD1800_PLT.Text; AppParams.cd1800Config.MCH = txtCD1800_MCH.Text; AppParams.cd1800Config.RDW = txtCD1800_RDW.Text; AppParams.cd1800Config.MCV = txtCD1800_MCV.Text; AppParams.cd1800Config.MCHC = txtCD1800_MCHC.Text; AppParams.cd1800Config.PDW = txtCD1800_PDW.Text; AppParams.cd1800Config.PCT = txtCD1800_PCT.Text; AppParams.cd1800Config.Write(); if (CD1800Connect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Cell - Dyn 1800.!"; this.saveSuccess = false; } } if (listView1.Items[1].Checked) { AppParams.eblx200Config.Name = txtEBLX200_Server.Text.Trim(); AppParams.eblx200Config.DBName = txtEBLX200_DBName.Text.Trim(); AppParams.eblx200Config.User = txtEBLX200_User.Text.Trim(); AppParams.eblx200Config.Pass = txtEBLX200_Pass.Text.Trim(); AppParams.eblx200Config.MaMayCLS = txtEBLX200_MaMay.Text; AppParams.eblx200Config.Write(); if (EBLX200Connect.I.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy EBLX 200.!"; this.saveSuccess = false; } } if (listView1.Items[2].Checked) { AppParams.lauraSmartConfig.PortName = cboLASM_Com.Text.Trim(); AppParams.lauraSmartConfig.DataBits = cboLASM_DataBit.Text.Trim(); AppParams.lauraSmartConfig.ParityType = cboLASM_Parity.Text.Trim(); AppParams.lauraSmartConfig.BaudRate = cboLASM_Rate.Text.Trim(); AppParams.lauraSmartConfig.StopBit = cboLASM_StopBit.Text.Trim(); AppParams.lauraSmartConfig.MaMayCLS = txtLASM_MaMay.Text.Trim(); AppParams.lauraSmartConfig.BLD = txtLASM_BLD.Text; AppParams.lauraSmartConfig.LEU = txtLASM_LEU.Text; AppParams.lauraSmartConfig.BIL = txtLASM_BIL.Text; AppParams.lauraSmartConfig.UBG = txtLASM_UBG.Text; AppParams.lauraSmartConfig.KET = txtLASM_KET.Text; AppParams.lauraSmartConfig.GLU = txtLASM_GLU.Text; AppParams.lauraSmartConfig.PRO = txtLASM_PRO.Text; AppParams.lauraSmartConfig.PH = txtLASM_PH.Text; AppParams.lauraSmartConfig.NIT = txtLASM_NIT.Text; AppParams.lauraSmartConfig.SG = txtLASM_SG.Text; AppParams.lauraSmartConfig.Write(); if (LauraSmartConnect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Laura Smart.!"; this.saveSuccess = false; } } if (listView1.Items[3].Checked) { AppParams.stagoStart4Config.PortName = cboStart4_Com.Text; AppParams.stagoStart4Config.BaudRate = cboStart4_BaudRate.Text; AppParams.stagoStart4Config.DataBits = cboStart4_DataBits.Text; AppParams.stagoStart4Config.ParityType = cboStart4_Parity.Text; AppParams.stagoStart4Config.StopBit = cboStart4_StopBit.Text; AppParams.stagoStart4Config.MaMayCLS = txtStart4_MaMay.Text; AppParams.stagoStart4Config.FIBRINOGENE = txtStart4_FIB.Text; AppParams.stagoStart4Config.INR = txtStart4_INR.Text; AppParams.stagoStart4Config.PROTHROMBINE = txtStart4_PROTH.Text; AppParams.stagoStart4Config.TCK = txtStart4_TCK.Text; AppParams.stagoStart4Config.TQ = txtStart4_TQ.Text; AppParams.stagoStart4Config.Write(); if (StagoStart4Connect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Stago Start4.!"; this.saveSuccess = false; } } if (listView1.Items[4].Checked) { AppParams.elecsys2010Config.PortName = cbxElecsys2010_Com.Text; AppParams.elecsys2010Config.BaudRate = cbxElecsys2010_BaudRate.Text; AppParams.elecsys2010Config.DataBits = cbxElecsys2010_DataBit.Text; AppParams.elecsys2010Config.ParityType = cbxElecsys2010_Parity.Text; AppParams.elecsys2010Config.StopBit = cbxElecsys2010_StopBit.Text; AppParams.elecsys2010Config.MaMayCLS = txtElecsys2010_MaMay.Text; AppParams.elecsys2010Config.Write(); if (Elecsys2010Connect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Elecsys 2010.!"; this.saveSuccess = false; } } if (listView1.Items[5].Checked) { AppParams.au480Config.PortName = cboAu480_Com.Text.Trim(); AppParams.au480Config.DataBits = cboAu480_DataBit.Text.Trim(); AppParams.au480Config.ParityType = cboAu480_Parity.Text.Trim(); AppParams.au480Config.BaudRate = cboAu480_Rate.Text.Trim(); AppParams.au480Config.StopBit = cboAu480_StopBit.Text.Trim(); AppParams.au480Config.Handshake = cboAu480_Handshake.Text.Trim(); AppParams.au480Config.MaMayCLS = txtAu480_MaMay.Text.Trim(); AppParams.au480Config.Write(); if (Au480Connect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Au 480 !"; this.saveSuccess = false; } } if (listView1.Items[6].Checked) { AppParams.lh500Config.PortName = cboLh500_Com.Text.Trim(); AppParams.lh500Config.DataBits = cboLh500_DataBit.Text.Trim(); AppParams.lh500Config.ParityType = cboLh500_Parity.Text.Trim(); AppParams.lh500Config.BaudRate = cboLh500_Rate.Text.Trim(); AppParams.lh500Config.StopBit = cboLh500_StopBit.Text.Trim(); AppParams.lh500Config.Handshake = cboLh500_Handshake.Text.Trim(); AppParams.lh500Config.MaMayCLS = txtLh500_MaMay.Text.Trim(); AppParams.lh500Config.Write(); if (Lh500Connect.CurrentConnect.Connect() == false) { if (error != "") { error += Environment.NewLine; } error += "Không thể kết nối với máy Lh 500 !"; this.saveSuccess = false; } } if (error == "") { this.saveSuccess = true; LogProgram.WriteSaveConfigSuccess(); MessageBox.Show("Kết nối thành công tới thiết bị."); } else { this.saveSuccess = false; LogProgram.WriteSaveConfigFail(); MessageBox.Show(error + Environment.NewLine + "Vui lòng kiểm tra lại thông tin kết nối!"); } }