Ejemplo n.º 1
0
        public ActionResult EditLedger(int id, FormCollection form, EXPENSESHEAD ledger)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                if (id > 0)
                {
                    if (MasterModels.UpdateLedger(id, ledger) > 0)
                    {
                        ViewData["Message"] = "Ledger Details Updated Successfully.";
                    }
                    else
                    {
                        ViewData["Message"] = "Failed to Update Ledger Details.";
                    }
                }
                else
                {
                    ViewData["Message"] = "Failed to Update Ledger Details.";
                }
                // TODO: Add update logic here

                EXPENSESHEAD newledger = MasterModels.GetLedgerDetailsByLedgerId(id);
                ViewData.Model          = newledger;
                ViewData["LedgerTypes"] = Utilities.GetLedgerNameList((int)newledger.LedgerTypeId);
                return(View());
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        public ActionResult EditLedger(int id)
        {
            EXPENSESHEAD ledger = MasterModels.GetLedgerDetailsByLedgerId(id);

            ViewData.Model = ledger;
            if (ledger != null)
            {
                ViewData["LedgerTypes"] = Utilities.GetLedgerNameList((int)ledger.LedgerTypeId);
            }
            return(View());
        }
Ejemplo n.º 3
0
 public static int DeleteLedgerByLedgerId(int id)
 {
     using (eLawyerEntities islObject = new eLawyerEntities())
     {
         Payments payment = islObject.Payments.FirstOrDefault(pmt => pmt.ExpenseHeadId == id);
         if (payment == null)
         {
             EXPENSESHEAD ledger = islObject.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == id);
             if (ledger != null)
             {
                 islObject.DeleteObject(ledger);
                 return(islObject.SaveChanges());
             }
         }
         return(0);
     }
 }
Ejemplo n.º 4
0
 //=====================================================================
 #region Ledgers
 public static int CreateLedger(EXPENSESHEAD ledger)
 {
     using (eLawyerEntities deo = new eLawyerEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => exp.ClientId == ledger.ClientId && ledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             return(0);
         }
         else
         {
             if (ledger != null)
             {
                 deo.AddToEXPENSESHEAD(ledger);
                 return(deo.SaveChanges());
             }
         }
     }
     return(0);
 }
Ejemplo n.º 5
0
 public ActionResult Ledgers(FormCollection form, EXPENSESHEAD ledger)
 {
     ViewData["LedgerTypes"] = Utilities.GetLedgerNameList(0);
     if (Session["ClientId"] != null)
     {
         ledger.ClientId = (int)Session["ClientId"];
         ledger.OP_BAL   = 0;
         if (!ModelState.IsValid)
         {
             ViewData["Message"] = "Missing entries. Please check and try again.";
             return(View());
         }
         if (ledger.LedgerTypeId != null && !string.IsNullOrEmpty(ledger.CODE) && !string.IsNullOrEmpty(ledger.NAME))
         {
             if (MasterModels.CreateLedger(ledger) > 0)
             {
                 return(RedirectToAction("LedgersList"));
             }
             else
             {
                 ViewData["Message"] = "Invalid Entry..(Please Check for Duplicate or Invalid Entry).";
             }
         }
         else
         {
             ViewData["Message"] = "Missing entries. Please check and try again.";
         }
     }
     else
     {
         if (Roles.IsUserInRole("SuperAdmin"))
         {
             return(RedirectToAction("List", "Client"));
         }
     }
     return(View());
 }
Ejemplo n.º 6
0
 public static int UpdateLedger(int ledgerId, EXPENSESHEAD newledger)
 {
     using (eLawyerEntities deo = new eLawyerEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => newledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             EXPENSESHEAD oldledger = deo.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == ledgerId);
             if (oldledger != null && newledger != null)
             {
                 oldledger.CODE         = newledger.CODE;
                 oldledger.NAME         = newledger.NAME;
                 oldledger.LedgerTypeId = newledger.LedgerTypeId;
                 oldledger.OP_BAL       = newledger.OP_BAL;
                 return(deo.SaveChanges());
             }
         }
         else
         {
             return(0);
         }
     }
     return(0);
 }