コード例 #1
0
        public dynamic GetInfo(int Id)
        {
            OtherIncome model = new OtherIncome();

            try
            {
                model = _otherIncomeService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Id,
                model.SalaryItemId,
                model.Code,
                model.Name,
                model.Description,
                model.SalaryStatus,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public OtherIncomeDetail FixDate(OtherIncomeDetail otherIncomeDetail, IOtherIncomeService _otherIncomeService)
        {
            otherIncomeDetail.EndDate = otherIncomeDetail.EffectiveDate;
            OtherIncome otherIncome = _otherIncomeService.GetObjectById(otherIncomeDetail.OtherIncomeId);

            if (otherIncome != null)
            {
                DateTime curDay = otherIncomeDetail.EffectiveDate;
                int      cnt    = otherIncomeDetail.Recurring;
                while (cnt > 1)
                {
                    switch ((Constant.SalaryItemStatus)otherIncome.SalaryStatus)
                    {
                    case Constant.SalaryItemStatus.Daily: otherIncomeDetail.EndDate = curDay.AddDays(1); break;

                    case Constant.SalaryItemStatus.Weekly: otherIncomeDetail.EndDate = curDay.AddDays(7); break;

                    case Constant.SalaryItemStatus.Monthly: otherIncomeDetail.EndDate = curDay.AddMonths(1); break;

                    case Constant.SalaryItemStatus.Yearly: otherIncomeDetail.EndDate = curDay.AddYears(1); break;
                    }
                    curDay = otherIncomeDetail.EndDate;
                    cnt--;
                }
            }
            return(otherIncomeDetail);
        }
コード例 #3
0
        public OtherIncomeDetail VHasOtherIncome(OtherIncomeDetail otherIncomeDetail, IOtherIncomeService _otherIncomeService)
        {
            OtherIncome otherIncome = _otherIncomeService.GetObjectById(otherIncomeDetail.OtherIncomeId);

            if (otherIncome == null)
            {
                otherIncomeDetail.Errors.Add("OtherIncome", "Tidak ada");
            }
            return(otherIncomeDetail);
        }