示例#1
0
        private bool Insert()
        {
            new_entity = new DIC_EDUCATION();
            new_entity.EducationCode = txt_EDUCATION_CODE.Text;
            new_entity.EducationName = txt_EDUCATION_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_EDUCATION.Add(new_entity);
                if (parent != null)
                {
                    parent.dg_DATA.DataSource = DAO_DIC_EDUCATION.Get_Data();
                }
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi !!");
                return(false);
            }
            return(true);
        }
示例#2
0
        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_HOC_VAN_EDIT frm_edit = new frm_HOC_VAN_EDIT(row_code);

            if (frm_edit.ShowDialog() == DialogResult.OK)
            {
                dg_DATA.DataSource = DAO_DIC_EDUCATION.Get_Data();
                int rowHandle = gv_DATA.LocateByValue(column_code, row_code);
                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = rowHandle;
                }
            }
        }
示例#3
0
        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_EDUCATION.Delete(row_code);
                dg_DATA.DataSource = DAO_DIC_EDUCATION.Get_Data();

                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = Math.Min(rowHandle, gv_DATA.DataRowCount - 1);
                }
            }
        }
示例#4
0
 void frm_Load(object sender, EventArgs e)
 {
     dg_DATA.DataSource = DAO_DIC_EDUCATION.Get_Data();
 }