示例#1
0
        /// <summary>
        /// Sửa thông tin quyết định lương
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var hsLuong = SalaryDecisionController.GetById(Convert.ToInt32(hdfRecordId.Text));
                if (hsLuong == null)
                {
                    X.Msg.Alert("Thông báo từ hệ thống", "Không tìm thấy quyết định lương").Show();
                    return;
                }

                // load general information for employee
                var hs = RecordController.GetById(hsLuong.RecordId);
                if (hs != null)
                {
                    hdfChonCanBo.Text  = hs.Id.ToString();
                    cbxChonCanBo.Text  = hs.FullName;
                    txtDepartment.Text = hs.DepartmentName;
                    txtChucVu.Text     = hs.PositionName;
                    txtCongViec.Text   = hs.JobTitleName;
                }

                // load newest salary decision information
                var hsl = SalaryDecisionController.GetByIdConditionRecord(hsLuong.RecordId);
                if (hsl != null)
                {
                    if (txtSoQDCu.Visible == true && !string.IsNullOrEmpty(hsl.DecisionNumber))
                    {
                        txtSoQDCu.Text = hsl.DecisionNumber;
                    }
                    if (txtTenQDCu.Visible == true && !string.IsNullOrEmpty(hsl.DecisionName))
                    {
                        txtTenQDCu.Text = hsl.DecisionName;
                    }
                    if (dfNgayQDCu.Visible == true)
                    {
                        dfNgayQDCu.SetValue(hsl.DecisionDate);
                    }
                    if (txtNguoiQDCu.Visible == true && hsl.DecisionMaker != null)
                    {
                        txtNguoiQDCu.Text = hsl.DecisionMaker;
                    }
                    if (dfNgayCoHieuLucCu.Visible == true)
                    {
                        dfNgayCoHieuLucCu.SetValue(hsl.EffectiveDate);
                    }
                    if (cbxNgachCu.Visible == true)
                    {
                        if (string.IsNullOrEmpty(hsl.QuantumCode))
                        {
                            cbxNgachCu.SetValue("");
                        }
                        else
                        {
                            cbxNgachCu.SetValue(hsl.QuantumName);
                        }
                    }

                    if (txtBacLuongCu.Visible == true && !string.IsNullOrEmpty(hsl.SalaryGrade))
                    {
                        txtBacLuongCu.Text = hsl.SalaryGrade;
                    }
                    if (txtHeSoLuongCu.Visible == true && hsl.SalaryFactor != null)
                    {
                        txtHeSoLuongCu.SetValue(hsl.SalaryFactor);
                    }
                    if (txtMucLuongCu.Visible == true && hsl.SalaryBasic != null)
                    {
                        txtMucLuongCu.SetValue(hsl.SalaryBasic);
                    }
                    if (txtLuongDongBHCu.Visible == true && hsl.SalaryInsurance != null)
                    {
                        txtLuongDongBHCu.SetValue(hsl.SalaryInsurance);
                    }
                    if (txtPhuCapKhacCu.Visible == true && hsl.OtherAllowance != null)
                    {
                        txtPhuCapKhacCu.SetValue(hsl.OtherAllowance);
                    }
                    if (txtPCTrachNhiemCu.Visible == true && hsl.ResponsibilityAllowance != null)
                    {
                        txtPCTrachNhiemCu.SetValue(hsl.ResponsibilityAllowance);
                    }
                    if (txtPCKhuVucCu.Visible == true && hsl.AreaAllowance != null)
                    {
                        txtPCKhuVucCu.SetValue(hsl.AreaAllowance);
                    }
                    if (txtVuotKhungCu.Visible == true && hsl.OutFrame != null)
                    {
                        txtVuotKhungCu.SetValue(hsl.OutFrame);
                    }
                    var strContractTypeOldId =
                        hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                    if (!string.IsNullOrEmpty(strContractTypeOldId))
                    {
                        var contractTypeOldName =
                            cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeOldId), "Name");
                        cbHopDongLoaiHopDongCu.Text = "" + contractTypeOldName;
                    }
                }

                // load current decision information
                if (txtSoQDMoi.Visible == true)
                {
                    txtSoQDMoi.Text = hsLuong.DecisionNumber;
                }
                if (dfNgayQDMoi.Visible == true)
                {
                    dfNgayQDMoi.SetValue(hsLuong.DecisionDate);
                }
                if (txtTenQDMoi.Visible == true)
                {
                    txtTenQDMoi.Text = hsLuong.DecisionName;
                }
                if (dfNgayHieuLucMoi.Visible == true)
                {
                    dfNgayHieuLucMoi.SetValue(hsLuong.EffectiveDate);
                }
                if (txtNguoiQD.Visible == true)
                {
                    txtNguoiQD.Text = hsLuong.DecisionMaker;
                }
                if (dfSalaryRaiseNextDate.Visible == true)
                {
                    dfSalaryRaiseNextDate.SetValue(hsl.SalaryRaiseNextDate);
                }
                cbxMakerPosition.Text = hsLuong.MakerPosition;
                var strContractTypeId = hr_ContractServices.GetFieldValueById(hsLuong.ContractId, "ContractTypeId");
                if (!string.IsNullOrEmpty(strContractTypeId))
                {
                    var contractTypeName =
                        cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId), "Name");
                    cbHopDongLoaiHopDongMoi.Text = "" + contractTypeName;
                    hdfLoaiHopDong.SetValue(strContractTypeId);
                }

                // them ten nguoi qd
                if (composifieldAttach.Visible == true)
                {
                    hdfTepTinDinhKem.Text = hsLuong.AttachFileName;
                    if (!string.IsNullOrEmpty(hsLuong.AttachFileName))
                    {
                        hdfTepTinDinhKem.Text = hsLuong.AttachFileName;
                        fufTepTinDinhKem.Text = GetFileName(hsLuong.AttachFileName);
                    }
                }

                if (txtGhiChuMoi.Visible == true)
                {
                    txtGhiChuMoi.Text = hsLuong.Note;
                }
                // load current salary information
                if (cbx_ngachMoi.Visible == true)
                {
                    if (string.IsNullOrEmpty(hsl.QuantumCode))
                    {
                        hdfQuantumId.SetValue("");
                        cbx_ngachMoi.SetValue("");
                    }
                    else
                    {
                        hdfQuantumId.SetValue(hsl.QuantumId);
                        cbx_ngachMoi.SetValue(hsl.QuantumName);
                    }
                }

                if (cbxBacMoi.Visible == true)
                {
                    hdfSalaryGrade.SetValue(hsLuong.SalaryGrade);
                    cbxBacMoi.SetValue("Bậc " + hsLuong.SalaryGrade);
                }

                if (txtHeSoLuongMoi.Visible == true)
                {
                    txtHeSoLuongMoi.SetValue(hsLuong.SalaryFactor);
                }
                if (txtMucLuongMoi.Visible == true)
                {
                    txtMucLuongMoi.SetValue(hsLuong.SalaryBasic);
                }
                if (txtLuongDongBHMoi.Visible == true)
                {
                    txtLuongDongBHMoi.SetValue(hsLuong.SalaryInsurance);
                }
                if (txtBacLuongNBMoi.Visible == true)
                {
                    txtBacLuongNBMoi.Text = hsLuong.SalaryGradeLift;
                }
                if (dfNgayHLNBMoi.Visible == true && !Util.GetInstance().IsDateNull(hsLuong.SalaryGradeDate))
                {
                    dfNgayHLNBMoi.SetValue(hsLuong.SalaryGradeDate);
                }
                if (txtPhuCapKhacMoi.Visible == true)
                {
                    txtPhuCapKhacMoi.SetValue(hsLuong.OtherAllowance);
                }
                if (txtPhuCapChucVuMoi.Visible == true)
                {
                    txtPhuCapChucVuMoi.SetValue(hsLuong.PositionAllowance);
                }
                if (txtVuotKhungMoi.Visible == true)
                {
                    txtVuotKhungMoi.SetValue(hsLuong.OutFrame);
                }
                txtThamnien.SetValue(hsLuong.Seniority);
                if (txtPhuCapTrachNhiemMoi.Visible == true)
                {
                    txtPhuCapTrachNhiemMoi.SetValue(hsLuong.ResponsibilityAllowance);
                }
                if (txtPhuCapKhuVucMoi.Visible == true)
                {
                    txtPhuCapKhuVucMoi.SetValue(hsLuong.AreaAllowance);
                }
                txtPCNganh.SetValue(hsLuong.BranchAllowance);

                // update form information
                wdTaoQuyetDinhLuong.Title = "Cập nhật thông tin quyết định lương";
                wdTaoQuyetDinhLuong.Icon  = Icon.Pencil;
                btnCapNhat.Hide();
                btnCapNhatSua.Show();
                btnCapNhatDongLai.Hide();
                wdTaoQuyetDinhLuong.Show();
            }
            catch (Exception ex)
            {
                X.MessageBox.Alert("Có lỗi xảy ra: ", ex.Message).Show();
            }
        }
示例#2
0
        protected void cbxChonCanBo_Selected(object sender, DirectEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(cbxChonCanBo.SelectedItem.Value))
                {
                    int recordId = Convert.ToInt32(cbxChonCanBo.SelectedItem.Value);
                    var hs       = RecordController.GetById(recordId);
                    if (hs != null)
                    {
                        // set general infomation
                        txtChucVu.Text     = hs.PositionName;
                        txtCongViec.Text   = hs.JobTitleName;
                        txtDepartment.Text = hs.DepartmentName;

                        // get newest salary development
                        var hsl = SalaryDecisionController.GetByIdConditionRecord(recordId);
                        if (hsl != null)
                        {
                            if (!string.IsNullOrEmpty(hsl.DecisionNumber))
                            {
                                txtSoQDCu.Text = hsl.DecisionNumber;
                            }
                            if (hsl.DecisionName != null)
                            {
                                txtTenQDCu.Text = hsl.DecisionName;
                            }
                            dfNgayQDCu.SetValue(hsl.DecisionDate);
                            //if (hsl.HOSO != null)
                            //    txtNguoiQDCu.Text = hsl.HOSO.HO_TEN;
                            dfNgayCoHieuLucCu.SetValue(hsl.EffectiveDate);
                            cbxNgachCu.SetValue(hsl.QuantumName);

                            if (!string.IsNullOrEmpty(hsl.SalaryGrade))
                            {
                                txtBacLuongCu.Text = "Bậc " + hsl.SalaryGrade;
                            }
                            if (hsl.SalaryFactor != null)
                            {
                                txtHeSoLuongCu.SetValue(hsl.SalaryFactor);
                            }
                            if (hsl.SalaryBasic != null)
                            {
                                txtMucLuongCu.SetValue(hsl.SalaryBasic);
                            }
                            if (hsl.SalaryInsurance != null)
                            {
                                txtLuongDongBHCu.SetValue(hsl.SalaryInsurance);
                            }
                            if (hsl.OtherAllowance != null)
                            {
                                txtPhuCapKhacCu.SetValue(hsl.OtherAllowance);
                            }
                            if (hsl.OutFrame != null)
                            {
                                txtVuotKhungCu.SetValue(hsl.OutFrame);
                            }
                            var strContractTypeId =
                                hr_ContractServices.GetFieldValueById(hsl.ContractId, "ContractTypeId");
                            if (!string.IsNullOrEmpty(strContractTypeId))
                            {
                                var contractTypeName =
                                    cat_ContractTypeServices.GetFieldValueById(Convert.ToInt32(strContractTypeId),
                                                                               "Name");
                                cbHopDongLoaiHopDongCu.Text = "" + contractTypeName;
                            }

                            if (hsl.Seniority != null)
                            {
                                txtThamNienCu.SetValue(hsl.Seniority);
                            }
                            if (hsl.BranchAllowance != null)
                            {
                                txtPCNganhCu.SetValue(hsl.BranchAllowance);
                            }
                        }
                        else
                        {
                            txtSoQDCu.Text  = "";
                            txtTenQDCu.Text = "";
                            dfNgayQDCu.SetValue("");
                            txtNguoiQDCu.Text = "";
                            dfNgayCoHieuLucCu.SetValue("");
                            cbxNgachCu.Text             = "";
                            txtBacLuongCu.Text          = "";
                            txtHeSoLuongCu.Text         = "";
                            txtMucLuongCu.Text          = "";
                            txtLuongDongBHCu.Text       = "";
                            txtPhuCapKhacCu.Text        = "";
                            txtVuotKhungCu.Text         = "";
                            cbHopDongLoaiHopDongCu.Text = "";
                        }
                    }
                    else
                    {
                        txtChucVu.Text     = "";
                        txtCongViec.Text   = "";
                        txtDepartment.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra khi chọn cán bộ: " + ex.Message).Show();
            }
        }