protected void btnOK_Click(object sender, DirectEventArgs e) { try { DataTable record = new BHCHEDOBAOHIEMController().GetByPrkey(Convert.ToInt32(txtmaloaihdcoppy.Text)); if (record.Rows.Count > 0) { Dialog.ShowNotification("Mã đã tồn tại"); } else { record = new BHCHEDOBAOHIEMController().GetByPrkey(Convert.ToInt32(hdfRecordID.Text)); record.Rows[0]["IDCheDoBaoHiem"] = int.Parse(txtmaloaihdcoppy.Text); BHCHEDOBAOHIEMInfo item = new BHCHEDOBAOHIEMInfo() { IDCheDoBaoHiem = int.Parse(record.Rows[0]["IDCheDoBaoHiem"].ToString()), ParentID = int.Parse(record.Rows[0]["ParentID"].ToString()), MaCheDoBaohiem = record.Rows[0]["MaCheDoBaohiem"].ToString(), TenCheDoBaoHiem = record.Rows[0]["TenCheDoBaoHiem"].ToString(), UserID = int.Parse(record.Rows[0]["UserID"].ToString()), DateCreate = DateTime.Parse(record.Rows[0]["DateCreate"].ToString()), MaDonVi = record.Rows[0]["MaDonVi"].ToString(), }; new BHCHEDOBAOHIEMController().Insert(item); } GridPanel1.Reload(); wdInputNewPrimaryKey.Hide(); } catch (Exception ex) { Dialog.ShowError(ex.Message.ToString()); } }
protected void btnCapNhat_Click(object sender, DirectEventArgs e) { BHCHEDOBAOHIEMInfo obj = new BHCHEDOBAOHIEMInfo(); BHCHEDOBAOHIEMController ctr = new BHCHEDOBAOHIEMController(); if (!string.IsNullOrEmpty(cboCheDoBH.Text)) { obj.ParentID = Convert.ToInt32(cboCheDoBH.Value); } obj.MaCheDoBaohiem = txtMaCheDoBaohiem.Text; obj.TenCheDoBaoHiem = txtTenCheDoBaoHiem.Text; obj.UserID = CurrentUser.ID; obj.DateCreate = DateTime.Now; obj.MaDonVi = Session["MaDonVi"].ToString(); if (e.ExtraParams["Command"] == "Edit") { obj.IDCheDoBaoHiem = Convert.ToInt32(hdfRecordID.Text); //obj.IDCheDoBaoHiem = Convert.ToInt32(hdfIdcha_edit.Text); ctr.Update(obj); wdAddWindow.Hide(); hdfIdcha_edit.Text = ""; } else { if (cboCheDoBH.Value.ToString() == "0") { obj.ParentID = 0; } DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("GetCheDoBaoHiem_MaCheDoBaoHiem", "@MaCheDoBaoHiem", txtMaCheDoBaohiem.Text); if (dt.Rows.Count > 0) { X.MessageBox.Alert("Thông báo", "Mã chế độ bảo hiểm đã tồn tại").Show(); txtMaCheDoBaohiem.Focus(); return; } else { ctr.Insert(obj); cboCheDoBH.Reset(); txtMaCheDoBaohiem.Reset(); txtTenCheDoBaoHiem.Reset(); } if (e.ExtraParams["Close"] == "True") { wdAddWindow.Hide(); } } GridPanel1.Reload(); }
protected void btnCapNhat_Click_Cha(object sender, DirectEventArgs e) { BHCHEDOBAOHIEMInfo obj = new BHCHEDOBAOHIEMInfo(); BHCHEDOBAOHIEMController ctr = new BHCHEDOBAOHIEMController(); obj.ParentID = 0; obj.MaCheDoBaohiem = txtcha_machedobh.Text; obj.TenCheDoBaoHiem = txtcha_tenchedobh.Text; obj.UserID = CurrentUser.ID; obj.DateCreate = DateTime.Now; obj.MaDonVi = Session["MaDonVi"].ToString(); if (e.ExtraParams["Command"] == "Edit") { obj.IDCheDoBaoHiem = Convert.ToInt32(hdfNhomCha.Text); ctr.Update(obj); wdNhomCheDoBH.Hide(); } else { DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("GetCheDoBaoHiem_MaCheDoBaoHiem", "@MaCheDoBaoHiem", txtcha_machedobh.Text); if (dt.Rows.Count > 0) { X.MessageBox.Alert("Thông báo", "Mã chế độ bảo hiểm đã tồn tại").Show(); txtcha_machedobh.Focus(); return; } else { ctr.Insert(obj); txtcha_machedobh.Reset(); txtcha_tenchedobh.Reset(); } } if (e.ExtraParams["Close"] == "True") { wdNhomCheDoBH.Hide(); } grp_nhombhdcd.Reload(); }
public void Update(BHCHEDOBAOHIEMInfo record) { DataController.DataHandler.GetInstance().ExecuteNonQuery("UpdateBHCHEDOBAOHIEM", "@IDCheDoBaoHiem", "@ParentID", "@MaCheDoBaohiem", "@TenCheDoBaoHiem", "@UserID", "@DateCreate", "@MaDonVi", record.IDCheDoBaoHiem, record.ParentID, record.MaCheDoBaohiem, record.TenCheDoBaoHiem, record.UserID, record.DateCreate, record.MaDonVi); }
public void Insert(BHCHEDOBAOHIEMInfo record) { DataController.DataHandler.GetInstance().ExecuteScalar("InsertBHCHEDOBAOHIEM", "@ParentID", "@MaCheDoBaohiem", "@TenCheDoBaoHiem", "@UserID", "@DateCreate", "@MaDonVi", record.ParentID, record.MaCheDoBaohiem, record.TenCheDoBaoHiem, record.UserID, record.DateCreate, record.MaDonVi); }