private void DIC_MACHINE_GetList_ToCBO() { Class.DanhMuc_ThietBiChamCong dm = new Class.DanhMuc_ThietBiChamCong(); cboListDevice.DataSource = dm.CT_MACHINE_GetList(); cboListDevice.ValueMember = "MachineCode"; cboListDevice.DisplayMember = "MachineName"; }
private void btnConnect_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (cboDeivice.EditValue != null) { Waiting.ShowWaitForm(); Waiting.SetWaitFormDescription("Đang kết nối thiết bị"); try { Class.DanhMuc_ThietBiChamCong dm = new Class.DanhMuc_ThietBiChamCong(); DataTable dt = dm.GetMachineByCode(cboDeivice.EditValue.ToString()); id = int.Parse(dt.Rows[0]["MachineCode"].ToString()); ip = dt.Rows[0]["IP"].ToString(); port = int.Parse(dt.Rows[0]["PortID"].ToString()); string MachineName = dt.Rows[0]["MachineName"].ToString(); if (MachineName.IndexOf("TFT") > 0) { product = "1"; } else { product = "0"; } bIsConnected = axczkem1.Connect_Net(ip, port); if (bIsConnected) { btnConnect.Enabled = false; btnDisconnect.Enabled = true; btnLoadData.Enabled = true; cboDeivice.Enabled = false; lblStatus.Text = "<image=State_Validation_Valid_48x48.png> Đang kết nối"; } Class.S_Log.Insert("Chấm công", "Kết nối thiết bị chấm công"); } catch { } Waiting.CloseWaitForm(); } else { MessageBox.Show("Bạn chưa chọn thết bị"); } }