private bool Insert() { new_entity = new DIC_RELIGION(); new_entity.ReligionCode = txt_RELIGION_CODE.Text; new_entity.ReligionName = txt_RELIGION_NAME.Text; new_entity.Description = txt_DESCRIPTION.Text; //new_entity.IsManager = chk_IS_MANAGER.Checked; new_entity.Active = true; ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity); if (validate.Status) { DAO_DIC_RELIGION.Add(new_entity); if (parent != null) { parent.dg_DATA.DataSource = DAO_DIC_RELIGION.Get_Data(); } } else { XtraMessageBox.Show(validate.Message, "Lỗi..!!!!"); return(false); } return(true); }
private void frm_EDIT_Load(object sender, EventArgs e) { old_entity = new DIC_RELIGION(); old_entity.ReligionCode = CODE; old_entity = DAO_DIC_RELIGION.Select_Record(old_entity); txt_RELIGION_CODE.Text = old_entity.ReligionCode; txt_RELIGION_NAME.Text = old_entity.ReligionName; txt_DESCRIPTION.Text = old_entity.Description; }
//DataTable dt_RELIGION = null; private void Init_Reference_Data() { LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_RELIGION, DAO_DIC_RELIGION.Get_View_Data(), "Mã Tôn Giáo", "Tên Tôn Giáo"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_NATIONALITY, DAO_DIC_NATIONALITY.Get_View_Data(), "Mã Quốc Tịch", "Tên Quốc Tịch"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_ETHNIC, DAO_DIC_ETHNIC.Get_View_Data(), "Mã Dân Tộc", "Tên Dân Tộc"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_LANGUAGE, DAO_DIC_LANGUAGE.Get_View_Data(), "Mã Ngôn Ngữ", "Tên Ngôn Ngữ"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_INFORMATIC, DAO_DIC_INFORMATIC.Get_View_Data(), "Mã Bằng Tin Học", "Tên Bằng Tin Học"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_PROFESSIONAL, DAO_DIC_PROFESSIONAL.Get_View_Data(), "Mã Chuyên Môn", "Tên Chuyên Môn"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_SCHOOL, DAO_DIC_SCHOOL.Get_View_Data(), "Mã Trường", "Tên Trường"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_EDUCATION, DAO_DIC_EDUCATION.Get_View_Data(), "Mã Học Vấn", "Tên Học Vấn"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_DEPARTMENT, DAO_DIC_DEPARTMENT.Get_View_Data(), "Mã Phòng Ban", "Tên Phòng Ban"); LOGIC_COMMON.Init_Lookup_Edit_DataSource(cbo_WORK_STATE, DAO_DIC_WORK_STATE.Get_View_Data(), "Mã Trạng Thái", "Tên Trạng Thái"); }
private void btn_SAVE_Click(object sender, EventArgs e) { new_entity = new DIC_RELIGION(); new_entity.ReligionCode = txt_RELIGION_CODE.Text; new_entity.ReligionName = txt_RELIGION_NAME.Text; new_entity.Description = txt_DESCRIPTION.Text; new_entity.Active = old_entity.Active; ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity); if (validate.Status) { DAO_DIC_RELIGION.Update(old_entity, new_entity); this.DialogResult = DialogResult.OK; } else { XtraMessageBox.Show(validate.Message, "Lỗi..!!!!"); } }
void edit_record(object sender, EventArgs e) { DataRowView current_row = (DataRowView)gv_DATA.GetFocusedRow(); if (current_row == null) { return; } string row_code = current_row.Row.ItemArray[0].ToString(); frm_TON_GIAO_EDIT frm_edit = new frm_TON_GIAO_EDIT(row_code); if (frm_edit.ShowDialog() == DialogResult.OK) { dg_DATA.DataSource = DAO_DIC_RELIGION.Get_Data(); int rowHandle = gv_DATA.LocateByValue(column_code, row_code); if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { gv_DATA.FocusedRowHandle = rowHandle; } } }
void delete_record(object sender, EventArgs e) { DataRowView current_row = (DataRowView)gv_DATA.GetFocusedRow(); if (current_row == null) { return; } string row_code = current_row.Row.ItemArray[0].ToString(); DialogResult dlg = XtraMessageBox.Show("Bạn có chắc xóa mã : " + row_code + "?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dlg == DialogResult.Yes) { int rowHandle = gv_DATA.LocateByValue(column_code, row_code); DAO_DIC_RELIGION.Delete(row_code); dg_DATA.DataSource = DAO_DIC_RELIGION.Get_Data(); if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle) { gv_DATA.FocusedRowHandle = Math.Min(rowHandle, gv_DATA.DataRowCount - 1); } } }
void frm_Load(object sender, EventArgs e) { dg_DATA.DataSource = DAO_DIC_RELIGION.Get_Data(); }