Пример #1
0
        private bool Insert()
        {
            new_entity = new DIC_INFORMATIC();
            new_entity.InformaticCode = txt_INFORMATIC_CODE.Text;
            new_entity.InformaticName = txt_INFORMATIC_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_INFORMATIC.Add(new_entity);
                if (parent != null)
                {
                    parent.dg_DATA.DataSource = DAO_DIC_INFORMATIC.Get_Data();
                }
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi..!!!");
                return(false);
            }
            return(true);
        }
Пример #2
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);
        }
Пример #3
0
        private bool Insert()
        {
            new_entity = new DIC_PROFESSIONAL();
            new_entity.ProfessionalCode = txt_PROFESSIONAL_CODE.Text;
            new_entity.ProfessionalName = txt_PROFESSIONAL_NAME.Text;
            new_entity.Description      = txt_DESCRIPTION.Text;
            new_entity.Active           = true;

            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_DIC_PROFESSIONAL.Add(new_entity);
                if (parent != null)
                {
                    parent.dg_DATA.DataSource = DAO_DIC_PROFESSIONAL.Get_Data();
                }
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Loi");
                return(false);
            }
            return(true);
        }
Пример #4
0
        public static ENT_RETURN Check_Data(DIC_EDUCATION e)
        {
            ENT_RETURN ret     = new ENT_RETURN();
            string     err_msg = string.Empty;

            // BEGIN CHECK
            if (Is_Empty_String(e.EducationName))
            {
                err_msg += GLOBAL.err_code["E006"];
            }
            if (Is_Over_MaxLength(e.EducationName, 100))
            {
                err_msg += GLOBAL.err_code["E007"];
            }
            if (Is_Over_MaxLength(e.Description, 255))
            {
                err_msg += GLOBAL.err_code["E003"];
            }
            // END CHECK

            if (err_msg != string.Empty)
            {
                ret.Message = err_msg;
                ret.Status  = false;
            }
            return(ret);
        }
Пример #5
0
        internal static ENT_RETURN Check_Data(DIC_DEPARTMENT e)
        {
            //throw new NotImplementedException();
            ENT_RETURN ret     = new ENT_RETURN();
            string     err_msg = string.Empty;

            // BEGIN CHECK
            if (Is_Empty_String(e.DepartmentName))
            {
                err_msg += GLOBAL.err_code["E018"];
            }
            if (Is_Over_MaxLength(e.DepartmentName, 100))
            {
                err_msg += GLOBAL.err_code["E019"];
            }
            if (Is_Over_MaxLength(e.Description, 200))
            {
                err_msg += GLOBAL.err_code["E003"];
            }
            // END CHECK
            if (err_msg != string.Empty)
            {
                ret.Message = err_msg;
                ret.Status  = false;
            }
            return(ret);
        }
Пример #6
0
        public static ENT_RETURN Check_Data(DIC_INFORMATIC e)
        {
            ENT_RETURN ret     = new ENT_RETURN();
            string     err_msg = string.Empty;

            // BEGIN CHECK
            if (Is_Empty_String(e.InformaticName))
            {
                err_msg += GLOBAL.err_code["E010"];
            }
            if (Is_Over_MaxLength(e.InformaticName, 100))
            {
                err_msg += GLOBAL.err_code["E011"];
            }
            if (Is_Over_MaxLength(e.Description, 200))
            {
                err_msg += GLOBAL.err_code["E003"];
            }
            // END CHECK
            if (err_msg != string.Empty)
            {
                ret.Message = err_msg;
                ret.Status  = false;
            }
            return(ret);
        }
Пример #7
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.!!!");
            }
        }
Пример #8
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);
        }
Пример #9
0
        private void btn_SAVE_Click(object sender, EventArgs e)
        {
            new_entity             = new DIC_ETHNIC();
            new_entity.EthnicCode  = txt_ETHNIC_CODE.Text;
            new_entity.EthnicName  = txt_ETHNIC_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_ETHNIC.Update(old_entity, new_entity);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");
            }
        }
Пример #10
0
        private void btn_SAVE_Click(object sender, EventArgs e)
        {
            new_entity = new DIC_PROFESSIONAL();
            new_entity.ProfessionalCode = txt_PROFESSIONAL_CODE.Text;
            new_entity.ProfessionalName = txt_PROFESSIONAL_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_PROFESSIONAL.Update(old_entity, new_entity);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Loi");
            }
        }
Пример #11
0
        private void btn_SAVE_Click(object sender, EventArgs e)
        {
            new_entity = new DIC_POSITION();


            new_entity.PositionCode = txt_POSITION_CODE.Text;
            new_entity.PositionName = txt_POSITION_NAME.Text;
            new_entity.Description  = txt_DESCRIPTION.Text;
            new_entity.IsManager    = chk_IS_MANAGER.Checked;
            new_entity.Active       = old_entity.Active;
            ENT_RETURN validate = LOGIC_CHECK.Check_Data(new_entity);

            if (validate.Status)
            {
                DAO_DIC_POSITION.Update(old_entity, new_entity);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!");
            }
        }
Пример #12
0
        private bool Insert()
        {
            new_entity = new DIC_POSITION();
            new_entity.PositionCode = txt_POSITION_CODE.Text;
            new_entity.PositionName = txt_POSITION_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_POSITION.Add(new_entity);
                parent.dg_DATA.DataSource = DAO_DIC_POSITION.Get_Data();
            }
            else
            {
                XtraMessageBox.Show(validate.Message, "Lỗi.!!!"); return(false);
            }
            return(true);
        }
Пример #13
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.!!!");
            }
        }
Пример #14
0
        public static ENT_RETURN Check_Data(HRM_EMPLOYEE new_entity)
        {
            //throw new NotImplementedException();
            ENT_RETURN ret     = new ENT_RETURN();
            string     err_msg = string.Empty;

            if (Is_Empty_String(new_entity.FirstName))
            {
                err_msg += GLOBAL.err_code["E020"];
            }
            if (Is_Empty_String(new_entity.LastName))
            {
                err_msg += GLOBAL.err_code["E021"];
            }
            if (Is_Empty_String(new_entity.Birthday.ToString()))
            {
                err_msg += GLOBAL.err_code["E026"];
            }
            if (Is_Empty_String(new_entity.BirthPlace))
            {
                err_msg += GLOBAL.err_code["E027"];
            }
            if (Is_Empty_String(new_entity.IDCard))
            {
                err_msg += GLOBAL.err_code["E022"];
            }
            if (Is_Over_MaxLength(new_entity.IDCard, 9) && !Is_Number(new_entity.IDCard))
            {
                err_msg += GLOBAL.err_code["E028"];
            }


            //
            //
            if (Is_Empty_String(new_entity.IDCardPlace))
            {
                err_msg += GLOBAL.err_code["E030"];
            }
            if (!Is_Empty_String(new_entity.Email))
            {
                if (!Is_Email(new_entity.Email))
                {
                    err_msg += GLOBAL.err_code["E033"];
                }
                else
                {
                }
            }



            if (Is_Empty_String(new_entity.Nationality))
            {
                err_msg += GLOBAL.err_code["E023"];
            }
            if (Is_Empty_String(new_entity.Ethnic))
            {
                err_msg += GLOBAL.err_code["E025"];
            }
            if (Is_Empty_String(new_entity.Religion))
            {
                err_msg += GLOBAL.err_code["E024"];
            }
            if (Is_Empty_String(new_entity.Professional))
            {
                err_msg += GLOBAL.err_code["E031"];
            }
            if (Is_Empty_String(new_entity.School))
            {
                err_msg += GLOBAL.err_code["E032"];
            }
            if (Is_Empty_String(new_entity.WorkStateCode))
            {
                err_msg += GLOBAL.err_code["E034"];
            }
            if (Is_Empty_String(new_entity.DepartmentCode))
            {
                err_msg += GLOBAL.err_code["E035"];
            }
            if (err_msg != string.Empty)
            {
                ret.Message = err_msg;
                ret.Status  = false;
            }
            return(ret);
        }