void btnDongY_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (txtGio.Text != "" && txtPhut.Text != "" && cbbDsBanNang.EditValue.ToString() != "") { Int32 i_TG = Convert.ToInt16(txtGio.Text) * 60 + Convert.ToInt16(txtPhut.Text); string s_ID = cbbDsBanNang.EditValue.ToString(); DsBanNang dsBN = new DsBanNang(); dsBN.UpdateTrangThai(conn, s_ID, TrangThai.TrangThaiBanNang.DangSuaChua); dsBN.UpdateThongTinKH(conn, s_ID, s_MaQL, (short)i_TG); DsKhachHang dsKH = new DsKhachHang(); dsKH.UpdateTrangThai(conn, s_MaQL, TrangThai.TrangThaiKhachHang.DangSuaChua); if (i_TG > 0) { string s_ThoiGian = Convert.ToDecimal(txtGio.Text == "" ? "0" : txtGio.Text).ToString("00") + ":" + Convert.ToDecimal(txtPhut.Text == "" ? "0" : txtPhut.Text).ToString("00"); string str = "#LED," + s_ID + "," + TienIch.Access.convertToUnSign3(s_HoTen).ToUpper() + "," + s_BienSoXe + "," + s_ThoiGian + "*"; byte[] data = System.Text.Encoding.UTF8.GetBytes(str); TienIch.ComPort.serialPort_Send(data, 0, data.Length); } this.Close(); } else { MessageBox.Show("Dữ liệu không hợp lệ"); } }
private void btnTra_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DialogResult dialogResult = XtraMessageBox.Show("Bạn muốn xóa thông tin khách hàng khỏi danh sách ?", "Cảnh báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { if (SqlConn == null || SqlConn.State != ConnectionState.Open) { Database.Open(ref this.SqlConn); } if (SqlConn.State == ConnectionState.Open) { try { string s_MaQL = grvKhachHang.GetRowCellValue(grvKhachHang.FocusedRowHandle, "maql").ToString(); DsKhachHang ds = new DsKhachHang(); ds.UpdateTrangThai(SqlConn, s_MaQL, TrangThai.TrangThaiKhachHang.KetThucSuaChua); } catch { } finally { CapNhatDuLieuGridView(); } } } else if (dialogResult == DialogResult.No) { } }