コード例 #1
0
 public TransactionResult <object> BL_SaveExpense(SpendingVM p_SpendingVMObj, int p_UserId)
 {
     if (DALObj.DAL_SaveExpense(new TRN_Expense
     {
         CategoryId = p_SpendingVMObj.CategoryId,
         Amount = p_SpendingVMObj.Amount ?? 0,
         CreatedDate = Convert.ToDateTime(p_SpendingVMObj.CreatedDate, CultureInfo.InvariantCulture),
         Note = p_SpendingVMObj.Note,
         UserId = p_UserId,
         IsActive = true
     }).TransactionResult)
     {
         return(new TransactionResult <object>
         {
             Success = true,
             Message = "Expense Saved Successfully"
         });
     }
     else
     {
         return(new TransactionResult <object>
         {
             Success = false,
             Message = "Something Went Wrong,Please try again"
         });
     }
 }
コード例 #2
0
 public TransactionResult <object> BL_UpdateIncome(SpendingVM p_SpendingVMObj)
 {
     if (DALObj.DAL_UpdateIncome(new TRN_Income
     {
         IncomeId = p_SpendingVMObj.Id ?? 0,
         CategoryId = p_SpendingVMObj.CategoryId,
         Amount = p_SpendingVMObj.Amount ?? 0,
         CreatedDate = Convert.ToDateTime(p_SpendingVMObj.CreatedDate, CultureInfo.InvariantCulture),
         Note = p_SpendingVMObj.Note
     }).TransactionResult)
     {
         return(new TransactionResult <object>
         {
             Success = true,
             Message = "Income Updated Successfully"
         });
     }
     else
     {
         return(new TransactionResult <object>
         {
             Success = false,
             Message = "Something Went Wrong,Please try again"
         });
     }
 }
コード例 #3
0
        public JsonResult SaveExpenseOrIncome(SpendingVM p_SpendingVM)
        {
            TransactionResult <object> result;

            if (p_SpendingVM.Id != null)
            {
                if (Convert.ToBoolean(p_SpendingVM.IsExpense))
                {
                    result = BLObj.BL_UpdateExpense(p_SpendingVM);
                }
                else
                {
                    result = BLObj.BL_UpdateIncome(p_SpendingVM);
                }
            }
            else
            {
                if (Convert.ToBoolean(p_SpendingVM.IsExpense))
                {
                    result = BLObj.BL_SaveExpense(p_SpendingVM, (Session["MST_UserInfo"] as MST_UserInfo).UserId);
                }
                else
                {
                    result = BLObj.BL_SaveIncome(p_SpendingVM, (Session["MST_UserInfo"] as MST_UserInfo).UserId);
                }
            }
            return(Json(result));
        }
コード例 #4
0
 public List <SpendingVM> BL_GetIncomesList(int p_UserId)
 {
     SpendingVMList = new List <SpendingVM>();
     foreach (usp_GetIncomesList_Result Income in DALObj.DAL_GetIncomesList(p_UserId).Data)
     {
         SpendingVM SpendingVMObj = new SpendingVM
         {
             Id           = Income.IncomeId,
             CategoryId   = Income.CategoryId,
             CategoryName = Income.CategoryName,
             Amount       = Income.Amount,
             CreatedDate  = Income.CreatedDate.ToString("dd/MMM/yyyy"),
             Note         = Income.Note
         };
         SpendingVMList.Add(SpendingVMObj);
     }
     return(SpendingVMList);
 }