예제 #1
0
        private bool Insert()
        {
            new_entity = new DIC_DEPARTMENT();
            new_entity.DepartmentCode = txt_DEPARTMENT_CODE.Text;
            new_entity.DepartmentName = txt_DEPARTMENT_NAME.Text;
            new_entity.Description    = txt_DESCRIPTION.Text;
            new_entity.Phone          = txt_PHONE.Text;
            new_entity.Quantity       = 0;
            new_entity.FactQuantity   = 0;
            new_entity.Active         = true;
            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_DIC_DEPARTMENT.Add(new_entity);
                parent.dg_DATA.DataSource = DAO_DIC_DEPARTMENT.Get_Data();
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");

                return(false);
            }
            return(true);
        }
예제 #2
0
        private void btn_SAVE_Click(object sender, EventArgs e)
        {
            new_entity = new HRM_EMPLOYEE();
            new_entity.EmployeeCode   = txt_EMPLOYEE_CODE.Text;
            new_entity.FirstName      = txt_FIRST_NAME.Text;
            new_entity.LastName       = txt_LAST_NAME.Text;
            new_entity.Sex            = chk_SEX.Checked;
            new_entity.Birthday       = date_BIRTHDAY.DateTime;
            new_entity.BirthPlace     = txt_BIRTH_PLACE.Text;
            new_entity.Alias          = txt_ALIAS.Text;
            new_entity.Marriage       = (cbo_MARRIAGE.EditValue == null ? "" : cbo_MARRIAGE.EditValue.ToString());
            new_entity.IDCard         = txt_IDCARD.Text;
            new_entity.DepartmentCode = cbo_DEPARTMENT.EditValue.ToString();
            new_entity.WorkStateCode  = (cbo_WORK_STATE.EditValue == null ? null : cbo_WORK_STATE.EditValue.ToString());
            new_entity.IDCardDate     = date_IDCARD.DateTime;
            new_entity.IDCardPlace    = txt_IDCARD_PLACE.Text;
            new_entity.MainAddress    = txt_MAIN_ADDRESS.Text;
            new_entity.ContactAddress = txt_CONTACT_ADDRESS.Text;
            new_entity.CellPhone      = txt_CELL_PHONE.Text;
            new_entity.Email          = txt_EMAIL.Text;
            new_entity.Nationality    = cbo_NATIONALITY.EditValue.ToString();
            new_entity.Religion       = (cbo_RELIGION.EditValue == null ?  null : cbo_RELIGION.EditValue.ToString());
            new_entity.Ethnic         = (cbo_ETHNIC.EditValue == null ? null : cbo_ETHNIC.EditValue.ToString());
            new_entity.Education      = (cbo_EDUCATION.EditValue == null ? null : cbo_EDUCATION.EditValue.ToString());
            new_entity.Language       = (cbo_LANGUAGE.EditValue == null ? null : cbo_LANGUAGE.EditValue.ToString());
            new_entity.Informatic     = (cbo_INFORMATIC.EditValue == null ? null : cbo_INFORMATIC.EditValue.ToString());
            new_entity.Professional   = (cbo_PROFESSIONAL.EditValue == null ? null : cbo_PROFESSIONAL.EditValue.ToString());
            new_entity.School         = (cbo_SCHOOL.EditValue == null ? null : cbo_SCHOOL.EditValue.ToString());

            // HOP DONG LAO DONG
            new_entity.ContractFromDate = old_entity.ContractFromDate;
            new_entity.ContractSignDate = old_entity.ContractSignDate;
            new_entity.ContractToDate   = old_entity.ContractToDate;


            if (pic_PHOTO.Image != null)
            {
                new_entity.Photo = LOGIC_COMMON.Bitmap_To_Byte(pic_PHOTO.Image);
            }

            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_HRM_EMPLOYEE.Update(old_entity, new_entity);
                DAO_DIC_DEPARTMENT.Update_Quanlity(old_entity.DepartmentCode);
                DAO_DIC_DEPARTMENT.Update_Quanlity(new_entity.DepartmentCode);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");
            }
        }
예제 #3
0
        private bool Insert()
        {
            new_entity = new HRM_EMPLOYEE();
            new_entity.EmployeeCode   = txt_EMPLOYEE_CODE.Text;
            new_entity.FirstName      = txt_FIRST_NAME.Text;
            new_entity.LastName       = txt_LAST_NAME.Text;
            new_entity.Sex            = chk_SEX.Checked;
            new_entity.IDCard         = txt_IDCARD.Text;
            new_entity.Birthday       = date_BIRTHDAY.DateTime;
            new_entity.BirthPlace     = txt_BIRTH_PLACE.Text;
            new_entity.Marriage       = (cbo_MARRIAGE.EditValue == null ? "" : cbo_MARRIAGE.EditValue.ToString());
            new_entity.IDCardDate     = date_IDCARD.DateTime;
            new_entity.IDCardPlace    = txt_IDCARD_PLACE.Text;
            new_entity.MainAddress    = txt_MAIN_ADDRESS.Text;
            new_entity.ContactAddress = txt_CONTACT_ADDRESS.Text;
            new_entity.CellPhone      = txt_CELL_PHONE.Text;
            new_entity.Email          = txt_EMAIL.Text;
            new_entity.Photo          = LOGIC_COMMON.Bitmap_To_Byte(pic_PHOTO.Image);
            new_entity.Language       = (cbo_LANGUAGE.EditValue == null ? "" : cbo_LANGUAGE.EditValue.ToString());
            new_entity.Education      = (cbo_EDUCATION.EditValue == null ? "" : cbo_EDUCATION.EditValue.ToString());
            new_entity.Professional   = (cbo_PROFESSIONAL.EditValue == null ? "" : cbo_PROFESSIONAL.EditValue.ToString());
            new_entity.Nationality    = (cbo_NATIONALITY.EditValue == null ? "":cbo_NATIONALITY.EditValue.ToString());
            new_entity.Ethnic         = (cbo_ETHNIC.EditValue == null ? "" : cbo_ETHNIC.EditValue.ToString());
            new_entity.Religion       = (cbo_RELIGION.EditValue == null ? "" : cbo_RELIGION.EditValue.ToString());
            new_entity.School         = (cbo_SCHOOL.EditValue == null ? "" : cbo_SCHOOL.EditValue.ToString());
            new_entity.WorkStateCode  = (cbo_WORK_STATE.EditValue == null ? null : cbo_WORK_STATE.EditValue.ToString());
            new_entity.DepartmentCode = (cbo_DEPARTMENT.EditValue == null ? null : cbo_DEPARTMENT.EditValue.ToString());

            // HOP DONG LAO DONG
            DateTime frmDate = DateTime.Now;
            DateTime endDate = frmDate.AddYears(2);

            new_entity.ContractFromDate = (DateTime?)frmDate;
            new_entity.ContractSignDate = (DateTime?)frmDate;
            new_entity.ContractToDate   = (DateTime?)endDate;



            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_HRM_EMPLOYEE.Add(new_entity);
                DAO_DIC_DEPARTMENT.Update_Quanlity(new_entity.DepartmentCode);
                parent.dg_DATA.DataSource = DAO_HRM_EMPLOYEE.Get_Data();
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");
                return(false);
            }
            return(true);
        }
예제 #4
0
 //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");
 }
예제 #5
0
        private void frm_EDIT_Load(object sender, EventArgs e)
        {
            old_entity = new DIC_DEPARTMENT();

            old_entity.DepartmentCode = CODE;
            old_entity = DAO_DIC_DEPARTMENT.Select_Record(old_entity);
            txt_DEPARTMENT_CODE.Text = old_entity.DepartmentCode;
            txt_DEPARTMENT_NAME.Text = old_entity.DepartmentName;
            txt_DESCRIPTION.Text     = old_entity.Description;
            txt_PHONE.Text           = old_entity.Phone;
            txt_QUANLITY.Text        = old_entity.Quantity.ToString();
            txt_FACT_QUANLITY.Text   = old_entity.FactQuantity.ToString();
        }
예제 #6
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_PHONG_BAN_EDIT frm_edit = new frm_PHONG_BAN_EDIT(row_code);

            if (frm_edit.ShowDialog() == DialogResult.OK)
            {
                dg_DATA.DataSource = DAO_DIC_DEPARTMENT.Get_Data();
                int rowHandle = gv_DATA.LocateByValue(column_code, row_code);
                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = rowHandle;
                }
            }
        }
예제 #7
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_DEPARTMENT.Delete(row_code);
                dg_DATA.DataSource = DAO_DIC_DEPARTMENT.Get_Data();

                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = Math.Min(rowHandle, gv_DATA.DataRowCount - 1);
                }
            }
        }
예제 #8
0
        private void btn_SAVE_Click(object sender, EventArgs e)
        {
            new_entity = new DIC_DEPARTMENT();


            new_entity.DepartmentCode = txt_DEPARTMENT_CODE.Text;
            new_entity.DepartmentName = txt_DEPARTMENT_NAME.Text;
            new_entity.Description    = txt_DESCRIPTION.Text;
            new_entity.Phone          = txt_PHONE.Text;
            new_entity.Quantity       = old_entity.Quantity;
            new_entity.FactQuantity   = old_entity.FactQuantity;
            new_entity.Active         = old_entity.Active;
            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_DIC_DEPARTMENT.Update(old_entity, new_entity);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");
            }
        }
예제 #9
0
 void frm_Load(object sender, EventArgs e)
 {
     dg_DATA.DataSource = DAO_DIC_DEPARTMENT.Get_Data();
 }