Example #1
0
 public ActionResult Create_Post()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             CustomerdemographicsBusinessModelLayers       customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
             BusinessModelLayer.CustomerdemographicsSingle customerdemographics = new BusinessModelLayer.CustomerdemographicsSingle();
             TryUpdateModel(customerdemographics);
             if (ModelState.IsValid)
             {
                 //mm
                 customerdemographicsBusinessModelLayers.AddCustomerdemographics(customerdemographics);
                 return(RedirectToAction("List"));
             }
             else
             {
                 return(View());
             }
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        public ActionResult Delete_Post(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();

                    //mm
                    customerdemographicsBusinessModelLayers.DeleteCustomerdemographics(CustomerTypeID);


                    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
         {
             CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
             List <BusinessModelLayer.CustomerdemographicsSingle> customerdemographicss      = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss();
             return(Ok(customerdemographicss));
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
        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;
            }
        }
Example #5
0
        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;
            }
        }
Example #6
0
 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;
     }
 }
Example #7
0
        public ActionResult Details(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();

                    BusinessModelLayer.CustomerdemographicsSingle customerdemographics = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss().FirstOrDefault(x => x.CustomerTypeID == CustomerTypeID);

                    return(View(customerdemographics));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #8
0
        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;
            }
        }
Example #9
0
        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.CustomerDescSortParm = String.IsNullOrEmpty(sortOrder) ? "CustomerDesc_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;

                    CustomerdemographicsBusinessModelLayers          customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
                    List <BusinessModelLayer.Vwcustomerdemographics> vwcustomerdemographicss = customerdemographicsBusinessModelLayers.GetAllVwcustomerdemographicss();

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        vwcustomerdemographicss = vwcustomerdemographicss.Where(s => s.CustomerDesc.ToString().ToLower().Contains(searchString.ToLower())).ToList();
                    }

                    switch (sortOrder)
                    {
                    case "CustomerDesc_desc":
                        vwcustomerdemographicss = vwcustomerdemographicss.OrderByDescending(s => s.CustomerDesc).ToList();
                        break;

                    //case "!!!":
                    //	vwcustomerdemographicss = vwcustomerdemographicss.OrderBy(s => s.!!!).ToList();
                    //	break;
                    //case "!!!_desc":
                    //	vwcustomerdemographicss = vwcustomerdemographicss.OrderByDescending(s => s.!!!).ToList();
                    //	break;
                    default:      // CustomerDesc ascending
                        vwcustomerdemographicss = vwcustomerdemographicss.OrderBy(s => s.CustomerDesc).ToList();
                        break;
                    }

                    int pageSize = 10;
                    if (PgeSize != null)
                    {
                        Int32.TryParse(PgeSize, out pageSize);
                    }
                    ViewBag.PgeSize = pageSize;
                    int pageNumber = (page ?? 1);
                    return(View(vwcustomerdemographicss.ToPagedList(pageNumber, pageSize)));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }