Exemple #1
0
        public Hre_AppendixContractModel Post([Bind] Hre_AppendixContractModel model)
        {
            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_AppendixContractModel>(model, "Hre_AppendixContract", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion
            if (model.ProfileContractID != Guid.Empty)
            {
                model.ContractID = model.ProfileContractID;
            }
            if (model.AppendixCreateBasicSalary == true)
            {
                Sal_BasicSalaryServices salaryservices        = new Sal_BasicSalaryServices();
                Sal_BasicSalaryEntity   basicSalaryBycontract = new Sal_BasicSalaryEntity();

                basicSalaryBycontract.ProfileID   = model.AppendixProfileID.Value;
                basicSalaryBycontract.GrossAmount = model.Salary != null?model.Salary.ToString() : "0";

                basicSalaryBycontract.CurrencyID   = model.CurenncyID != null ? model.CurenncyID.Value : Guid.Empty;
                basicSalaryBycontract.PersonalRate = model.PersonalRate;
                if (model.DateofEffect != null)
                {
                    basicSalaryBycontract.DateOfEffect = model.DateofEffect.Value;
                }

                basicSalaryBycontract.InsuranceAmount = model.InsuranceAmount != null ? model.InsuranceAmount.Value : 0;
                basicSalaryBycontract.CurrencyID1     = model.CurenncyID1;

                basicSalaryBycontract.ClassRateID = model.ClassRateID;
                basicSalaryBycontract.RankRateID  = model.RankRateID;

                basicSalaryBycontract.AllowanceType1ID = model.AllowanceID1;
                basicSalaryBycontract.AllowanceAmount1 = model.Allowance1;
                basicSalaryBycontract.CurrencyID2      = model.CurenncyID2;

                basicSalaryBycontract.AllowanceType2ID = model.AllowanceID2;
                basicSalaryBycontract.AllowanceAmount2 = model.Allowance2;
                basicSalaryBycontract.CurrencyID3      = model.CurenncyID3;

                basicSalaryBycontract.AllowanceType3ID = model.AllowanceID3;
                basicSalaryBycontract.AllowanceAmount3 = model.Allowance3;
                basicSalaryBycontract.CurrencyID4      = model.CurenncyIDSalary;

                salaryservices.Add(basicSalaryBycontract);
            }
            ActionService service = new ActionService(UserLogin);
            return(service.UpdateOrCreate <Hre_AppendixContractEntity, Hre_AppendixContractModel>(model, model.UserID));
        }
 /// <summary>
 /// [Tho.Bui] - Xóa hoặc chuyển đổi trạng thái Quốc Gia(Cat_Country) sang IsDelete
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Sal_BasicSalaryModel DeleteOrRemove(string id)
 {
     if (id != string.Empty)
     {
         var listID = id.Split(',').ToList();
         foreach (var i in listID)
         {
             Sal_BasicSalaryServices service = new Sal_BasicSalaryServices();
             var result = service.Remove <Sal_BasicSalaryEntity>(Common.ConvertToGuid(i));
         }
     }
     return(new Sal_BasicSalaryModel());
 }
Exemple #3
0
        public Hre_AppendixContractModel Post([Bind] Hre_AppendixContractModel model)
        {
            #region Validate
            string message       = string.Empty;
            var    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData <Hre_AppendixContractModel>(model, "Hre_AppendixContract", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return(model);
            }
            #endregion
            if (model.AppendixCreateBasicSalary == true)
            {
                Sal_BasicSalaryServices salaryservices        = new Sal_BasicSalaryServices();
                Sal_BasicSalaryEntity   basicSalaryBycontract = new Sal_BasicSalaryEntity();

                basicSalaryBycontract.ProfileID   = model.ProfileID.Value;
                basicSalaryBycontract.GrossAmount = model.Salary != null?model.Salary.ToString() : "0";

                basicSalaryBycontract.CurrencyID   = model.CurenncyID != null ? model.CurenncyID.Value : Guid.Empty;
                basicSalaryBycontract.PersonalRate = model.PersonalRate;
                if (model.DateofEffect != null)
                {
                    basicSalaryBycontract.DateOfEffect = model.DateofEffect.Value;
                }

                basicSalaryBycontract.InsuranceAmount = model.InsuranceAmount != null ? model.InsuranceAmount.Value : 0;
                basicSalaryBycontract.CurrencyID1     = model.CurenncyID1;

                basicSalaryBycontract.ClassRateID = model.ClassRateID;
                basicSalaryBycontract.RankRateID  = model.RankRateID;

                basicSalaryBycontract.AllowanceType1ID = model.AllowanceID1;
                basicSalaryBycontract.AllowanceAmount1 = model.Allowance1;
                basicSalaryBycontract.CurrencyID2      = model.CurenncyID2;

                basicSalaryBycontract.AllowanceType2ID = model.AllowanceID2;
                basicSalaryBycontract.AllowanceAmount2 = model.Allowance2;
                basicSalaryBycontract.CurrencyID3      = model.CurenncyID3;

                basicSalaryBycontract.AllowanceType3ID = model.AllowanceID3;
                basicSalaryBycontract.AllowanceAmount3 = model.Allowance3;
                basicSalaryBycontract.CurrencyID4      = model.CurenncyIDSalary;

                salaryservices.Add(basicSalaryBycontract);
            }
            var status           = string.Empty;
            var contractServices = new Hre_ContractServices();

            var contractEntity = contractServices.GetData <Hre_ContractEntity>(model.ProfileID, ConstantSql.hrm_hr_sp_get_ContractsByProfileId, UserLogin, ref status).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
            if (contractEntity != null)
            {
                model.ContractID = contractEntity.ID;
            }
            else
            {
                model.ActionStatus = ConstantMessages.WarningProfileHaveNotContract.ToString().TranslateString();
                return(model);
            }

            ActionService service = new ActionService(UserLogin);
            return(service.UpdateOrCreate <Hre_AppendixContractEntity, Hre_AppendixContractModel>(model, model.UserID));
        }