コード例 #1
0
        public SalarySlip CreateObject(SalarySlip salarySlip, ISalaryItemService _salaryItemService)
        {
            salarySlip.Errors = new Dictionary <String, String>();
            SalaryItem salaryItem = _salaryItemService.GetObjectById(salarySlip.SalaryItemId.GetValueOrDefault());

            if (salaryItem == null)
            {
                salaryItem = _salaryItemService.GetObjectByCode(salarySlip.Code);
                if (salaryItem != null)
                {
                    salarySlip.Errors = new Dictionary <string, string>();
                    salarySlip.Errors.Add("Code", "SalaryItem dengan Code ini sudah ada");
                    return(salarySlip);
                }
                salaryItem = _salaryItemService.CreateObject(salarySlip.Code, salarySlip.Name, salarySlip.SalarySign, (int)Constant.SalaryItemType.SalarySlip, (int)Constant.SalaryItemStatus.Monthly, salarySlip.IsMainSalary, salarySlip.IsDetailSalary, false);
                if (salaryItem == null)
                {
                    salarySlip.Errors = new Dictionary <string, string>();
                    salarySlip.Errors.Add("Code", "Tidak dapat membuat SalaryItem dengan Code ini");
                    return(salarySlip);
                }
                salarySlip.SalaryItemId = salaryItem.Id;
            }
            if (_validator.ValidCreateObject(salarySlip, this, _salaryItemService))
            {
                salarySlip.Index = GetQueryable().Count() + 1;
                _repository.CreateObject(salarySlip);
            }
            ;
            return(salarySlip);
        }
コード例 #2
0
        public SalarySlip CreateObject(string Code, string Name, int SalarySign, int SalaryStatus, bool IsMainSalary, bool IsDetailSalary,
                                       bool IsEnabled, bool IsPTKP, bool IsPPH21, ISalaryItemService _salaryItemService)
        {
            SalarySlip salarySlip = new SalarySlip
            {
                Code           = Code,
                Name           = Name,
                SalarySign     = SalarySign,
                IsMainSalary   = IsMainSalary,
                IsDetailSalary = IsDetailSalary,
                IsEnabled      = IsEnabled,
                IsPTKP         = IsPTKP,
                IsPPH21        = IsPPH21,
            };
            SalaryItem salaryItem = _salaryItemService.GetObjectByCode(Code);

            if (salaryItem != null)
            {
                salarySlip.Errors = new Dictionary <string, string>();
                salarySlip.Errors.Add("Code", "SalaryItem dengan Code ini sudah ada");
                return(salarySlip);
            }
            salaryItem = _salaryItemService.CreateObject(Code, Name, SalarySign, (int)Constant.SalaryItemType.SalarySlip, SalaryStatus, IsMainSalary, IsDetailSalary, false);
            if (salaryItem == null)
            {
                salarySlip.Errors = new Dictionary <string, string>();
                salarySlip.Errors.Add("Code", "Tidak dapat membuat SalaryItem dengan Code ini");
                return(salarySlip);
            }
            salarySlip.SalaryItemId = salaryItem.Id;
            return(this.CreateObject(salarySlip, _salaryItemService));
        }
コード例 #3
0
        public SalarySlipDetail CreateObject(int SalarySlipId, int SalarySign, string FirstSalaryItemCode, string Operator, string SecondSalaryItemCode, decimal SecondValue,
                                             bool HasMinValue, decimal MinValue, bool HasMaxValue, decimal MaxValue,
                                             ISalarySlipService _salarySlipService, IFormulaService _formulaService, ISalaryItemService _salaryItemService)
        {
            SalaryItem salaryItem = _salaryItemService.GetObjectByCode(FirstSalaryItemCode);
            Formula    formula    = new Formula
            {
                FirstSalaryItemId = salaryItem.Id,
                FormulaOp         = Operator,
            };

            salaryItem = _salaryItemService.GetObjectByCode(SecondSalaryItemCode);
            if (salaryItem == null)
            {
                formula.IsSecondValue = true;
                formula.SecondValue   = SecondValue;
                //formula.ValueSign = (int)Constant.SalarySign.Income;
            }
            else
            {
                formula.SecondSalaryItemId = salaryItem.Id;
            }
            _formulaService.CreateObject(formula, _salaryItemService);

            SalarySlipDetail salarySlipDetail = new SalarySlipDetail
            {
                SalarySlipId = SalarySlipId,
                SalarySign   = SalarySign,
                FormulaId    = formula.Id,
                HasMinValue  = HasMinValue,
                MinValue     = MinValue,
                HasMaxValue  = HasMaxValue,
                MaxValue     = MaxValue,
            };

            CreateObject(salarySlipDetail, _salarySlipService, _formulaService);
            if (salarySlipDetail.Errors.Any())
            {
                _formulaService.DeleteObject(formula.Id);
            }
            else
            {
                formula.SalarySlipDetailId = salarySlipDetail.Id;
                _formulaService.UpdateObject(formula, _salaryItemService);
            }
            return(salarySlipDetail);
        }
コード例 #4
0
 public SalaryStandard CreateObject(SalaryStandard salaryStandard, ITitleInfoService _titleInfoService,
                                    ISalaryStandardDetailService _salaryStandardDetailService, ISalaryItemService _salaryItemService)
 {
     salaryStandard.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(salaryStandard, _titleInfoService))
     {
         _repository.CreateObject(salaryStandard);
         if (!salaryStandard.Errors.Any())
         {
             foreach (var x in Enum.GetNames(typeof(Core.Constants.Constant.LegacySalaryItem)))
             {
                 SalaryStandardDetail ssd = new SalaryStandardDetail
                 {
                     SalaryStandardId = salaryStandard.Id,
                     SalaryItemId     = _salaryItemService.GetObjectByCode(x).Id,
                 };
                 _salaryStandardDetailService.CreateObject(ssd, this, _salaryItemService);
             }
         }
     }
     return(salaryStandard);
 }
コード例 #5
0
 public OtherExpense CreateObject(OtherExpense otherExpense, ISalaryItemService _salaryItemService)
 {
     otherExpense.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(otherExpense, this))
     {
         SalaryItem salaryItem = _salaryItemService.GetObjectByCode(otherExpense.Code);
         if (salaryItem != null)
         {
             otherExpense.Errors = new Dictionary <string, string>();
             otherExpense.Errors.Add("Code", "SalaryItem dengan Code ini sudah ada");
             return(otherExpense);
         }
         salaryItem = _salaryItemService.CreateObject(otherExpense.Code, otherExpense.Name, (int)Constant.SalarySign.Expense, (int)Constant.SalaryItemType.OtherExpense, otherExpense.SalaryStatus, otherExpense.IsMainSalary, otherExpense.IsDetailSalary, false);
         if (salaryItem == null)
         {
             otherExpense.Errors = new Dictionary <string, string>();
             otherExpense.Errors.Add("Code", "Tidak dapat membuat SalaryItem dengan Code ini");
             return(otherExpense);
         }
         otherExpense.SalaryItemId = salaryItem.Id;
         _repository.CreateObject(otherExpense);
     }
     return(otherExpense);
 }
コード例 #6
0
 public THR CreateObject(THR thr, ISalaryItemService _salaryItemService)
 {
     thr.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(thr, this))
     {
         SalaryItem salaryItem = _salaryItemService.GetObjectByCode(thr.Code);
         if (salaryItem != null)
         {
             thr.Errors = new Dictionary <string, string>();
             thr.Errors.Add("Code", "SalaryItem dengan Code ini sudah ada");
             return(thr);
         }
         salaryItem = _salaryItemService.CreateObject(thr.Code, thr.Name, (int)Constant.SalarySign.Income, (int)Constant.SalaryItemType.THR, (int)Constant.SalaryItemStatus.Monthly, thr.IsMainSalary, thr.IsDetailSalary, false);
         if (salaryItem == null)
         {
             thr.Errors = new Dictionary <string, string>();
             thr.Errors.Add("Code", "Tidak dapat membuat SalaryItem dengan Code ini");
             return(thr);
         }
         thr.SalaryItemId = salaryItem.Id;
         _repository.CreateObject(thr);
     }
     return(thr);
 }