Beispiel #1
0
        public ActionResult UndoSpreadExpenseAmount(int purchaseInvoiceID, decimal spreadAmount)
        {
            bool status = false;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    status = service.UndoSpreadExpenseAmount(purchaseInvoiceID, spreadAmount);
                    //return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }

            //return View();
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Beispiel #2
0
        public ActionResult Save(Expenses expense)
        {
            bool status = false;

            try
            {
                //if (ModelState.IsValid)
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    status = service.SaveData(expense);
                    //return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }

            // return RedirectToAction("Index");
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Beispiel #3
0
        public ActionResult SaveVehicleExpense(List <VehicleExpenseModel> expense, int id)
        {
            bool status = false;

            try
            {
                if (expense != null && ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    status = service.SaveDataVehicleExpense(expense, id);
                    //return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }

            //return View();
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Beispiel #4
0
        public ActionResult DeleteExpenseLot(string ID)
        {
            int id = 0;

            if (ID != "0")
            {
                id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            }
            Lots lot = new Lots();

            lot.iLotID = id;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient expenseServiceClient = new ExpensesServiceClient();
                    lot = expenseServiceClient.GetLots(id);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "something went wrong");
                lot = null;
                throw e;
            }
            return(View("DeleteExpenseLot", lot));
        }
Beispiel #5
0
        public ActionResult Save(string ID)
        {
            int id = 0;

            if (ID != "0")//ID=0 for new record
            {
                id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            }
            Expenses expense = new Expenses();

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    expense          = service.GetExpenses(id);
                    ViewBag.PageName = "Create Expense Master";
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "something went wrong");
                expense = null;
                throw e;
            }
            return(View(expense));
        }
Beispiel #6
0
        public ActionResult GetExpenseByVehicleID(int id)
        {
            dynamic listExpenses = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();

                    listExpenses = service.GetExpenseByVehicleID(id);

                    //return Json(new { listPurchase }, JsonRequestBehavior.AllowGet);
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                listExpenses = null;
                throw e;
            }

            return(Json(listExpenses, JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public ActionResult SaveGeneralExpense(string ID)
        {
            int id = 0;

            if (ID != "0")
            {
                id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            }
            GeneralExpenses GeneralExpenses = new GeneralExpenses();

            GeneralExpenses.iGeneralExpensesID = id;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient expensesServiceClient = new ExpensesServiceClient();
                    GeneralExpenses  = expensesServiceClient.GetGeneralExpense(id);
                    ViewBag.PageName = "Create General Expense";
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "something went wrong");
                GeneralExpenses = null;
                throw e;
            }
            return(View(GeneralExpenses));
        }
Beispiel #8
0
        public ActionResult SaveGeneralExpense(GeneralExpenses genexpense)
        {
            //bool status = true;
            string savedBillNum = string.Empty;

            try
            {
                if (genexpense != null && ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    savedBillNum = service.saveGeneralExpense(genexpense);
                    //return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                // status = false;
                throw e;
            }

            //return View();
            return(new JsonResult {
                Data = new { billNumber = savedBillNum }
            });
        }
Beispiel #9
0
        public ActionResult GetAllVehicleExpensesByInvoiceID(int id)
        {
            dynamic listOfAllVehicleExpenseByInvoiceID = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    listOfAllVehicleExpenseByInvoiceID = service.GetAllVehicleExpensesByInvoiceID(id);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("error", "Something Wrong");
                listOfAllVehicleExpenseByInvoiceID = null;
                throw ex;
            }
            return(Json(listOfAllVehicleExpenseByInvoiceID, JsonRequestBehavior.AllowGet));
        }
Beispiel #10
0
        public ActionResult GetSingleVehicleExpensesListData()
        {
            dynamic listOfSingleVehicleExpenses = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    listOfSingleVehicleExpenses = service.GetSingleVehicleExpensesListData();
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("error", "Something Wrong");
                listOfSingleVehicleExpenses = null;
                throw ex;
            }
            return(Json(listOfSingleVehicleExpenses, JsonRequestBehavior.AllowGet));
        }
Beispiel #11
0
        public ActionResult ViewRowDataOfAllVehicleExpense(int id)
        {
            dynamic vehicleList = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    vehicleList = service.ViewRowDataOfAllVehicleExpense(id);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("error", "Something went Wrong");
                vehicleList = null;
                throw ex;
            }
            return(Json(vehicleList, JsonRequestBehavior.AllowGet));
        }
Beispiel #12
0
        public ActionResult GetAllLots()
        {
            dynamic lots = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient expenseServiceClient = new ExpensesServiceClient();
                    lots = expenseServiceClient.GetAllLots();
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                lots = null;
                throw e;
            }
            return(Json(lots, JsonRequestBehavior.AllowGet));
        }
Beispiel #13
0
        public ActionResult Delete(string ID)
        {
            int      id      = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            Expenses expense = new Expenses();

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    expense = service.GetExpenses(id);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                expense = null;
                throw e;
            }
            return(View(expense));
        }
Beispiel #14
0
        public ActionResult Delete(int ID)
        {
            //int id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            bool status = false;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();
                    status = service.Delete(ID);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong!");
                status = false;
                throw e;
            }
            return(View("Index"));
            //return new JsonResult { Data = new { status = status } };
        }
Beispiel #15
0
        public ActionResult SaveExpenseLot(Lots lot)
        {
            bool status = false;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient expensesServiceClient = new ExpensesServiceClient();

                    status = expensesServiceClient.SaveExpenseLot(lot);
                    //return RedirectToAction("Index");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }
            return(View("ExpenseLotList", lot));
            //   return new JsonResult { Data = new { status = status } };
        }
Beispiel #16
0
        public JsonResult VehiclesByVehicleID(int request)
        {
            dynamic VehiclesList = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();

                    VehiclesList = service.VehiclesByVehicleID(request);

                    //return Json(new { VehiclesList }, JsonRequestBehavior.AllowGet);
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                VehiclesList = null;
                throw e;
            }
            return(Json(new { VehiclesList }, JsonRequestBehavior.AllowGet));
        }
Beispiel #17
0
        public JsonResult AutoCompleteGeneralExpense(string prefix)
        {
            dynamic expenses = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();

                    expenses = service.AutoCompleteGeneralExpense(prefix);

                    //return Json(new { expenses }, JsonRequestBehavior.AllowGet);
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                expenses = null;
                throw e;
            }
            return(Json(expenses, JsonRequestBehavior.AllowGet));
        }
Beispiel #18
0
        public JsonResult VehiclesByBLNO(string request)
        {
            dynamic listPurchase = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();

                    listPurchase = service.VehiclesByBLNO(request);

                    //return Json(new { listPurchase }, JsonRequestBehavior.AllowGet);
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                listPurchase = null;
                throw e;
            }
            return(Json(new { listPurchase }, JsonRequestBehavior.AllowGet));
        }
Beispiel #19
0
        public ActionResult ExpenseFilterByDate(DateTime fromDate, DateTime toDate)
        {
            dynamic listExpense = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    ExpensesServiceClient service = new ExpensesServiceClient();

                    listExpense = service.ExpenseFilterByDate(fromDate, toDate);

                    //return Json(new { listPurchase }, JsonRequestBehavior.AllowGet);
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                listExpense = null;
                throw e;
            }
            return(Json(new { listExpense }, JsonRequestBehavior.AllowGet));
        }