public ActionResult Delete_Post(int EmployeeID) { try // handle exogenous exceptions { try // log all exceptions { EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); //mm employeesBusinessModelLayers.DeleteEmployees(EmployeeID); return(RedirectToAction("List")); } 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 { EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); BusinessModelLayer.EmployeesSingle employees = new BusinessModelLayer.EmployeesSingle(); TryUpdateModel(employees); if (ModelState.IsValid) { //mm employeesBusinessModelLayers.AddEmployees(employees); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Details(int EmployeeID) { try // handle exogenous exceptions { try // log all exceptions { EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); BusinessModelLayer.EmployeesSingle employees = employeesBusinessModelLayers.GetAllEmployeess().FirstOrDefault(x => x.EmployeeID == EmployeeID); return(View(employees)); } 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_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 IHttpActionResult Get() { try // handle exogenous exceptions { try // log all exceptions { EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); List <BusinessModelLayer.EmployeesSingle> employeess = employeesBusinessModelLayers.GetAllEmployeess(); return(Ok(employeess)); } 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(int EmployeeID, string TerritoryID) { try // handle exogenous exceptions { try // log all exceptions { EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); TerritoriesBusinessModelLayers territoriesLUBusinessModelLayers = new TerritoriesBusinessModelLayers(); ViewBag.Territoriess = new SelectList(territoriesLUBusinessModelLayers.TerritoriesSelect, "TerritoryID", "TerritoryDescription"); EmployeeterritoriesBusinessModelLayers employeeterritoriesBusinessModelLayers = new EmployeeterritoriesBusinessModelLayers(); BusinessModelLayer.EmployeeterritoriesSingle employeeterritories; if (TerritoryID == null) { employeeterritories = employeeterritoriesBusinessModelLayers.GetAllEmployeeterritoriess().FirstOrDefault(x => x.EmployeeID == EmployeeID); } else { employeeterritories = employeeterritoriesBusinessModelLayers.GetAllEmployeeterritoriess().FirstOrDefault(x => x.EmployeeID == EmployeeID && x.TerritoryID == TerritoryID); } return(View(employeeterritories)); } 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 { EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); TerritoriesBusinessModelLayers territoriesLUBusinessModelLayers = new TerritoriesBusinessModelLayers(); ViewBag.Territoriess = new SelectList(territoriesLUBusinessModelLayers.TerritoriesSelect, "TerritoryID", "TerritoryDescription"); return(View()); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(int EmployeeID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers(); ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName"); ViewBag.CurrentSort = sortOrder; ViewBag.EmployeeID = EmployeeID; 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; //EMPLOYEES TABLE MASTER BusinessModelLayer.Employees.EmployeesMasterDetailModel pageModel = new BusinessModelLayer.Employees.EmployeesMasterDetailModel(); EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); Employees.EmployeesMasterDetailModel employeesMasterDetailModel = new Employees.EmployeesMasterDetailModel(); pageModel.Employees = employeesBusinessModelLayers.GetAllEmployeess().FirstOrDefault(x => x.EmployeeID == EmployeeID); int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //EMPLOYEETERRITORIES DETAIL BEGIN ViewBag.EmployeeIDSortParm = String.IsNullOrEmpty(sortOrder) ? "EmployeeID_desc" : ""; EmployeeterritoriesBusinessModelLayers employeeterritoriesBusinessModelLayers = new EmployeeterritoriesBusinessModelLayers(); List <BusinessModelLayer.Vwemployeeterritories> employeeterritoriess = employeeterritoriesBusinessModelLayers.GetAllVwemployeeterritoriess().FindAll(x => x.EmployeeID == EmployeeID).ToList(); if (!String.IsNullOrEmpty(searchString)) { employeeterritoriess = employeeterritoriess.Where(s => s.EmployeeID == EmployeeID && s.TerritoryID.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "EmployeeID_desc": employeeterritoriess = employeeterritoriess.OrderByDescending(s => s.EmployeeID).ToList(); break; default: // EmployeeID ascending employeeterritoriess = employeeterritoriess.OrderBy(s => s.EmployeeID).ToList(); break; } pageModel.EmployeeterritoriesVwDetl = employeeterritoriess.ToPagedList(pageNumber, pageSize); //EMPLOYEETERRITORIES 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.LastNameSortParm = String.IsNullOrEmpty(sortOrder) ? "LastName_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; EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers(); List <BusinessModelLayer.Vwemployees> vwemployeess = employeesBusinessModelLayers.GetAllVwemployeess(); if (!String.IsNullOrEmpty(searchString)) { vwemployeess = vwemployeess.Where(s => s.LastName.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "LastName_desc": vwemployeess = vwemployeess.OrderByDescending(s => s.LastName).ToList(); break; //case "!!!": // vwemployeess = vwemployeess.OrderBy(s => s.!!!).ToList(); // break; //case "!!!_desc": // vwemployeess = vwemployeess.OrderByDescending(s => s.!!!).ToList(); // break; default: // LastName ascending vwemployeess = vwemployeess.OrderBy(s => s.LastName).ToList(); break; } int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); return(View(vwemployeess.ToPagedList(pageNumber, pageSize))); } 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; } }