private void btnTaoBanNang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { frmTaoBanNang frm = new frmTaoBanNang(); frm.ShowDialog(); if (frm.s_NewID != "") { if (SqlConn == null || SqlConn.State != ConnectionState.Open) { Database.Open(ref this.SqlConn); } if (SqlConn.State == ConnectionState.Open) { try { DsBanNang ds = new DsBanNang(); ds.Insert(SqlConn, frm.s_NewID, frm.s_KyThuatVien, frm.s_NoiDungHienThi); } catch { MessageBox.Show("Xử lý lỗi !", "Lỗi"); } finally { CapNhatDuLieuGridView(); } } } }
private void btnSuaBanNang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string s_IDBanNang = ""; try { s_IDBanNang = grvBanNang.GetRowCellValue(grvBanNang.FocusedRowHandle, "maql").ToString(); frmTaoBanNang frm = new frmTaoBanNang(s_SerialPort, SqlConn, true, s_IDBanNang); frm.ShowDialog(); } catch { MessageBox.Show("Xử lý lỗi !", "Lỗi"); } finally { CapNhatDuLieuGridView(); } }