Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        private void InitFormUpdate(int id)
        {
            // get current decision
            var model = SalaryDecisionController.GetById(id);

            if (model != null)
            {
                // get previous decision
                var previousDecision = SalaryDecisionController.GetPrevious(model.RecordId);

                // bind previous data
                if (previousDecision != null)
                {
                    txtCurrName.Text             = previousDecision.Name;
                    txtCurrDecisionNumber.Text   = previousDecision.DecisionNumber;
                    txtCurrDecisionDate.Text     = previousDecision.DecisionDate.ToString("dd/MM/yyyy");
                    txtCurrSignerName.Text       = previousDecision.SignerName;
                    txtCurrSignerPosition.Text   = previousDecision.SignerPosition;
                    txtCurrContractTypeName.Text = previousDecision.ContractTypeName;
                    txtCurrQuantumCode.Text      = previousDecision.QuantumCode;
                    txtCurrGrade.Text            = previousDecision.Grade.ToString();
                    txtCurrQuantumCode.Text      = previousDecision.QuantumCode;
                    txtCurrFactor.Text           = previousDecision.Factor.ToString("#,##0.00");
                    txtCurrSalaryLevel.Text      = previousDecision.Salary.ToString("#,###");
                    txtCurrContractSalary.Text   = previousDecision.ContractSalary.ToString("#,###");
                    txtCurrInsuranceSalary.Text  = previousDecision.InsuranceSalary.ToString("#,###");
                    txtCurrPercentageLeader.Text = previousDecision.PercentageLeader.ToString("0.00 %");
                }

                // bind current salary decision
                cboEmployee.Text             = model.EmployeeName;
                hdfEmployee.Text             = model.RecordId.ToString();
                txtName.Text                 = model.Name;
                txtDepartmentName.Text       = model.DepartmentName;
                txtPositionName.Text         = model.PositionName;
                txtJobTitleName.Text         = model.JobTitleName;
                cboContractType.Text         = model.ContractTypeName;
                txtDecisionNumber.Text       = model.DecisionNumber;
                dfDecisionDate.SelectedDate  = model.DecisionDate;
                dfEffectiveDate.SelectedDate = model.EditedDate;
                txtSignerName.Text           = model.SignerName;
                hdfPosition.Text             = model.SignerPositionId.ToString();
                cboPosition.Text             = model.SignerPosition;
                txtNote.Text                 = model.Note;
                hdfQuantumId.Text            = model.QuantumId.ToString();
                cboQuantum.Text              = model.QuantumName;
                hdfSalaryGrade.Text          = model.Grade.ToString();
                cboSalaryGrade.Text          = @"Bậc " + model.Grade;
                txtFactor.Text               = model.Factor.ToString("#,##0.00");
                txtSalaryLevel.Text          = model.Salary.ToString("##,###");
                txtPercentageSalary.Text     = model.PercentageSalary.ToString("0.00");
                txtPercentageLeader.Text     = model.PercentageLeader.ToString("0.00");
                // get file upload
                if (cfAttachFile.Visible)
                {
                    hdfAttachFile.Text = model.AttachFileName;
                    if (!string.IsNullOrEmpty(model.AttachFileName))
                    {
                        hdfAttachFile.Text = model.AttachFileName;
                        fufAttachFile.Text = GetFileName(model.AttachFileName);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        private void InitFormUpdate(int id)
        {
            // get current decision
            var model = SalaryDecisionController.GetById(id);

            if (model != null)
            {
                // get previous decision
                var previousDecision = SalaryDecisionController.GetPrevious(model.RecordId);

                // bind previous data
                if (previousDecision != null)
                {
                    txtCurrName.Text             = previousDecision.Name;
                    txtCurrDecisionNumber.Text   = previousDecision.DecisionNumber;
                    txtCurrDecisionDate.Text     = previousDecision.DecisionDate.ToString("dd/MM/yyyy");
                    txtCurrSignerName.Text       = previousDecision.SignerName;
                    txtCurrSignerPosition.Text   = previousDecision.SignerPosition;
                    txtCurrContractTypeName.Text = previousDecision.ContractTypeName;
                    txtCurrBasicSalary.Text      = previousDecision.BasicSalary.ToString("#,###");
                    txtCurrFactor.Text           = previousDecision.Factor.ToString("#,##0.00");
                    txtCurrGrossSalary.Text      = previousDecision.GrossSalary.ToString("#,###");
                    txtCurrNetSalary.Text        = previousDecision.NetSalary.ToString("#,###");
                    txtCurrContractSalary.Text   = previousDecision.ContractSalary.ToString("#,###");
                    txtCurrInsuranceSalary.Text  = previousDecision.InsuranceSalary.ToString("#,###");
                    txtCurrPercentageLeader.Text = previousDecision.PercentageLeader.ToString("0.00 %");
                }

                // bind current salary decision
                cboEmployee.Text             = model.EmployeeName;
                hdfEmployee.Text             = model.RecordId.ToString();
                txtName.Text                 = model.Name;
                txtDepartmentName.Text       = model.DepartmentName;
                txtPositionName.Text         = model.PositionName;
                txtJobTitleName.Text         = model.JobTitleName;
                cboContractType.Text         = model.ContractTypeName;
                txtDecisionNumber.Text       = model.DecisionNumber;
                dfDecisionDate.SelectedDate  = model.DecisionDate;
                dfEffectiveDate.SelectedDate = model.EditedDate;
                txtSignerName.Text           = model.SignerName;
                hdfPosition.Text             = model.SignerPositionId.ToString();
                cboPosition.Text             = model.SignerPosition;
                txtNote.Text                 = model.Note;
                txtBasicSalary.Text          = model.BasicSalary.ToString("#,###");
                txtFactor.Text               = model.Factor.ToString("#,##0.00");
                txtGrossSalary.Text          = model.GrossSalary.ToString("#,###");
                txtNetSalary.Text            = model.NetSalary.ToString("#,###");
                txtContractSalary.Text       = model.ContractSalary.ToString("#,###");
                txtInsuranceSalary.Text      = model.InsuranceSalary.ToString("#,###");
                txtPercentageSalary.Text     = model.PercentageSalary.ToString("0.00");
                txtPercentageLeader.Text     = model.PercentageLeader.ToString("0.00");
                txtPercentageOverGrade.Text  = model.PercentageOverGrade.ToString("0.00");
                // get file upload
                if (cfAttachFile.Visible)
                {
                    hdfAttachFile.Text = model.AttachFileName;
                    if (!string.IsNullOrEmpty(model.AttachFileName))
                    {
                        hdfAttachFile.Text = model.AttachFileName;
                        fufAttachFile.Text = GetFileName(model.AttachFileName);
                    }
                }
                //insurance
                var insurance = FluctuationInsuranceController.GetByRecordId(model.RecordId, model.EffectiveDate.Month, model.EffectiveDate.Year);

                if (insurance != null)
                {
                    hdfReason.Text        = insurance.ReasonId.ToString();
                    cboReason.Text        = insurance.ReasonName;
                    hdfInsuranceType.Text = ((int)insurance.Type).ToString();
                    if (insurance.Type != 0)
                    {
                        cboInsuranceType.Text = insurance.TypeName;
                    }
                    if (!string.IsNullOrEmpty(hdfInsuranceType.Text))
                    {
                        cboReason.Show();
                    }
                }
                else
                {
                    //reset insurance
                    ResetInsurance();
                }
            }
        }