public dynamic GetInfo(int Id) { OtherExpense model = new OtherExpense(); try { model = _otherExpenseService.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)); }
public OtherExpenseDetail FixDate(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService) { otherExpenseDetail.EndDate = otherExpenseDetail.EffectiveDate; OtherExpense otherExpense = _otherExpenseService.GetObjectById(otherExpenseDetail.OtherExpenseId); if (otherExpense != null) { DateTime curDay = otherExpenseDetail.EffectiveDate; int cnt = otherExpenseDetail.Recurring; while (cnt > 1) { switch ((Constant.SalaryItemStatus)otherExpense.SalaryStatus) { case Constant.SalaryItemStatus.Daily: otherExpenseDetail.EndDate = curDay.AddDays(1); break; case Constant.SalaryItemStatus.Weekly: otherExpenseDetail.EndDate = curDay.AddDays(7); break; case Constant.SalaryItemStatus.Monthly: otherExpenseDetail.EndDate = curDay.AddMonths(1); break; case Constant.SalaryItemStatus.Yearly: otherExpenseDetail.EndDate = curDay.AddYears(1); break; } curDay = otherExpenseDetail.EndDate; cnt--; } } return(otherExpenseDetail); }
public OtherExpenseDetail VHasOtherExpense(OtherExpenseDetail otherExpenseDetail, IOtherExpenseService _otherExpenseService) { OtherExpense otherExpense = _otherExpenseService.GetObjectById(otherExpenseDetail.OtherExpenseId); if (otherExpense == null) { otherExpenseDetail.Errors.Add("OtherExpense", "Tidak ada"); } return(otherExpenseDetail); }