Ejemplo n.º 1
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[1].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_HRM_EMPLOYEE.Delete(row_code);
                dg_DATA.DataSource = DAO_HRM_EMPLOYEE.Get_Data();

                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = Math.Min(rowHandle, gv_DATA.DataRowCount - 1);
                }
                Grid_Process();
            }
        }
Ejemplo n.º 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.!!!");
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        private void frmTest_Load(object sender, EventArgs e)
        {
            Image img = (Image)QuanLyNhanSu.Properties.Resources.NO_PHOTO;

            byte[]       imgbyte = LOGIC_COMMON.Bitmap_To_Byte(img);
            HRM_EMPLOYEE entity  = new HRM_EMPLOYEE();

            entity.EmployeeCode = "NV000003";
            entity = DAO_HRM_EMPLOYEE.Select_Record(entity);
            byte[] photo = entity.Photo;
            textEdit1.Text = Get_Day() + "/" + Get_Month() + "/" + Get_Year();
            //    MessageBox.Show("Test");
        }
Ejemplo n.º 5
0
        private void frm_EDIT_Load(object sender, EventArgs e)
        {
            old_entity = new HRM_EMPLOYEE();

            old_entity.EmployeeCode = CODE;
            old_entity             = DAO_HRM_EMPLOYEE.Select_Record(old_entity);
            txt_EMPLOYEE_CODE.Text = old_entity.EmployeeCode;
            txt_FIRST_NAME.Text    = old_entity.FirstName;
            txt_LAST_NAME.Text     = old_entity.LastName;
            txt_ALIAS.Text         = old_entity.Alias;
            bool sex = (bool)old_entity.Sex;

            cbo_WORK_STATE.EditValue   = old_entity.WorkStateCode;
            chk_SEX.Checked            = sex;
            date_BIRTHDAY.DateTime     = (DateTime)old_entity.Birthday;
            txt_BIRTH_PLACE.Text       = old_entity.BirthPlace;
            txt_ALIAS.Text             = old_entity.Alias;
            cbo_MARRIAGE.Text          = old_entity.Marriage;
            txt_IDCARD.Text            = old_entity.IDCard;
            date_IDCARD.DateTime       = (DateTime)old_entity.IDCardDate;
            txt_IDCARD_PLACE.Text      = old_entity.IDCardPlace;
            txt_MAIN_ADDRESS.Text      = old_entity.MainAddress;
            txt_CONTACT_ADDRESS.Text   = old_entity.ContactAddress;
            txt_CELL_PHONE.Text        = old_entity.CellPhone;
            txt_EMAIL.Text             = old_entity.Email;
            cbo_NATIONALITY.EditValue  = old_entity.Nationality;
            cbo_ETHNIC.EditValue       = old_entity.Ethnic;
            cbo_RELIGION.EditValue     = old_entity.Religion;
            cbo_EDUCATION.EditValue    = old_entity.Education;
            cbo_LANGUAGE.EditValue     = old_entity.Language;
            cbo_INFORMATIC.EditValue   = old_entity.Informatic;
            cbo_PROFESSIONAL.EditValue = old_entity.Professional;
            cbo_DEPARTMENT.EditValue   = old_entity.DepartmentCode;
            cbo_SCHOOL.EditValue       = old_entity.School;
            if (old_entity.Photo != null)
            {
                pic_PHOTO.Image = LOGIC_COMMON.Byte_To_Bitmap(old_entity.Photo);
            }
        }
Ejemplo n.º 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[1].ToString();
            frm_NHAN_VIEN_EDIT frm_edit = new frm_NHAN_VIEN_EDIT(row_code);

            if (frm_edit.ShowDialog() == DialogResult.OK)
            {
                dg_DATA.DataSource = DAO_HRM_EMPLOYEE.Get_Data();
                int rowHandle = gv_DATA.LocateByValue(column_code, row_code);
                if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
                {
                    gv_DATA.FocusedRowHandle = rowHandle;
                }
                Grid_Process();
            }
        }
Ejemplo n.º 7
0
 void frm_Load(object sender, EventArgs e)
 {
     dg_DATA.DataSource = DAO_HRM_EMPLOYEE.Get_Data();
     Grid_Process();
 }