Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public void Update(hr_Team obj)
        {
            var record = hr_TeamServices.GetById(obj.Id);

            if (record == null)
            {
                return;
            }
            record.RecordId             = obj.RecordId;
            record.CreatedBy            = obj.CreatedBy;
            record.CreatedDate          = obj.CreatedDate;
            record.EditedDate           = obj.EditedDate;
            record.TeamId               = obj.TeamId;
            record.ConstructionId       = obj.ConstructionId;
            record.WorkingFormId        = obj.WorkingFormId;
            record.ProbationWorkingTime = obj.ProbationWorkingTime;
            record.StudyWorkingDay      = obj.StudyWorkingDay;
            record.WorkLocationId       = obj.WorkLocationId;
            record.GraduationYear       = obj.GraduationYear;
            record.UnionJoinedDate      = obj.UnionJoinedDate;
            record.UnionJoinedPlace     = obj.UnionJoinedPlace;
            record.UnionJoinedPosition  = obj.UnionJoinedPosition;
            record.GraduationTypeId     = obj.GraduationTypeId;
            record.UniversityId         = obj.UniversityId;
            hr_TeamServices.Update(record);
        }
Example #2
0
        public TeamModel(hr_Team team)
        {
            _team = team ?? new hr_Team();

            RecordId             = _team.RecordId;
            TeamId               = _team.TeamId;
            ConstructionId       = _team.ConstructionId;
            WorkLocationId       = _team.WorkLocationId;
            WorkingFormId        = _team.WorkingFormId;
            ProbationWorkingTime = _team.ProbationWorkingTime;
            StudyWorkingDay      = _team.StudyWorkingDay;
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveEmployee_Click(object sender, DirectEventArgs e)
        {
            var recordController = new RecordController();
            var hs = new RecordModel();

            if (!string.IsNullOrEmpty(hdfPrKeyHoSo.Text))
            {
                hs.EmployeeCode = txtEmployeeCode.Text;
                if (!string.IsNullOrEmpty(txtEmployeeCode.Text.Trim()))
                {
                    var recordList = RecordController.CheckExistIDNumberAndEmployeeCode(null, null, txtEmployeeCode.Text);
                    if (recordList != null && recordList.Count > 1)
                    {
                        Dialog.ShowError("Mã cán bộ đã tồn tại. Vui lòng nhập mã cán bộ khác.");
                        txtEmployeeCode.Text = GenerateEmployeeCode();
                        return;
                    }
                }
            }
            else
            {
                hs.EmployeeCode = txtEmployeeCode.Text;
                if (!string.IsNullOrEmpty(txtEmployeeCode.Text.Trim()))
                {
                    var recordList = RecordController.CheckExistIDNumberAndEmployeeCode(null, null, txtEmployeeCode.Text);
                    if (recordList != null && recordList.Count > 0)
                    {
                        Dialog.ShowError("Mã cán bộ đã tồn tại. Vui lòng nhập mã cán bộ khác.");
                        return;
                    }
                }
                if (!string.IsNullOrEmpty(txtIDNumber.Text.Trim()))
                {
                    var recordList = RecordController.CheckExistIDNumberAndEmployeeCode(null, txtIDNumber.Text, null);
                    if (recordList != null && recordList.Count > 0)
                    {
                        Dialog.ShowError("Số chứng minh nhân dân đã tồn tại. Vui lòng nhập số chứng minh nhân dân khác.");
                        return;
                    }
                }
            }
            if (!string.IsNullOrEmpty(hdfAnhDaiDien.Text))
            {
                hs.ImageUrl = hdfAnhDaiDien.Text;
            }
            hs.FullName = txtFullName.Text;
            // lấy họ và đệm từ họ tên
            var position = hs.FullName.LastIndexOf(' ');

            hs.Name = position == -1 ? hs.FullName : hs.FullName.Substring(position + 1).Trim();

            hs.Alias = txtAlias.Text;
            if (!DatetimeHelper.IsNull(dfBirthDate.SelectedDate))
            {
                hs.BirthDate = dfBirthDate.SelectedDate;
            }
            if (!string.IsNullOrEmpty(cbxSex.SelectedItem.Value) && cbxSex.SelectedItem.Value == "M")
            {
                hs.Sex = true;
            }
            else
            {
                hs.Sex = false;
            }
            if (string.IsNullOrEmpty(cbxBasicEducation.Text))
            {
                hdfBasicEducationId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxEducation.Text))
            {
                hdfEducationId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxInputIndustry.Text))
            {
                hdfInputIndustryId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxITLevel.Text))
            {
                hdfITLevelId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxLanguageLevel.Text))
            {
                hdfLanguageLevelId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxPosition.Text))
            {
                hdfPositionId.Text = @"0";
            }
            if (string.IsNullOrEmpty(cbxJobTitle.Text))
            {
                hdfJobTitleId.Text = @"0";
            }
            if (!string.IsNullOrEmpty(hdfBirthPlaceProvinceId.Text))
            {
                hs.BirthPlaceProvinceId = Convert.ToInt32(hdfBirthPlaceProvinceId.Text);
            }
            if (string.IsNullOrEmpty(cbxBirthPlaceDistrict.Text))
            {
                hdfBirthPlaceDistrictId.Text = @"0";
            }
            if (!string.IsNullOrEmpty(hdfBirthPlaceDistrictId.Text))
            {
                hs.BirthPlaceDistrictId = Convert.ToInt32(hdfBirthPlaceDistrictId.Text);
            }
            if (string.IsNullOrEmpty(cbxBirthPlaceWard.Text))
            {
                hdfBirthPlaceWardId.Text = @"0";
            }
            if (!string.IsNullOrEmpty(hdfBirthPlaceWardId.Text))
            {
                hs.BirthPlaceWardId = Convert.ToInt32(hdfBirthPlaceWardId.Text);
            }
            if (!string.IsNullOrEmpty(hdfHometownProvinceId.Text))
            {
                hs.HometownProvinceId = Convert.ToInt32(hdfHometownProvinceId.Text);
            }
            if (string.IsNullOrEmpty(cbxHometownDistrict.Text))
            {
                hdfHometownDistrictId.Text = @"0";
            }
            if (!string.IsNullOrEmpty(hdfHometownDistrictId.Text))
            {
                hs.HometownDistrictId = Convert.ToInt32(hdfHometownDistrictId.Text);
            }
            if (string.IsNullOrEmpty(cbxHometownWard.Text))
            {
                hdfHometownWardId.Text = @"0";
            }
            if (!string.IsNullOrEmpty(hdfHometownWardId.Text))
            {
                hs.HometownWardId = Convert.ToInt32(hdfHometownWardId.Text);
            }
            if (!string.IsNullOrEmpty(hdfMaritalStatusId.Text))
            {
                hs.MaritalStatusId = Convert.ToInt32(hdfMaritalStatusId.Text);
            }
            if (!string.IsNullOrEmpty(hdfFolkId.Text))
            {
                hs.FolkId = Convert.ToInt32(hdfFolkId.Text);
            }
            if (!string.IsNullOrEmpty(hdfReligionId.Text))
            {
                hs.ReligionId = Convert.ToInt32(hdfReligionId.Text);
            }
            if (!string.IsNullOrEmpty(hdfPersonalClassId.Text))
            {
                hs.PersonalClassId = Convert.ToInt32(hdfPersonalClassId.Text);
            }
            if (!string.IsNullOrEmpty(hdfFamilyClassId.Text))
            {
                hs.FamilyClassId = Convert.ToInt32(hdfFamilyClassId.Text);
            }
            hs.ResidentPlace = txt_ResidentPlace.Text;
            hs.Address       = txt_Address.Text;
            hs.CPVCardNumber = txtCPVCardNumber.Text;
            if (!string.IsNullOrEmpty(hdfJobTitleId.Text))
            {
                hs.JobTitleId = Convert.ToInt32(hdfJobTitleId.Text);
            }
            //Ngay thu viec
            if (!DatetimeHelper.IsNull(RecruimentDate.SelectedDate))
            {
                hs.RecruimentDate = RecruimentDate.SelectedDate;
            }
            //Ngay chinh thuc
            if (!DatetimeHelper.IsNull(ParticipationDate.SelectedDate))
            {
                hs.ParticipationDate = ParticipationDate.SelectedDate;
            }
            hs.RecruimentDepartment = txtRecruitmentDepartment.Text;
            if (!string.IsNullOrEmpty(hdfBasicEducationId.Text))
            {
                hs.BasicEducationId = Convert.ToInt32(hdfBasicEducationId.Text);
            }
            if (!string.IsNullOrEmpty(hdfEducationId.Text))
            {
                hs.EducationId = Convert.ToInt32(hdfEducationId.Text);
            }
            if (!string.IsNullOrEmpty(hdfPoliticLevelId.Text))
            {
                hs.PoliticLevelId = Convert.ToInt32(hdfPoliticLevelId.Text);
            }
            if (!string.IsNullOrEmpty(hdfLanguageLevelId.Text))
            {
                hs.LanguageLevelId = Convert.ToInt32(hdfLanguageLevelId.Text);
            }
            if (!string.IsNullOrEmpty(hdfITLevelId.Text))
            {
                hs.ITLevelId = Convert.ToInt32(hdfITLevelId.Text);
            }
            if (!DatetimeHelper.IsNull(CPVJoinedDate.SelectedDate))
            {
                hs.CPVJoinedDate = CPVJoinedDate.SelectedDate;
            }
            if (!DatetimeHelper.IsNull(CPVOfficialJoinedDate.SelectedDate))
            {
                hs.CPVOfficialJoinedDate = CPVOfficialJoinedDate.SelectedDate;
            }
            hs.CPVJoinedPlace = txtCPVJoinedPlace.Text;
            if (!string.IsNullOrEmpty(hdfCPVPositionId.Text))
            {
                hs.CPVPositionId = Convert.ToInt32(hdfCPVPositionId.Text);
            }
            if (!string.IsNullOrEmpty(hdfVYUPositionId.Text))
            {
                hs.VYUPositionId = Convert.ToInt32(hdfVYUPositionId.Text);
            }
            if (!DatetimeHelper.IsNull(ArmyJoinedDate.SelectedDate))
            {
                hs.ArmyJoinedDate = ArmyJoinedDate.SelectedDate;
            }
            if (!DatetimeHelper.IsNull(ArmyLeftDate.SelectedDate))
            {
                hs.ArmyLeftDate = ArmyLeftDate.SelectedDate;
            }
            if (!string.IsNullOrEmpty(hdfPositionId.Text))
            {
                hs.PositionId = Convert.ToInt32(hdfPositionId.Text);
            }
            if (!string.IsNullOrEmpty(hdfArmyLevelId.Text))
            {
                hs.ArmyLevelId = Convert.ToInt32(hdfArmyLevelId.Text);
            }
            if (!string.IsNullOrEmpty(hdfHealthStatusId.Text))
            {
                hs.HealthStatusId = Convert.ToInt32(hdfHealthStatusId.Text);
            }
            hs.BloodGroup = cbxBloodGroup.SelectedIndex >= 0 ? cbxBloodGroup.SelectedItem.Value : "";
            if (!string.IsNullOrEmpty(txtHeight.Text))
            {
                hs.Height = Convert.ToDecimal(txtHeight.Text);
            }
            if (!string.IsNullOrEmpty(txtWeight.Text))
            {
                hs.Weight = Convert.ToDecimal(txtWeight.Text);
            }
            if (!string.IsNullOrEmpty(hdfDepartmentId.Text))
            {
                hs.DepartmentId = Convert.ToInt32(hdfDepartmentId.Text);
            }
            hs.RankWounded = txtRankWounded.Text;
            if (!string.IsNullOrEmpty(hdfFamilyPolicyId.Text))
            {
                hs.FamilyPolicyId = Convert.ToInt32(hdfFamilyPolicyId.Text);
            }
            if (!string.IsNullOrEmpty(txtIDNumber.Text))
            {
                hs.IDNumber = txtIDNumber.Text;
            }
            if (!DatetimeHelper.IsNull(IDIssueDate.SelectedDate))
            {
                hs.IDIssueDate = IDIssueDate.SelectedDate;
            }
            if (!string.IsNullOrEmpty(hdfIDIssuePlaceId.Text))
            {
                hs.IDIssuePlaceId = Convert.ToInt32(hdfIDIssuePlaceId.Text);
            }
            if (!DatetimeHelper.IsNull(VYUJoinedDate.SelectedDate))
            {
                hs.VYUJoinedDate = VYUJoinedDate.SelectedDate;
            }
            hs.VYUJoinedPlace  = txtVYUJoinedPlace.Text;
            hs.PersonalTaxCode = txtPersonalTaxCode.Text;
            if (!string.IsNullOrEmpty(hdfWorkStatusId.Text))
            {
                hs.WorkStatusId = Convert.ToInt32(hdfWorkStatusId.Text);
            }
            var workStatus = CatalogController.GetAll("cat_WorkStatus", null, ((int)RecordStatus.Working).ToString(),
                                                      null, false, null, 1);

            if (workStatus.Count > 0)
            {
                hs.WorkStatusId = workStatus.First().Id;
            }

            hs.WorkEmail          = txtWorkEmail.Text;
            hs.PersonalEmail      = txtPersonalEmail.Text;
            hs.CellPhoneNumber    = txtCellPhoneNumber.Text;
            hs.HomePhoneNumber    = txtHomePhoneNumber.Text;
            hs.WorkPhoneNumber    = txtWorkPhoneNumber.Text;
            hs.InsuranceNumber    = txtInsuranceNumber.Text;
            hs.ContactPersonName  = txtContactPersonName.Text;
            hs.ContactPhoneNumber = txtContactPhoneNumber.Text;
            hs.ContactRelation    = txtContactRelation.Text;
            hs.ContactAddress     = txtContactAddress.Text;
            if (!string.IsNullOrEmpty(hdfInputIndustryId.Text))
            {
                hs.IndustryId = Convert.ToInt32(hdfInputIndustryId.Text);
            }
            if (!DatetimeHelper.IsNull(InsuranceIssueDate.SelectedDate))
            {
                hs.InsuranceIssueDate = InsuranceIssueDate.SelectedDate;
            }

            if (Request.QueryString["Event"] == "Edit" || !string.IsNullOrEmpty(hdfPrKeyHoSo.Text))
            {
                //#region Update Ho so
                hs.Id = Convert.ToInt32(hdfPrKeyHoSo.Text);
                RecordController.Update(hs);
                var team = hr_TeamServices.GetByRecordId(hs.Id);
                if (team != null)
                {
                    team.RecordId = hs.Id;
                    EditDataFromHrTeam(team);
                    team.EditedDate = DateTime.Now;
                    hr_TeamServices.Update(team);
                }
                Dialog.ShowNotification("Cập nhật dữ liệu thành công!");
                //#endregion
            }
            else
            {
                #region Insert Ho so

                var resultModel = RecordController.Create(hs);
                //set
                hs = resultModel;
                hdfPrKeyHoSo.Text = hs.Id.ToString();
                //insert info team
                var team = new hr_Team {
                    RecordId = hs.Id
                };
                EditDataFromHrTeam(team);
                team.CreatedDate = DateTime.Now;
                hr_TeamServices.Create(team);
                Dialog.ShowNotification("Thêm mới thành công!");
                if (e.ExtraParams["Reset"] == "True")
                {
                    RM.RegisterClientScriptBlock("resetModeNew", "ResetForm();");
                }

                #endregion
            }
            // Save family
            SaveGridFamilyRelationship(e.ExtraParams["jsonFamilyRelationship"], hs.Id);
            if (e.ExtraParams["Reset"] == "True")
            {
                RM.RegisterClientScriptBlock("ClearForm", "ResetForm();");
                hdfPrKeyHoSo.Text = "";
                GridPanelFamilyRelationship.Reload();
            }
            if (e.ExtraParams["Close"] == "True")
            {
                wdEmployeeEnterprise.Hide();
            }
        }
Example #4
0
 /// <summary>
 /// edit data before save DB
 /// </summary>
 /// <param name="team"></param>
 private void EditDataFromHrTeam(hr_Team team)
 {
     if (!string.IsNullOrEmpty(hdfConstructionId.Text))
     {
         team.ConstructionId = Convert.ToInt32(hdfConstructionId.Text);
     }
     if (!string.IsNullOrEmpty(hdfTeamId.Text))
     {
         team.TeamId = Convert.ToInt32(hdfTeamId.Text);
     }
     if (!string.IsNullOrEmpty(txtStudyWorkingDay.Text))
     {
         team.StudyWorkingDay = Convert.ToInt32(txtStudyWorkingDay.Text);
     }
     //Thoi gian thu viec
     if (!string.IsNullOrEmpty(txtProbationWorkingTime.Text))
     {
         team.ProbationWorkingTime = Convert.ToInt32(txtProbationWorkingTime.Text);
     }
     if (!string.IsNullOrEmpty(hdfWorkingFormId.Text))
     {
         team.WorkingFormId = Convert.ToInt32(hdfWorkingFormId.Text);
     }
     if (!string.IsNullOrEmpty(hdfWorkLocationId.Text))
     {
         team.WorkLocationId = Convert.ToInt32(hdfWorkLocationId.Text);
     }
     if (!string.IsNullOrEmpty(txtGraduationYear.Text))
     {
         team.GraduationYear = Convert.ToInt32(txtGraduationYear.Text);
     }
     if (!string.IsNullOrEmpty(hdfGraduationTypeId.Text))
     {
         team.GraduationTypeId = Convert.ToInt32(hdfGraduationTypeId.Text);
     }
     if (!string.IsNullOrEmpty(hdfUniversityId.Text))
     {
         team.UniversityId = Convert.ToInt32(hdfUniversityId.Text);
     }
     if (!DatetimeHelper.IsNull(dfUnionJoinedDate.SelectedDate))
     {
         team.UnionJoinedDate = dfUnionJoinedDate.SelectedDate;
     }
     else
     {
         team.UnionJoinedDate = null;
     }
     team.UnionJoinedPosition = txtUnionJoinedPosition.Text;
     //BHYT
     team.HealthInsuranceNumber = txtHealthInsuranceNumber.Text;
     if (!DatetimeHelper.IsNull(dfHealthJoinedDate.SelectedDate))
     {
         team.HealthJoinedDate = dfHealthJoinedDate.SelectedDate;
     }
     else
     {
         team.HealthJoinedDate = null;
     }
     if (!DatetimeHelper.IsNull(dfHealthExpiredDate.SelectedDate))
     {
         team.HealthExpiredDate = dfHealthExpiredDate.SelectedDate;
     }
     else
     {
         team.HealthExpiredDate = null;
     }
 }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="team"></param>
 public void Insert(hr_Team team)
 {
     hr_TeamServices.Create(team);
 }