Exemple #1
0
 public JsonResult AddLedger(VM_AddLedger vmLedger)
 {
     try
     {
         acc_Ledger ledger = new acc_Ledger();
         ledger.LedgerID        = Guid.NewGuid();
         ledger.LedgerName      = vmLedger.LedgerName;
         ledger.LedgerCode      = vmLedger.LedgerCode;
         ledger.GroupID         = vmLedger.GroupID;
         ledger.InitialBalance  = vmLedger.InitialBalance;
         ledger.BalanceType     = vmLedger.BalanceType;
         ledger.Comment         = vmLedger.Comment;
         ledger.OCode           = 1;
         ledger.RestaurantId    = Convert.ToInt32(SessionManger.RestaurantOfLoggedInUser(Session));
         ledger.CreatedBy       = SessionManger.LoggedInUser(Session);
         ledger.CreatedDateTime = DateTime.Now;
         unitOfWork.AccLedgerRepository.Insert(ledger);
         unitOfWork.Save();
         return(Json(new { success = true, successMessage = "Succefully Added Ledger" },
                     JsonRequestBehavior.AllowGet));
     }
     catch (Exception exception)
     {
         return(Json(new { success = false, errorMessage = exception.Message }));
     }
 }
Exemple #2
0
        public acc_Ledger GetLedgerById(String id)
        {
            acc_Ledger ledger = new acc_Ledger();
            var        result = unitOfWork.AccLedgerRepository.Get().Where(a => a.LedgerID == Guid.Parse(id)).FirstOrDefault();

            ledger.BalanceType    = result.BalanceType;
            ledger.Comment        = result.Comment;
            ledger.GroupID        = result.GroupID;
            ledger.InitialBalance = result.InitialBalance;
            ledger.LedgerCode     = result.LedgerCode;
            return(result);
        }
Exemple #3
0
 public JsonResult UpdateLedger(acc_Ledger ledger)
 {
     try
     {
         var dbLedger = unitOfWork.AccLedgerRepository.Get().Where(a => a.LedgerID == ledger.LedgerID).FirstOrDefault();
         dbLedger.LedgerName     = ledger.LedgerName;
         dbLedger.BalanceType    = ledger.BalanceType;
         dbLedger.Comment        = ledger.Comment;
         dbLedger.EditedBy       = SessionManger.LoggedInUser(Session);
         dbLedger.EditedDateTime = DateTime.Now;
         dbLedger.GroupID        = ledger.GroupID;
         dbLedger.InitialBalance = ledger.InitialBalance;
         unitOfWork.AccLedgerRepository.Update(dbLedger);
         unitOfWork.Save();
         return(Json(new { success = true, successMessage = "SuccessFully updated ledger" }));
     }
     catch (Exception exception)
     {
         return(Json(new { success = false, errorMessage = exception.Message }));
     }
 }