public ActionResult Create_Get() { try // handle exogenous exceptions { try // log all exceptions { ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers(); ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName"); EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); return(View()); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Details(int OrderID) { try // handle exogenous exceptions { try // log all exceptions { ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers(); ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName"); EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers(); BusinessModelLayer.OrdersSingle orders = ordersBusinessModelLayers.GetAllOrderss().FirstOrDefault(x => x.OrderID == OrderID); return(View(orders)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Post() { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); BusinessModelLayer.CustomersSingle customers = new BusinessModelLayer.CustomersSingle(); TryUpdateModel(customers); if (ModelState.IsValid) { //mm customersBusinessModelLayers.AddCustomers(customers); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Delete_Post(string CustomerID) { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); //mm customersBusinessModelLayers.DeleteCustomers(CustomerID); return(RedirectToAction("List")); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public IHttpActionResult Get() { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); List <BusinessModelLayer.CustomersSingle> customerss = customersBusinessModelLayers.GetAllCustomerss(); return(Ok(customerss)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Post() { try // handle exogenous exceptions { try // log all exceptions { ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers(); ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName"); EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers(); BusinessModelLayer.OrdersSingle orders = new BusinessModelLayer.OrdersSingle(); TryUpdateModel(orders); if (ModelState.IsValid) { //mm ordersBusinessModelLayers.AddOrders(orders); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(string CustomerID, string CustomerTypeID) { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); CustomerdemographicsBusinessModelLayers customerdemographicsLUBusinessModelLayers = new CustomerdemographicsBusinessModelLayers(); ViewBag.CustomerDemographicss = new SelectList(customerdemographicsLUBusinessModelLayers.CustomerdemographicsSelect, "CustomerTypeID", "CustomerDesc"); CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemo; if (CustomerTypeID == null) { customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID); } else { customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID); } return(View(customercustomerdemo)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Post() { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); CustomerdemographicsBusinessModelLayers customerdemographicsLUBusinessModelLayers = new CustomerdemographicsBusinessModelLayers(); ViewBag.CustomerDemographicss = new SelectList(customerdemographicsLUBusinessModelLayers.CustomerdemographicsSelect, "CustomerTypeID", "CustomerDesc"); CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemo = new BusinessModelLayer.CustomercustomerdemoSingle(); TryUpdateModel(customercustomerdemo); if (ModelState.IsValid) { //mm customercustomerdemoBusinessModelLayers.AddCustomercustomerdemo(customercustomerdemo); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Get() { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); CustomerdemographicsBusinessModelLayers customerdemographicsLUBusinessModelLayers = new CustomerdemographicsBusinessModelLayers(); ViewBag.CustomerDemographicss = new SelectList(customerdemographicsLUBusinessModelLayers.CustomerdemographicsSelect, "CustomerTypeID", "CustomerDesc"); return(View()); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Details(string CustomerID) { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); BusinessModelLayer.CustomersSingle customers = customersBusinessModelLayers.GetAllCustomerss().FirstOrDefault(x => x.CustomerID == CustomerID); return(View(customers)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(int OrderID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ShippersBusinessModelLayers shippersLUBusinessModelLayers = new ShippersBusinessModelLayers(); ViewBag.Shipperss = new SelectList(shippersLUBusinessModelLayers.ShippersSelect, "ShipperID", "CompanyName"); EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); CustomersBusinessModelLayers customersLUBusinessModelLayers = new CustomersBusinessModelLayers(); ViewBag.Customerss = new SelectList(customersLUBusinessModelLayers.CustomersSelect, "CustomerID", "CompanyName"); ViewBag.CurrentSort = sortOrder; ViewBag.OrderID = OrderID; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //ORDERS TABLE MASTER BusinessModelLayer.Orders.OrdersMasterDetailModel pageModel = new BusinessModelLayer.Orders.OrdersMasterDetailModel(); OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers(); Orders.OrdersMasterDetailModel ordersMasterDetailModel = new Orders.OrdersMasterDetailModel(); pageModel.Orders = ordersBusinessModelLayers.GetAllOrderss().FirstOrDefault(x => x.OrderID == OrderID); int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //ORDER_DETAILS DETAIL BEGIN ViewBag.OrderIDSortParm = String.IsNullOrEmpty(sortOrder) ? "OrderID_desc" : ""; Order_DetailsBusinessModelLayers order_detailsBusinessModelLayers = new Order_DetailsBusinessModelLayers(); List <BusinessModelLayer.Vworder_details> order_detailss = order_detailsBusinessModelLayers.GetAllVworder_detailss().FindAll(x => x.OrderID == OrderID).ToList(); if (!String.IsNullOrEmpty(searchString)) { order_detailss = order_detailss.Where(s => s.OrderID == OrderID && s.ProductID.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "OrderID_desc": order_detailss = order_detailss.OrderByDescending(s => s.OrderID).ToList(); break; default: // OrderID ascending order_detailss = order_detailss.OrderBy(s => s.OrderID).ToList(); break; } pageModel.Order_DetailsVwDetl = order_detailss.ToPagedList(pageNumber, pageSize); //ORDER_DETAILS DETAIL END return(View(pageModel)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ViewResult List(string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ViewBag.CurrentSort = sortOrder; ViewBag.ContactNameSortParm = String.IsNullOrEmpty(sortOrder) ? "ContactName_desc" : ""; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); List <BusinessModelLayer.Vwcustomers> vwcustomerss = customersBusinessModelLayers.GetAllVwcustomerss(); if (!String.IsNullOrEmpty(searchString)) { vwcustomerss = vwcustomerss.Where(s => s.ContactName.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "ContactName_desc": vwcustomerss = vwcustomerss.OrderByDescending(s => s.ContactName).ToList(); break; //case "!!!": // vwcustomerss = vwcustomerss.OrderBy(s => s.!!!).ToList(); // break; //case "!!!_desc": // vwcustomerss = vwcustomerss.OrderByDescending(s => s.!!!).ToList(); // break; default: // ContactName ascending vwcustomerss = vwcustomerss.OrderBy(s => s.ContactName).ToList(); break; } int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); return(View(vwcustomerss.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit_Post(CustomersSingle customers, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { CustomersBusinessModelLayers customersBusinessModelLayers = new CustomersBusinessModelLayers(); if (ModelState.IsValid) { //mm customersBusinessModelLayers.UpdateCustomers(customers); return(RedirectToAction("List")); } ViewBag.CurrentSort = sortOrder; ViewBag.CustomerID = customers.CustomerID; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //CUSTOMERS TABLE MASTER BusinessModelLayer.Customers.CustomersMasterDetailModel pageModel = new BusinessModelLayer.Customers.CustomersMasterDetailModel { Customers = customersBusinessModelLayers.GetAllCustomerss().Single(x => x.CustomerID == customers.CustomerID) }; int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //ORDERS DETAIL BEGIN ViewBag.CustomerIDSortParm = String.IsNullOrEmpty(sortOrder) ? "CustomerID_desc" : ""; OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers(); pageModel.OrdersVwDetl = ordersBusinessModelLayers.GetAllVworderss().FindAll(x => x.CustomerID == customers.CustomerID).ToList().ToPagedList(pageNumber, pageSize); if (!String.IsNullOrEmpty(searchString)) { pageModel.OrdersVwDetl = pageModel.OrdersVwDetl.Where(s => s.CustomerID.ToString().ToLower().Contains(searchString.ToLower())).ToList().ToPagedList(pageNumber, pageSize); } switch (sortOrder) { case "CustomerID_desc": pageModel.OrdersVwDetl = pageModel.OrdersVwDetl.OrderByDescending(s => s.CustomerID).ToList().ToPagedList(pageNumber, pageSize); break; default: // CustomerID ascending pageModel.OrdersVwDetl = pageModel.OrdersVwDetl.OrderBy(s => s.CustomerID).ToList().ToPagedList(pageNumber, pageSize); break; } //ORDERS DETAIL END return(View(pageModel)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }