public IHttpActionResult Get(string CustomerID, string CustomerTypeID) { try // handle exogenous exceptions { try // log all exceptions { CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemos = new CustomercustomerdemoSingle(); if (CustomerTypeID == null) { customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID); } else { customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().FirstOrDefault(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID); } return(Ok(customercustomerdemos)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Delete_Post(string CustomerID, string CustomerTypeID) { try // handle exogenous exceptions { try // log all exceptions { CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); if (CustomerTypeID == null) { //mm customercustomerdemoBusinessModelLayers.DeleteCustomercustomerdemo(CustomerID); } else { //mm customercustomerdemoBusinessModelLayers.EXE_sql("DELETE FROM [CustomerCustomerDemo] WHERE (CustomerID = " + "N'" + CustomerID.ToString() + "'" + ") AND (CustomerTypeID = " + "N'" + CustomerTypeID.ToString() + "'" + ")"); } return(RedirectToAction("List")); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit_Post(string CustomerID, string CustomerTypeID) { try // handle exogenous exceptions { try // log all exceptions { CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); BusinessModelLayer.CustomercustomerdemoSingle customercustomerdemo; if (CustomerTypeID == null) { customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().Single(x => x.CustomerID == CustomerID); } else { customercustomerdemo = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos().Single(x => x.CustomerID == CustomerID && x.CustomerTypeID == CustomerTypeID); } UpdateModel <CustomercustomerdemoSingle>(customercustomerdemo); if (ModelState.IsValid) { //mm customercustomerdemoBusinessModelLayers.UpdateCustomercustomerdemo(customercustomerdemo); return(RedirectToAction("List")); } return(View(customercustomerdemo)); } 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 { CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); List <BusinessModelLayer.CustomercustomerdemoSingle> customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllCustomercustomerdemos(); return(Ok(customercustomerdemos)); } 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 ViewResult List(string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ViewBag.CurrentSort = sortOrder; ViewBag.CustomerIDSortParm = String.IsNullOrEmpty(sortOrder) ? "CustomerID_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; CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); List <BusinessModelLayer.Vwcustomercustomerdemo> vwcustomercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllVwcustomercustomerdemos(); if (!String.IsNullOrEmpty(searchString)) { vwcustomercustomerdemos = vwcustomercustomerdemos.Where(s => s.CustomerID.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "CustomerID_desc": vwcustomercustomerdemos = vwcustomercustomerdemos.OrderByDescending(s => s.CustomerID).ToList(); break; //case "!!!": // vwcustomercustomerdemos = vwcustomercustomerdemos.OrderBy(s => s.!!!).ToList(); // break; //case "!!!_desc": // vwcustomercustomerdemos = vwcustomercustomerdemos.OrderByDescending(s => s.!!!).ToList(); // break; default: // CustomerID ascending vwcustomercustomerdemos = vwcustomercustomerdemos.OrderBy(s => s.CustomerID).ToList(); break; } int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); return(View(vwcustomercustomerdemos.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(string CustomerTypeID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ViewBag.CurrentSort = sortOrder; ViewBag.CustomerTypeID = CustomerTypeID; 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; //CUSTOMERDEMOGRAPHICS TABLE MASTER BusinessModelLayer.Customerdemographics.CustomerdemographicsMasterDetailModel pageModel = new BusinessModelLayer.Customerdemographics.CustomerdemographicsMasterDetailModel(); CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers(); Customerdemographics.CustomerdemographicsMasterDetailModel customerdemographicsMasterDetailModel = new Customerdemographics.CustomerdemographicsMasterDetailModel(); pageModel.Customerdemographics = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss().FirstOrDefault(x => x.CustomerTypeID == CustomerTypeID); int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //CUSTOMERCUSTOMERDEMO DETAIL BEGIN ViewBag.CustomerTypeIDSortParm = String.IsNullOrEmpty(sortOrder) ? "CustomerTypeID_desc" : ""; CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers(); List <BusinessModelLayer.Vwcustomercustomerdemo> customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllVwcustomercustomerdemos().FindAll(x => x.CustomerTypeID == CustomerTypeID).ToList(); if (!String.IsNullOrEmpty(searchString)) { customercustomerdemos = customercustomerdemos.Where(s => s.CustomerTypeID == CustomerTypeID && s.CustomerTypeID.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "CustomerTypeID_desc": customercustomerdemos = customercustomerdemos.OrderByDescending(s => s.CustomerTypeID).ToList(); break; default: // CustomerTypeID ascending customercustomerdemos = customercustomerdemos.OrderBy(s => s.CustomerTypeID).ToList(); break; } pageModel.CustomercustomerdemoVwDetl = customercustomerdemos.ToPagedList(pageNumber, pageSize); //CUSTOMERCUSTOMERDEMO DETAIL END return(View(pageModel)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }