Beispiel #1
0
 public string GetAllOtherExpenseByApprovalStatus(string Status, string ExpenseDate, string DefaultDate)
 {
     try
     {
         List <OtherExpense> otherExpenseList = _otherExpenseBusiness.GetAllOtherExpenseByApprovalStatus((Status != "")?int.Parse(Status):0, ExpenseDate);
         if (!string.IsNullOrEmpty(DefaultDate))
         {
             if (DefaultDate == "0")
             {
                 otherExpenseList = otherExpenseList != null?otherExpenseList
                                    .ToList() : null;
             }
             else
             {
                 ExpenseDate      = DateTime.Now.AddDays(-int.Parse(DefaultDate)).ToString("dd-MMM-yyyy");
                 otherExpenseList = otherExpenseList != null?otherExpenseList
                                    .Where(o => DateTime.Parse(o.ExpenseDate).Date >= DateTime.Parse(ExpenseDate).Date && DateTime.Parse(o.ExpenseDate).Date <= DateTime.Now.Date)
                                    .ToList() : null;
             }
         }
         string sumAmount = _commonBusiness.ConvertCurrency(otherExpenseList != null ? otherExpenseList.Sum(o => o.Amount):decimal.Zero);
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = otherExpenseList, TotalAmount = sumAmount }));
     }
     catch (Exception ex)
     {
         AppConstMessage cm = c.GetMessage(ex.Message);
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
     }
 }
Beispiel #2
0
 public string GetAllPendingForApprovalExpenseForMobile()
 {
     try
     {
         List <OtherExpenseViewModel> expenseObj = Mapper.Map <List <OtherExpense>, List <OtherExpenseViewModel> >(_otherExpenseBusiness.GetAllOtherExpenseByApprovalStatus(1, null));
         return(JsonConvert.SerializeObject(new { Result = true, Records = expenseObj }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message }));
     }
 }