/// <summary> /// /// </summary> /// <param name="salaryDecision"></param> private void EditData(sal_SalaryDecision salaryDecision) { var util = new Util(); salaryDecision.DecisionNumber = txtDecisionNumber.Text; salaryDecision.Name = txtDecisionName.Text; if (!util.IsDateNull(dfDecisionDate.SelectedDate)) { salaryDecision.DecisionDate = dfDecisionDate.SelectedDate; } if (!util.IsDateNull(dfEffectiveDate.SelectedDate)) { salaryDecision.EffectiveDate = dfEffectiveDate.SelectedDate; } //if (!util.IsDateNull(dfSalaryRaiseNextDate.SelectedDate)) // salaryDecision.SalaryRaiseNextDate = dfSalaryRaiseNextDate.SelectedDate; //if (!util.IsDateNull(dfProRaiseSalaryDisDate.SelectedDate)) // salaryDecision.ProlongRaiseSalaryDisciplineDate = dfProRaiseSalaryDisDate.SelectedDate; salaryDecision.QuantumId = !string.IsNullOrEmpty(hdfQuantumHLId.Text) ? Convert.ToInt32(hdfQuantumHLId.Text) : 0; salaryDecision.SignerPosition = cbxMakerPositionHL.SelectedItem.Text; salaryDecision.SignerName = txtDecisionMaker.Text; salaryDecision.Note = txtNote.Text; //salaryDecision.SalaryFactor = // !string.IsNullOrEmpty(txtSalaryFactor.Text) ? Convert.ToDouble(txtSalaryFactor.Text.Replace(".", ",")) : 0; //salaryDecision.OutFrame = !string.IsNullOrEmpty(txtOutFrame.Text) ? Convert.ToDouble(txtOutFrame.Text) : 0; //salaryDecision.SalaryInsurance = !string.IsNullOrEmpty(txtSalaryInsurance.Text) ? Convert.ToDouble(txtSalaryInsurance.Text) : 0; //salaryDecision.SalaryGradeLift = txtSalaryLiftGrade.Text; //salaryDecision.SalaryBasic = !string.IsNullOrEmpty(txtSalaryLevel.Text) ? Convert.ToDouble(txtSalaryLevel.Text) : 0; //salaryDecision.Reason = txtReason.Text; }
/// <summary> /// save DB /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, DirectEventArgs e) { if (!string.IsNullOrEmpty(hdfRecordIds.Text)) { // upload file var path = string.Empty; if (cpfAttachHL.Visible && fufAttachFile.HasFile) { path = UploadFile(fufAttachFile, Constant.PathDecisionSalary); } var recordIds = string.IsNullOrEmpty(hdfRecordIds.Text) ? new string[] { } : hdfRecordIds.Text.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in recordIds) { var salary = new sal_SalaryDecision() { RecordId = Convert.ToInt32(item), Type = !string.IsNullOrEmpty(hdfSalaryRaiseType.Text) ? (SalaryDecisionType)Enum.Parse(typeof(SalaryDecisionType), hdfSalaryRaiseType.Text) : (int)SalaryDecisionType.Regular, DecisionStatus = SalaryDecisionStatus.Approved, AttachFileName = path, CreatedBy = CurrentUser.User.UserName, CreatedDate = DateTime.Now }; //Edit data salary EditData(salary); //create sal_SalaryDecisionServices.Create(salary); } } wdDecision.Hide(); gridListEmployee.Reload(); RM.RegisterClientScriptBlock("Grid_Reload", "ReloadGrid();"); }
public SalaryAllowanceModel() { // init entity _salaryDecision = new sal_SalaryDecision(); _basicSalary = new cat_BasicSalary(); _allowance = new cat_Allowance(); // set default props for model Init(new sal_SalaryAllowance()); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public static SalaryDecisionModel Update(SalaryDecisionModel model) { // init entity var entity = new sal_SalaryDecision(); // set entity props model.FillEntity(ref entity); // update return(new SalaryDecisionModel(sal_SalaryDecisionServices.Update(entity))); }
public SalaryAllowanceModel(sal_SalaryAllowance entity) { // init entity entity = entity ?? new sal_SalaryAllowance(); _salaryDecision = sal_SalaryDecisionServices.GetById(entity.SalaryDecisionId) ?? new sal_SalaryDecision(); _basicSalary = cat_BasicSalaryServices.GetCurrent() ?? new cat_BasicSalary(); _allowance = cat_AllowanceServices.GetByCode(entity.AllowanceCode) ?? new cat_Allowance(); // set custom props AllowanceName = _allowance.Name; // set model props Init(entity); }
/// <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(); } }
protected void btnCapNhatHL_Click(object sender, DirectEventArgs e) { try { Util util = new Util(); var salaryController = new SalaryDecisionController(); string errorStr = string.Empty; // upload file string 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 && !util.IsDateNull(dfNgayQDHL.SelectedDate)) { hsl.DecisionDate = dfNgayQDHL.SelectedDate; } if (dfNgayHieuLucHL.Visible && !util.IsDateNull(dfNgayHieuLucHL.SelectedDate)) { hsl.EffectiveDate = dfNgayHieuLucHL.SelectedDate; } if (txtNguoiQDHL.Visible && !string.IsNullOrEmpty(txtNguoiQDHL.Text)) { hsl.SignerName = txtNguoiQDHL.Text; } var makerPosition = string.Empty; if (hdfIsMakerPositionHL.Text == @"0") { makerPosition = cbxMakerPositionHL.Text; } else { makerPosition = cbxMakerPositionHL.SelectedItem.Text; } hsl.SignerPosition = makerPosition; if (path != "") { hsl.AttachFileName = path; } else { hsl.AttachFileName = hdfTepTinDinhKemHL.Text; } hsl.Note = txtGhiChuHL.Text; // salary information hsl.RecordId = created.RecordId; hsl.QuantumId = created.QuantumId; hsl.SalaryGrade = created.SalaryGrade; 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; salaryController.Insert(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 controller = new SalaryDecisionController(); var hsl = new sal_SalaryDecision(); var util = new Util(); // upload file string 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 (!util.IsDateNull(dfNgayQDMoi.SelectedDate)) { hsl.DecisionDate = dfNgayQDMoi.SelectedDate; } if (txtTenQDMoi.Visible) { hsl.Name = txtTenQDMoi.Text; } if (!util.IsDateNull(dfNgayHieuLucMoi.SelectedDate)) { hsl.EffectiveDate = dfNgayHieuLucMoi.SelectedDate; } if (txtNguoiQD.Visible) { hsl.SignerName = txtNguoiQD.Text; } var makerPosition = string.Empty; if (hdfIsMakerPosition.Text == @"0") { makerPosition = cbxMakerPosition.Text; } else { makerPosition = cbxMakerPosition.SelectedItem.Text; } hsl.SignerPosition = makerPosition; if (cbHopDongLoaiHopDongMoi.SelectedItem.Value != null) { hsl.ContractId = Convert.ToInt32(hdfLoaiHopDong.Text); } // attach file if (path != "") { hsl.AttachFileName = path; } else { hsl.AttachFileName = hdfTepTinDinhKem.Text; } if (txtGhiChuMoi.Visible) { hsl.Note = txtGhiChuMoi.Text; } // salary information if (cbx_ngachMoi.Visible) { hsl.QuantumId = Convert.ToInt32(hdfQuantumId.Text); } if (cbxBacMoi.Visible) { hsl.SalaryGrade = hdfSalaryGrade.Text; } if (txtHeSoLuongMoi.Visible && !string.IsNullOrEmpty(txtHeSoLuongMoi.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; } if (dfSalaryRaiseNextDate.Visible && !util.IsDateNull(dfSalaryRaiseNextDate.SelectedDate)) { hsl.SalaryRaiseNextDate = dfSalaryRaiseNextDate.SelectedDate; } hsl.CreatedBy = CurrentUser.User.UserName; hsl.CreatedDate = DateTime.Now; if (e.ExtraParams["Command"] == "Edit") { hsl.Id = int.Parse("0" + hdfRecordId.Text); controller.Update(hsl); wdTaoQuyetDinhLuong.Hide(); } else { // add salary decision controller.Insert(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(); } }