/// <summary> /// edit data /// </summary> /// <param name="model"></param> private void EditDataSave(GoAboardModel model) { model.Reason = txtReason.Text; model.Note = txtNote.Text; model.SponsorDepartment = txtSponsorDepartment.Text; model.SourceDepartment = txtSourceDepartment.Text; model.DecisionNumber = txtDecisionNumber.Text; model.DecisionMaker = txtDecisionMaker.Text; model.MakerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text; if (!string.IsNullOrEmpty(hdfNationId.Text)) { model.NationId = Convert.ToInt32(hdfNationId.Text); } if (!DatetimeHelper.IsNull(dfFromDate.SelectedDate)) { model.StartDate = dfFromDate.SelectedDate; } if (!DatetimeHelper.IsNull(dfToDate.SelectedDate)) { model.EndDate = dfToDate.SelectedDate; } if (!DatetimeHelper.IsNull(dfDecisionDate.SelectedDate)) { model.DecisionDate = dfDecisionDate.SelectedDate; } }
/// <summary> /// /// </summary> /// <param name="timeSheetReportModel"></param> private void EditData(TimeSheetReportModel timeSheetReportModel) { timeSheetReportModel.Name = txtName.Text; if (!DatetimeHelper.IsNull(dfFromDate.SelectedDate)) { timeSheetReportModel.StartDate = dfFromDate.SelectedDate; } if (!DatetimeHelper.IsNull(dfToDate.SelectedDate)) { timeSheetReportModel.EndDate = dfToDate.SelectedDate; } }
/// <summary> /// /// </summary> /// <param name="e"></param> private void Insert(DirectEventArgs e) { try { foreach (var itemRow in chkEmployeeRowSelection.SelectedRows) { var model = new TrainingHistoryModel() { RecordId = Convert.ToInt32(itemRow.RecordID), TrainingName = txtDTTenKhoaDaoTao.Text.Trim(), Reason = txtDTLyDoDaoTao.Text.Trim(), TrainingPlace = txtDTNoiDaoTao.Text.Trim(), Note = txtDTGhiChu.Text.Trim(), SponsorDepartment = txtSponsorDepartment.Text, DecisionMaker = txtDecisionMaker.Text, SourceDepartment = txtSourceDepartment.Text, MakerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text, CreatedBy = CurrentUser.User.UserName, CreatedDate = DateTime.Now, EditedDate = DateTime.Now, EditedBy = CurrentUser.User.UserName }; if (!string.IsNullOrEmpty(hdfNationIdMany.Text)) { model.NationId = Convert.ToInt32(hdfNationIdMany.Text); } if (!DatetimeHelper.IsNull(dfDTTuNgay.SelectedDate)) { model.StartDate = dfDTTuNgay.SelectedDate; } if (!DatetimeHelper.IsNull(dfDTDenNgay.SelectedDate)) { model.EndDate = dfDTDenNgay.SelectedDate; } //create TrainingHistoryController.Create(model); } wdTraining.Hide(); gpTrainingHistory.Reload(); } catch (Exception ex) { Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void storeOutFrameSalary_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { var fromDate = ConvertUtils.GetStartDayOfMonth(); var toDate = fromDate.AddMonths(3).AddDays(-1); if (!DatetimeHelper.IsNull(dateFieldFromDate.SelectedDate) && !DatetimeHelper.IsNull(dateFieldToDate.SelectedDate)) { fromDate = dateFieldFromDate.SelectedDate; toDate = dateFieldToDate.SelectedDate; } storeOutFrameSalary.DataSource = SalaryDecisionController.GetOverGrade(fromDate, toDate); storeOutFrameSalary.DataBind(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void storeNextRaise_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { var fromDate = ConvertUtils.GetStartDayOfMonth(); var toDate = fromDate.AddMonths(3).AddDays(-1); if (!DatetimeHelper.IsNull(dfFromDate.SelectedDate) && !DatetimeHelper.IsNull(dfToDate.SelectedDate)) { fromDate = dfFromDate.SelectedDate; toDate = dfToDate.SelectedDate; } storeNextRaise.DataSource = SalaryDecisionController.GetNextRaise(fromDate, toDate); storeNextRaise.DataBind(); }
/// <summary> /// /// </summary> private void Update() { try { if (!int.TryParse(hdfRecordId.Text, out var id)) { return; } var model = TrainingHistoryController.GetById(id); if (model != null) { model.TrainingName = txtDaoTao.Text.Trim(); model.Reason = txtLyDoDaoTao.Text.Trim(); model.TrainingPlace = txtNoiDaoTao.Text.Trim(); model.Note = txt_GhiChu.Text.Trim(); if (!string.IsNullOrEmpty(hdfNationId.Text)) { model.NationId = Convert.ToInt32(hdfNationId.Text); } if (!DatetimeHelper.IsNull(dfTuNgay.SelectedDate)) { model.StartDate = dfTuNgay.SelectedDate; } if (!DatetimeHelper.IsNull(dfDenNgay.SelectedDate)) { model.EndDate = dfDenNgay.SelectedDate; } model.SponsorDepartment = txtUpdateSponsorDepartment.Text; model.DecisionMaker = txtUpdateDecisionMaker.Text; model.SourceDepartment = txtUpdateSourceDepartment.Text; model.MakerPosition = hdfIsUpdateMakerPosition.Text == @"0" ? cbxUpdateMakerPosition.Text : cbxUpdateMakerPosition.SelectedItem.Text; model.EditedDate = DateTime.Now; model.EditedBy = CurrentUser.User.UserName; //update TrainingHistoryController.Update(model); } wdDaoTao.Hide(); gpTrainingHistory.Reload(); } catch (Exception e) { Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdateHL_Click(object sender, DirectEventArgs e) { try { var salaryController = new SalaryDecisionController(); // upload file string path = string.Empty; if (cpfAttachHL.Visible && uploadAttachFileHL.HasFile) { path = UploadFile(uploadAttachFileHL, Constant.PathDecisionSalary); } var rs = JSON.Deserialize <List <SalaryDecisionModel> >(e.ExtraParams["json"]); foreach (var created in rs) { var hsl = new sal_SalaryDecision(); // decision information if (txtDecisionNumberHL.Visible) { hsl.DecisionNumber = txtDecisionNumberHL.Text.Trim(); } if (txtDecisionNameHL.Visible) { hsl.Name = txtDecisionNameHL.Text.Trim(); } if (DecisionDateHL.Visible && !DatetimeHelper.IsNull(DecisionDateHL.SelectedDate)) { hsl.DecisionDate = DecisionDateHL.SelectedDate; } if (EffectiveDateHL.Visible && !DatetimeHelper.IsNull(EffectiveDateHL.SelectedDate)) { hsl.EffectiveDate = EffectiveDateHL.SelectedDate; } if (txtDecisionMakerHL.Visible && !string.IsNullOrEmpty(txtDecisionMakerHL.Text)) { hsl.SignerName = txtDecisionMakerHL.Text; } var makerPosition = hdfIsMakerPositionHL.Text == @"0" ? cbxMakerPositionHL.Text : cbxMakerPositionHL.SelectedItem.Text; //hsl.SignerPosition = makerPosition; hsl.AttachFileName = path != "" ? path : hdfAttachFileHL.Text; hsl.Note = txtNoteHL.Text; // salary information hsl.RecordId = created.RecordId; hsl.QuantumId = created.QuantumId; //hsl.SalaryFactor = created.SalaryFactor; //hsl.SalaryBasic = created.SalaryBasic; //hsl.SalaryContract = created.SalaryContract; //hsl.SalaryInsurance = created.SalaryInsurance; //hsl.OutFrame = created.OutFrame; hsl.CreatedBy = CurrentUser.User.UserName; hsl.CreatedDate = DateTime.Now; SalaryDecisionController.Create(new SalaryDecisionModel(hsl)); } if (e.ExtraParams["close"] == "True") { wdCreateDecisionSalaryHL.Hide(); } gridDecisionSalaryEnterprise.Reload(); } catch (Exception ex) { Dialog.ShowError(ex.Message); } }
/// <summary> /// ############################################# /// Create salary decision for employee /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, DirectEventArgs e) { try { var hsl = new sal_SalaryDecision(); // upload file var path = string.Empty; if (uploadAttachFile.HasFile) { path = UploadFile(uploadAttachFile, Constant.PathDecisionSalary); } // decide information if (!string.IsNullOrEmpty(hdfChooseEmployee.Text)) { hsl.RecordId = Convert.ToInt32(hdfChooseEmployee.Text); } if (txtDecisionNumberNew.Visible) { hsl.DecisionNumber = txtDecisionNumberNew.Text; } if (!DatetimeHelper.IsNull(DecisionDateNew.SelectedDate)) { hsl.DecisionDate = DecisionDateNew.SelectedDate; } if (txtDecisionNameNew.Visible) { hsl.Name = txtDecisionNameNew.Text; } if (!DatetimeHelper.IsNull(EffectiveDateNew.SelectedDate)) { hsl.EffectiveDate = EffectiveDateNew.SelectedDate; } if (txtDecisionMakerNew.Visible) { hsl.SignerName = txtDecisionMakerNew.Text; } var makerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text; //hsl.SignerPosition = makerPosition; if (cbxContractTypeNew.SelectedItem.Value != null) { hsl.ContractId = Convert.ToInt32(hdfContractTypeNew.Text); } // attach file hsl.AttachFileName = path != "" ? path : hdfAttachFile.Text; if (txtNoteNew.Visible) { hsl.Note = txtNoteNew.Text; } // salary information //if (!string.IsNullOrEmpty(txtSalaryBasicNew.Text)) // hsl.SalaryBasic = double.Parse(txtSalaryBasicNew.Text); //if (!string.IsNullOrEmpty(txtSalaryContractNew.Text)) // hsl.SalaryContract = double.Parse(txtSalaryContractNew.Text); //if (!string.IsNullOrEmpty(txtSalaryGrossNew.Text)) // hsl.SalaryGross = double.Parse(txtSalaryGrossNew.Text); //if (!string.IsNullOrEmpty(txtSalaryNetNew.Text)) // hsl.SalaryNet = double.Parse(txtSalaryNetNew.Text); //if (!string.IsNullOrEmpty(txtPercentageSalaryNew.Text)) // hsl.PercentageSalary = double.Parse(txtPercentageSalaryNew.Text); //if (!string.IsNullOrEmpty(txtSalaryInsuranceNew.Text)) // hsl.SalaryInsurance = double.Parse(txtSalaryInsuranceNew.Text); //if (!string.IsNullOrEmpty(txtSalaryFactorNew.Text)) // hsl.SalaryFactor = double.Parse(txtSalaryFactorNew.Text); hsl.CreatedBy = CurrentUser.User.UserName; hsl.CreatedDate = DateTime.Now; if (e.ExtraParams["Command"] == "Edit") { hsl.Id = int.Parse("0" + hdfRecordId.Text); SalaryDecisionController.Update(new SalaryDecisionModel(hsl)); wdCreateDecisionSalary.Hide(); } else { // add salary decision SalaryDecisionController.Create(new SalaryDecisionModel(hsl)); if (e.ExtraParams["Close"] == "True") { wdCreateDecisionSalary.Hide(); } } gridDecisionSalaryEnterprise.Reload(); } catch (Exception ex) { X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi lưu quyết định lương: " + ex.Message).Show(); } }
/// <summary> /// insert or update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InsertOrUpdate(object sender, DirectEventArgs e) { try { // init entity var model = new RequiredRecruitmentModel(); // check id if (!string.IsNullOrEmpty(hdfId.Text) && Convert.ToInt32(hdfId.Text) > 0) { var result = RequiredRecruitmentController.GetById(Convert.ToInt32(hdfId.Text));; if (result != null) { model = result; } } // set new props for entity model.Name = txtName.Text; model.Code = txtCode.Text; if (!DatetimeHelper.IsNull(dfExpiredDate.SelectedDate)) { model.ExpiredDate = dfExpiredDate.SelectedDate; } model.Weight = !string.IsNullOrEmpty(txtWeight.Text) ? Convert.ToDecimal(txtWeight.Text.Replace(",", "")) : 0; model.Height = !string.IsNullOrEmpty(txtHeight.Text) ? Convert.ToDecimal(txtHeight.Text.Replace(",", "")) : 0; model.WorkPlace = txtWorkPlace.Text; model.Description = txtDescription.Text; model.Reason = txtReason.Text; model.Requirement = txtRequirement.Text; if (!string.IsNullOrEmpty(hdfWorkingFormType.Text)) { model.WorkFormId = (WorkingFormType)Enum.Parse(typeof(WorkingFormType), hdfWorkingFormType.Text); } if (!string.IsNullOrEmpty(hdfSex.Text)) { model.Sex = (SexType)Enum.Parse(typeof(SexType), hdfSex.Text); } if (!string.IsNullOrEmpty(hdfJobTitlePosition.Text)) { model.JobTitlePositionId = Convert.ToInt32(hdfJobTitlePosition.Text); } if (!string.IsNullOrEmpty(hdfPosition.Text)) { model.PositionId = Convert.ToInt32(hdfPosition.Text); } if (!string.IsNullOrEmpty(hdfEducationId.Text)) { model.EducationId = Convert.ToInt32(hdfEducationId.Text); } if (!string.IsNullOrEmpty(txtAgeFrom.Text)) { model.AgeFrom = Convert.ToInt32(txtAgeFrom.Text); } if (!string.IsNullOrEmpty(txtAgeTo.Text)) { model.AgeTo = Convert.ToInt32(txtAgeTo.Text); } if (!string.IsNullOrEmpty(txtSalaryFrom.Text)) { model.SalaryLevelFrom = Convert.ToDecimal(txtSalaryFrom.Text); } if (!string.IsNullOrEmpty(txtSalaryTo.Text)) { model.SalaryLevelTo = Convert.ToDecimal(txtSalaryTo.Text); } model.SignerApprove = txtSignerApproved.Text; if (!string.IsNullOrEmpty(txtQuantity.Text)) { model.Quantity = Convert.ToInt32(txtQuantity.Text); } if (!string.IsNullOrEmpty(hdfExperience.Text)) { model.ExperienceId = (ExperienceType)Enum.Parse(typeof(ExperienceType), hdfExperience.Text); } // check entity id if (model.Id > 0) { model.EditedDate = DateTime.Now; model.EditedBy = CurrentUser.User.UserName; // update RequiredRecruitmentController.Update(model); } else { model.Status = RecruitmentStatus.Pending; model.CreatedBy = CurrentUser.User.UserName; model.CreatedDate = DateTime.Now; model.EditedDate = DateTime.Now; model.EditedBy = ""; // insert RequiredRecruitmentController.Create(model); } // hide window wdSetting.Hide(); //reset form ResetForm(); // reload data gpRecruitment.Reload(); } catch (Exception exception) { Dialog.ShowError(exception); } }
/// <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(); } }
/// <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; } }
/// <summary> /// insert or update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void InsertOrUpdate(object sender, DirectEventArgs e) { try { // init entity var model = new InterviewModel(); // check id if (!string.IsNullOrEmpty(hdfId.Text) && Convert.ToInt32(hdfId.Text) > 0) { var result = InterviewController.GetById(Convert.ToInt32(hdfId.Text));; if (result != null) { model = result; } } // set new props for entity model.Name = txtName.Text; if (!DatetimeHelper.IsNull(dfInterviewDate.SelectedDate)) { model.InterviewDate = dfInterviewDate.SelectedDate; } if (!string.IsNullOrEmpty(hdfRecruitment.Text)) { model.RequiredRecruitmentId = Convert.ToInt32(hdfRecruitment.Text); } var date = dfInterviewDate.SelectedDate; model.FromTime = new DateTime(date.Year, date.Month, date.Day, tfFromTime.SelectedTime.Hours, tfFromTime.SelectedTime.Minutes, 0); model.ToTime = new DateTime(date.Year, date.Month, date.Day, tfToTime.SelectedTime.Hours, tfToTime.SelectedTime.Minutes, 0); model.Interviewer = txtInterviewer.Text; var interviewId = 0; // check entity id if (model.Id > 0) { model.EditedDate = DateTime.Now; model.EditedBy = CurrentUser.User.UserName; // update var result = InterviewController.Update(model); interviewId = result.Id; } else { model.CreatedBy = CurrentUser.User.UserName; model.CreatedDate = DateTime.Now; model.EditedDate = DateTime.Now; model.EditedBy = ""; // insert var result = InterviewController.Create(model); interviewId = result.Id; } if (interviewId > 0) { if (!string.IsNullOrEmpty(hdfCandidate.Text)) { var interviewTime = new DateTime(date.Year, date.Month, date.Day, tfInterview.SelectedTime.Hours, tfInterview.SelectedTime.Minutes, 0); var candidateModel = new CandidateInterviewModel() { InterviewId = interviewId }; var candidate = CandidateController.GetById(Convert.ToInt32(hdfCandidate.Text)); if (candidate != null) { var candidateInterview = CandidateInterviewController.GetAll(null, interviewId, candidate.RecordId, false, null, null); if (candidateInterview.Count > 0) { candidateModel = candidateInterview.First(); candidateModel.TimeInterview = interviewTime; candidateModel.EditedDate = DateTime.Now; candidateModel.EditedBy = CurrentUser.User.UserName; //update CandidateInterviewController.Update(candidateModel); } else { candidateModel.TimeInterview = interviewTime; candidateModel.RecordId = candidate.RecordId; candidateModel.CreatedDate = DateTime.Now; candidateModel.CreatedBy = CurrentUser.User.UserName; candidateModel.EditedDate = DateTime.Now; candidateModel.EditedBy = CurrentUser.User.UserName; //create CandidateInterviewController.Create(candidateModel); } } } } // hide window wdSetting.Hide(); //reset form ResetForm(); // reload data gpInterview.Reload(); } catch (Exception exception) { Dialog.ShowError(exception); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCapNhatHL_Click(object sender, DirectEventArgs e) { try { var salaryController = new SalaryDecisionController(); var errorStr = string.Empty; // upload file var path = string.Empty; if (cpfAttachHL.Visible && fufTepTinDinhKemHL.HasFile) { path = UploadFile(fufTepTinDinhKemHL, Constant.PathDecisionSalary); } var rs = JSON.Deserialize <List <SalaryDecisionModel> >(e.ExtraParams["json"]); foreach (var created in rs) { var hsl = new sal_SalaryDecision(); // decision information if (txtSoQDHL.Visible) { hsl.DecisionNumber = txtSoQDHL.Text.Trim(); } if (txtTenQDHL.Visible) { hsl.Name = txtTenQDHL.Text.Trim(); } if (dfNgayQDHL.Visible && !DatetimeHelper.IsNull(dfNgayQDHL.SelectedDate)) { hsl.DecisionDate = dfNgayQDHL.SelectedDate; } if (dfNgayHieuLucHL.Visible && !DatetimeHelper.IsNull(dfNgayHieuLucHL.SelectedDate)) { hsl.EffectiveDate = dfNgayHieuLucHL.SelectedDate; } if (txtNguoiQDHL.Visible && !string.IsNullOrEmpty(txtNguoiQDHL.Text)) { hsl.SignerName = txtNguoiQDHL.Text; } var makerPosition = hdfIsMakerPositionHL.Text == @"0" ? cbxMakerPositionHL.Text : cbxMakerPositionHL.SelectedItem.Text; //hsl.SignerPosition = makerPosition; hsl.AttachFileName = path != "" ? path : hdfTepTinDinhKemHL.Text; hsl.Note = txtGhiChuHL.Text; // salary information hsl.RecordId = created.RecordId; hsl.QuantumId = created.QuantumId; //hsl.SalaryFactor = created.SalaryFactor; //hsl.SalaryBasic = created.SalaryBasic; //hsl.SalaryInsurance = created.SalaryInsurance; //hsl.OutFrame = created.OutFrame; hsl.CreatedBy = CurrentUser.User.UserName; hsl.CreatedDate = DateTime.Now; SalaryDecisionController.Create(new SalaryDecisionModel(hsl)); } if (e.ExtraParams["close"] == "True") { wdTaoQuyetDinhLuongHangLoat.Hide(); } else { RM.RegisterClientScriptBlock("resetform", "ResetWdTaoQuyetDinhLuongHangLoat(); Ext.net.DirectMethods.GenerateSoQDHL();"); } GridPanel1.Reload(); RM.RegisterClientScriptBlock("rlst", "Store1.reload();"); } catch (Exception ex) { Dialog.ShowError(ex.Message); } }
/// <summary> /// ############################################# /// Create salary decision for employee /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCapNhat_Click(object sender, DirectEventArgs e) { try { var hsl = new sal_SalaryDecision(); // upload file var path = string.Empty; if (fufTepTinDinhKem.HasFile) { path = UploadFile(fufTepTinDinhKem, Constant.PathDecisionSalary); } // decide information if (!string.IsNullOrEmpty(hdfChonCanBo.Text)) { hsl.RecordId = Convert.ToInt32(hdfChonCanBo.Text); } if (txtSoQDMoi.Visible) { hsl.DecisionNumber = txtSoQDMoi.Text; } if (!DatetimeHelper.IsNull(dfNgayQDMoi.SelectedDate)) { hsl.DecisionDate = dfNgayQDMoi.SelectedDate; } if (txtTenQDMoi.Visible) { hsl.Name = txtTenQDMoi.Text; } if (!DatetimeHelper.IsNull(dfNgayHieuLucMoi.SelectedDate)) { hsl.EffectiveDate = dfNgayHieuLucMoi.SelectedDate; } if (txtNguoiQD.Visible) { hsl.SignerName = txtNguoiQD.Text; } var makerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text; //hsl.SignerPosition = makerPosition; if (cbHopDongLoaiHopDongMoi.SelectedItem.Value != null) { hsl.ContractId = Convert.ToInt32(hdfLoaiHopDong.Text); } // attach file hsl.AttachFileName = path != "" ? path : hdfTepTinDinhKem.Text; if (txtGhiChuMoi.Visible) { hsl.Note = txtGhiChuMoi.Text; } // salary information //if(cbx_ngachMoi.Visible) // hsl.QuantumId = Convert.ToInt32(hdfQuantumId.Text); // hsl.SalaryFactor = double.Parse(txtHeSoLuongMoi.Text.Replace('.', ',')); //if(txtMucLuongMoi.Visible && !string.IsNullOrEmpty(txtMucLuongMoi.Text)) // hsl.SalaryBasic = double.Parse(txtMucLuongMoi.Text.Replace('.', ',')); //if(txtLuongDongBHMoi.Visible && !string.IsNullOrEmpty(txtLuongDongBHMoi.Text)) // hsl.SalaryInsurance = double.Parse(txtLuongDongBHMoi.Text.Replace('.', ',')); //if(txtBacLuongNBMoi.Visible) // hsl.SalaryGradeLift = txtBacLuongNBMoi.Text; //if(dfNgayHLNBMoi.Visible && !util.IsDateNull(dfNgayHLNBMoi.SelectedDate)) // hsl.SalaryGradeDate = dfNgayHLNBMoi.SelectedDate; //if(txtVuotKhungMoi.Visible && !string.IsNullOrEmpty(txtVuotKhungMoi.Text)) // hsl.OutFrame = double.Parse("0" + txtVuotKhungMoi.Text); //if(txtThamnien.Visible && !string.IsNullOrEmpty(txtThamnien.Text)) // hsl.Seniority = double.Parse("0" + txtThamnien.Text); //if(chkNangNgach.Checked == true) // hsl.IsLiftQuantum = true; hsl.CreatedBy = CurrentUser.User.UserName; hsl.CreatedDate = DateTime.Now; if (e.ExtraParams["Command"] == "Edit") { hsl.Id = int.Parse("0" + hdfRecordId.Text); SalaryDecisionController.Update(new SalaryDecisionModel(hsl)); wdTaoQuyetDinhLuong.Hide(); } else { // add salary decision SalaryDecisionController.Create(new SalaryDecisionModel(hsl)); if (e.ExtraParams["Close"] == "True") { wdTaoQuyetDinhLuong.Hide(); } else { RM.RegisterClientScriptBlock("resetform1", "ResetWdTaoQuyetDinhLuong(); Ext.net.DirectMethods.GenerateSoQD();"); } } RM.RegisterClientScriptBlock("rlgr", "Store1.reload();"); } catch (Exception ex) { X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi lưu quyết định lương: " + ex.Message).Show(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveEmployee_Click(object sender, DirectEventArgs e) { var record = new RecordModel(); var candidate = new CandidateModel(); if (!string.IsNullOrEmpty(hdfRecordId.Text)) { record.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ã nhân viên đã tồn tại. Vui lòng nhập mã khác."); txtEmployeeCode.Text = GenerateEmployeeCode(); return; } } } else { record.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ã nhân viên đã tồn tại. Vui lòng nhập mã 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(hdfImagePerson.Text)) { record.ImageUrl = hdfImagePerson.Text; } record.FullName = txtFullName.Text; // lấy họ và đệm từ họ tên var position = record.FullName.LastIndexOf(' '); record.Name = position == -1 ? record.FullName : record.FullName.Substring(position + 1).Trim(); record.Alias = txtAlias.Text; if (!DatetimeHelper.IsNull(dfBirthDate.SelectedDate)) { record.BirthDate = dfBirthDate.SelectedDate; } if (!string.IsNullOrEmpty(cbxSex.SelectedItem.Value) && cbxSex.SelectedItem.Value == "M") { record.Sex = true; } else { record.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)) { record.BirthPlaceProvinceId = Convert.ToInt32(hdfBirthPlaceProvinceId.Text); } if (string.IsNullOrEmpty(cbxBirthPlaceDistrict.Text)) { hdfBirthPlaceDistrictId.Text = @"0"; } if (!string.IsNullOrEmpty(hdfBirthPlaceDistrictId.Text)) { record.BirthPlaceDistrictId = Convert.ToInt32(hdfBirthPlaceDistrictId.Text); } if (string.IsNullOrEmpty(cbxBirthPlaceWard.Text)) { hdfBirthPlaceWardId.Text = @"0"; } if (!string.IsNullOrEmpty(hdfBirthPlaceWardId.Text)) { record.BirthPlaceWardId = Convert.ToInt32(hdfBirthPlaceWardId.Text); } if (!string.IsNullOrEmpty(hdfHometownProvinceId.Text)) { record.HometownProvinceId = Convert.ToInt32(hdfHometownProvinceId.Text); } if (string.IsNullOrEmpty(cbxHometownDistrict.Text)) { hdfHometownDistrictId.Text = @"0"; } if (!string.IsNullOrEmpty(hdfHometownDistrictId.Text)) { record.HometownDistrictId = Convert.ToInt32(hdfHometownDistrictId.Text); } if (string.IsNullOrEmpty(cbxHometownWard.Text)) { hdfHometownWardId.Text = @"0"; } if (!string.IsNullOrEmpty(hdfHometownWardId.Text)) { record.HometownWardId = Convert.ToInt32(hdfHometownWardId.Text); } if (!string.IsNullOrEmpty(hdfMaritalStatusId.Text)) { record.MaritalStatusId = Convert.ToInt32(hdfMaritalStatusId.Text); } if (!string.IsNullOrEmpty(hdfFolkId.Text)) { record.FolkId = Convert.ToInt32(hdfFolkId.Text); } if (!string.IsNullOrEmpty(hdfReligionId.Text)) { record.ReligionId = Convert.ToInt32(hdfReligionId.Text); } record.ResidentPlace = txt_ResidentPlace.Text; record.Address = txt_Address.Text; record.CPVCardNumber = txtCPVCardNumber.Text; if (!string.IsNullOrEmpty(hdfJobTitleId.Text)) { record.JobTitleId = Convert.ToInt32(hdfJobTitleId.Text); } //Ngay thu viec if (!DatetimeHelper.IsNull(RecruimentDate.SelectedDate)) { record.RecruimentDate = RecruimentDate.SelectedDate; } //Ngay chinh thuc if (!DatetimeHelper.IsNull(ParticipationDate.SelectedDate)) { record.ParticipationDate = ParticipationDate.SelectedDate; } record.RecruimentDepartment = txtRecruitmentDepartment.Text; if (!string.IsNullOrEmpty(hdfBasicEducationId.Text)) { record.BasicEducationId = Convert.ToInt32(hdfBasicEducationId.Text); } if (!string.IsNullOrEmpty(hdfEducationId.Text)) { record.EducationId = Convert.ToInt32(hdfEducationId.Text); } if (!string.IsNullOrEmpty(hdfPoliticLevelId.Text)) { record.PoliticLevelId = Convert.ToInt32(hdfPoliticLevelId.Text); } if (!string.IsNullOrEmpty(hdfLanguageLevelId.Text)) { record.LanguageLevelId = Convert.ToInt32(hdfLanguageLevelId.Text); } if (!string.IsNullOrEmpty(hdfITLevelId.Text)) { record.ITLevelId = Convert.ToInt32(hdfITLevelId.Text); } if (!DatetimeHelper.IsNull(CPVJoinedDate.SelectedDate)) { record.CPVJoinedDate = CPVJoinedDate.SelectedDate; } if (!DatetimeHelper.IsNull(CPVOfficialJoinedDate.SelectedDate)) { record.CPVOfficialJoinedDate = CPVOfficialJoinedDate.SelectedDate; } record.CPVJoinedPlace = txtCPVJoinedPlace.Text; if (!string.IsNullOrEmpty(hdfCPVPositionId.Text)) { record.CPVPositionId = Convert.ToInt32(hdfCPVPositionId.Text); } if (!string.IsNullOrEmpty(hdfVYUPositionId.Text)) { record.VYUPositionId = Convert.ToInt32(hdfVYUPositionId.Text); } if (!DatetimeHelper.IsNull(ArmyJoinedDate.SelectedDate)) { record.ArmyJoinedDate = ArmyJoinedDate.SelectedDate; } if (!DatetimeHelper.IsNull(ArmyLeftDate.SelectedDate)) { record.ArmyLeftDate = ArmyLeftDate.SelectedDate; } if (!string.IsNullOrEmpty(hdfPositionId.Text)) { record.PositionId = Convert.ToInt32(hdfPositionId.Text); } if (!string.IsNullOrEmpty(hdfArmyLevelId.Text)) { record.ArmyLevelId = Convert.ToInt32(hdfArmyLevelId.Text); } if (!string.IsNullOrEmpty(hdfHealthStatusId.Text)) { record.HealthStatusId = Convert.ToInt32(hdfHealthStatusId.Text); } record.BloodGroup = cbxBloodGroup.SelectedIndex >= 0 ? cbxBloodGroup.SelectedItem.Value : ""; if (!string.IsNullOrEmpty(txtHeight.Text)) { record.Height = Convert.ToDecimal(txtHeight.Text); } if (!string.IsNullOrEmpty(txtWeight.Text)) { record.Weight = Convert.ToDecimal(txtWeight.Text); } record.DepartmentId = !string.IsNullOrEmpty(hdfDepartmentId.Text) ? Convert.ToInt32(hdfDepartmentId.Text) : CurrentUser.RootDepartment.Id; record.RankWounded = txtRankWounded.Text; if (!string.IsNullOrEmpty(hdfFamilyPolicyId.Text)) { record.FamilyPolicyId = Convert.ToInt32(hdfFamilyPolicyId.Text); } if (!string.IsNullOrEmpty(txtIDNumber.Text)) { record.IDNumber = txtIDNumber.Text; } if (!DatetimeHelper.IsNull(IDIssueDate.SelectedDate)) { record.IDIssueDate = IDIssueDate.SelectedDate; } if (!string.IsNullOrEmpty(hdfIDIssuePlaceId.Text)) { record.IDIssuePlaceId = Convert.ToInt32(hdfIDIssuePlaceId.Text); } if (!DatetimeHelper.IsNull(VYUJoinedDate.SelectedDate)) { record.VYUJoinedDate = VYUJoinedDate.SelectedDate; } record.VYUJoinedPlace = txtVYUJoinedPlace.Text; record.PersonalTaxCode = txtPersonalTaxCode.Text; var workStatus = CatalogController.GetAll("cat_WorkStatus", null, ((int)RecordStatus.Working).ToString(), null, false, null, 1); if (workStatus.Count > 0) { record.WorkStatusId = workStatus.First().Id; } record.WorkEmail = txtWorkEmail.Text; record.PersonalEmail = txtPersonalEmail.Text; record.CellPhoneNumber = txtCellPhoneNumber.Text; record.HomePhoneNumber = txtHomePhoneNumber.Text; record.WorkPhoneNumber = txtWorkPhoneNumber.Text; record.InsuranceNumber = txtInsuranceNumber.Text; record.ContactPersonName = txtContactPersonName.Text; record.ContactPhoneNumber = txtContactPhoneNumber.Text; record.ContactRelation = txtContactRelation.Text; record.ContactAddress = txtContactAddress.Text; if (!string.IsNullOrEmpty(hdfInputIndustryId.Text)) { record.IndustryId = Convert.ToInt32(hdfInputIndustryId.Text); } if (!DatetimeHelper.IsNull(InsuranceIssueDate.SelectedDate)) { record.InsuranceIssueDate = InsuranceIssueDate.SelectedDate; } //other info if (!string.IsNullOrEmpty(hdfConstructionId.Text)) { record.ConstructionId = Convert.ToInt32(hdfConstructionId.Text); } if (!string.IsNullOrEmpty(hdfTeamId.Text)) { record.TeamId = Convert.ToInt32(hdfTeamId.Text); } if (!string.IsNullOrEmpty(txtStudyWorkingDay.Text)) { record.StudyWorkingDay = Convert.ToInt32(txtStudyWorkingDay.Text); } //Thoi gian thu viec if (!string.IsNullOrEmpty(txtProbationWorkingTime.Text)) { record.ProbationWorkingTime = Convert.ToInt32(txtProbationWorkingTime.Text); } if (!string.IsNullOrEmpty(hdfWorkingFormId.Text)) { record.WorkingFormId = (WorkingFormType)Enum.Parse(typeof(WorkingFormType), hdfWorkingFormId.Text); } if (!string.IsNullOrEmpty(hdfWorkLocationId.Text)) { record.WorkLocationId = Convert.ToInt32(hdfWorkLocationId.Text); } if (!string.IsNullOrEmpty(txtGraduationYear.Text)) { record.GraduationYear = Convert.ToInt32(txtGraduationYear.Text); } if (!string.IsNullOrEmpty(hdfGraduationTypeId.Text)) { record.GraduationTypeId = Convert.ToInt32(hdfGraduationTypeId.Text); } if (!string.IsNullOrEmpty(hdfUniversityId.Text)) { record.UniversityId = Convert.ToInt32(hdfUniversityId.Text); } if (!DatetimeHelper.IsNull(dfUnionJoinedDate.SelectedDate)) { record.UnionJoinedDate = dfUnionJoinedDate.SelectedDate; } if (!string.IsNullOrEmpty(hdfUnionPosition.Text)) { record.UnionJoinedPositionId = Convert.ToInt32(hdfUnionPosition.Text); } //BHYT record.HealthInsuranceNumber = txtHealthInsuranceNumber.Text; if (!DatetimeHelper.IsNull(dfHealthJoinedDate.SelectedDate)) { record.HealthJoinedDate = dfHealthJoinedDate.SelectedDate; } if (!DatetimeHelper.IsNull(dfHealthExpiredDate.SelectedDate)) { record.HealthExpiredDate = dfHealthExpiredDate.SelectedDate; } // Tuyển dụng if (!string.IsNullOrEmpty(txtCandidateCode.Text)) { candidate.Code = txtCandidateCode.Text; } if (!string.IsNullOrEmpty(txtDesiredSalary.Text)) { candidate.DesiredSalary = Convert.ToDecimal(txtDesiredSalary.Text); } if (!string.IsNullOrEmpty(hdfRequiredRecruitmentId.Text)) { candidate.RequiredRecruitmentId = Convert.ToInt32(hdfRequiredRecruitmentId.Text); } if (!DatetimeHelper.IsNull(dfApplyDate.SelectedDate)) { candidate.ApplyDate = dfApplyDate.SelectedDate; } if (!string.IsNullOrEmpty(hdfCandidateStatus.Text)) { candidate.Status = (CandidateType)Enum.Parse(typeof(CandidateType), hdfCandidateStatus.Text); } // Kiểm tra tuyển dụng if (int.TryParse(hdfType.Text, out var type) && type == 1) { record.Type = RecordType.Candidate; } var recordId = 0; var limitCount = SystemConfigController.GetLimitPackage(); if (Request.QueryString["Event"] == "Edit" || !string.IsNullOrEmpty(hdfRecordId.Text)) { //Update Ho so record.Id = Convert.ToInt32(hdfRecordId.Text); RecordController.Update(record); recordId = record.Id; // lấy record id thông tin ứng viên candidate.RecordId = Convert.ToInt32(hdfRecordId.Text); Dialog.ShowNotification("Cập nhật dữ liệu thành công!"); } else { var recordCount = RecordController.GetCountRecords((int)RecordType.Default); //check over limit package if (recordCount > limitCount) { Dialog.Alert("Gói phần mềm bạn đăng ký đã vượt quá giới hạn. Vui lòng đăng ký thêm để sử dụng."); return; } //create var newRecord = RecordController.Create(record); recordId = newRecord.Id; // lấy record id thông tin ứng viên candidate.RecordId = newRecord.Id; Dialog.ShowNotification("Thêm mới thành công!"); } // tuyển dụng if (type == 1) { if (int.TryParse(hdfCandidateId.Text, out var result) && result > 0) { candidate.Id = result; //update CandidateController.Update(candidate); } else { //count candidate exist var recordCount = RecordController.GetCountRecords((int)RecordType.Candidate); //check over limit package if (recordCount > limitCount) { Dialog.Alert("Gói phần mềm bạn đăng ký đã vượt quá giới hạn. Vui lòng đăng ký thêm để sử dụng."); return; } //create CandidateController.Create(candidate); } } // Save family SaveGridFamilyRelationship(e.ExtraParams["jsonFamilyRelationship"], recordId); if (e.ExtraParams["Reset"] == "True") { hdfRecordId.Text = ""; GridPanelFamilyRelationship.Reload(); } //set tabindex default tab_Employee.SetActiveTab(panelEmployee); //reset hdfImagePerson.Reset(); fufUploadControl.Reset(); img_anhdaidien.ImageUrl = ""; //close window wdInput.Hide(); UserControlClose(); }
/// <summary> /// /// </summary> /// <param name="e"></param> private void Create(DirectEventArgs e) { try { var path = string.Empty; if (fufTepTinHangLoat.HasFile) { path = UploadFile(fufTepTinHangLoat, hdfTypePage.Text.Equals("KhenThuong") ? Constant.PathReward : Constant.PathDiscipline); } foreach (var itemRow in chkEmployeeRowSelection.SelectedRows) { if (hdfTypePage.Text.Equals("KhenThuong")) { string reasonReward; if (hdfIsDanhMuc2.Text == @"0") { var reason = new cat_ReasonReward { Name = cbbLyDoHangLoat.Text }; cat_ReasonRewardServices.Create(reason); reasonReward = cbbLyDoHangLoat.Text; } else { reasonReward = cbbLyDoHangLoat.SelectedItem.Text; } if (string.IsNullOrEmpty(reasonReward)) { Dialog.Alert("Thông báo", "Không tìm thấy lý do khen thưởng. Vui lòng thử lại!"); return; } if (txtSoQuyetDinhHangLoat.Text == "") { GenerateRewardDecisionNumber(); } var record = new RewardModel { RecordId = Convert.ToInt32(itemRow.RecordID), DecisionNumber = txtSoQuyetDinhHangLoat.Text.Trim(), DecisionMaker = tgfNguoiQuyetDinhHangLoat.Text.Trim(), FormRewardId = int.Parse(hdfHinhThucHangLoat.Text), LevelRewardId = int.Parse(hdfLevelManyId.Text), Reason = reasonReward, SourceDepartment = txtSourceDepartment.Text, Note = txtGhuChuHangLoat.Text.Trim() }; var makerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text; record.MakerPosition = makerPosition; if (!string.IsNullOrEmpty(txtMoneyAmount.Text)) { record.MoneyAmount = decimal.Parse("0" + txtMoneyAmount.Text); } record.CreatedDate = DateTime.Now; record.CreatedBy = CurrentUser.User.UserName; record.EditedDate = DateTime.Now; record.EditedBy = CurrentUser.User.UserName; if (!DatetimeHelper.IsNull(dfNgayQuyetDinhHangLoat.SelectedDate)) { record.DecisionDate = dfNgayQuyetDinhHangLoat.SelectedDate; } if (!DatetimeHelper.IsNull(dfNgayHieuLuc.SelectedDate)) { record.EffectiveDate = dfNgayHieuLuc.SelectedDate; } record.AttachFileName = path != "" ? path : hdfTepDinhKemHangLoat.Text; RewardController.Create(record); } else { string reasonDiscipline; if (hdfIsDanhMuc2.Text == @"0") { var reason = new cat_ReasonDiscipline() { Name = cbbLyDoHangLoat.Text }; cat_ReasonDisciplineServices.Create(reason); reasonDiscipline = cbbLyDoHangLoat.Text; } else { reasonDiscipline = cbbLyDoHangLoat.SelectedItem.Text; } if (string.IsNullOrEmpty(reasonDiscipline)) { Dialog.Alert("Thông báo", "Không tìm thấy lý do khen thưởng. Vui lòng thử lại!"); return; } if (txtSoQuyetDinhHangLoat.Text == "") { GenerateRewardDecisionNumber(); } var record = new DisciplineModel { RecordId = Convert.ToInt32(itemRow.RecordID), DecisionNumber = txtSoQuyetDinhHangLoat.Text.Trim(), DecisionMaker = tgfNguoiQuyetDinhHangLoat.Text.Trim(), FormDisciplineId = int.Parse(hdfHinhThucHangLoat.Text), LevelDisciplineId = int.Parse(hdfLevelManyId.Text), Reason = reasonDiscipline, SourceDepartment = txtSourceDepartment.Text, Note = txtGhuChuHangLoat.Text.Trim() }; var makerPosition = hdfIsMakerPosition.Text == @"0" ? cbxMakerPosition.Text : cbxMakerPosition.SelectedItem.Text; record.MakerPosition = makerPosition; record.CreatedDate = DateTime.Now; record.CreatedBy = CurrentUser.User.UserName; record.EditedDate = DateTime.Now; record.EditedBy = CurrentUser.User.UserName; if (!DatetimeHelper.IsNull(dfNgayQuyetDinhHangLoat.SelectedDate)) { record.DecisionDate = dfNgayQuyetDinhHangLoat.SelectedDate; } if (!DatetimeHelper.IsNull(dfExpireDate.SelectedDate)) { record.ExpireDate = dfExpireDate.SelectedDate; } record.AttachFileName = path != "" ? path : hdfTepDinhKemHangLoat.Text; DisciplineController.Create(record); } } grp_KhenThuongKyLuat.Reload(); ResetForm(); wdKhenThuongKyLuatHangLoat.Hide(); } catch (Exception ex) { Dialog.Alert("Có lỗi xảy ra trong quá trình tạo quyết định: {0}".FormatWith(ex.Message)); } }