Example #1
0
        public ActionResult Delete_Post(int SupplierID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    SuppliersBusinessModelLayers suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();

                    //mm
                    suppliersBusinessModelLayers.DeleteSuppliers(SupplierID);


                    return(RedirectToAction("List"));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
 public ActionResult Create_Post()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             SuppliersBusinessModelLayers       suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();
             BusinessModelLayer.SuppliersSingle suppliers = new BusinessModelLayer.SuppliersSingle();
             TryUpdateModel(suppliers);
             if (ModelState.IsValid)
             {
                 //mm
                 suppliersBusinessModelLayers.AddSuppliers(suppliers);
                 return(RedirectToAction("List"));
             }
             else
             {
                 return(View());
             }
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
        public ActionResult Details(int ProductID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers();
                    ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName");
                    SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers();
                    ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName");

                    ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers();

                    BusinessModelLayer.ProductsSingle products = productsBusinessModelLayers.GetAllProductss().FirstOrDefault(x => x.ProductID == ProductID);

                    return(View(products));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
 public IHttpActionResult Get()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             SuppliersBusinessModelLayers suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();
             List <BusinessModelLayer.SuppliersSingle> supplierss      = suppliersBusinessModelLayers.GetAllSupplierss();
             return(Ok(supplierss));
         }
         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
                {
                    CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers();
                    ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName");
                    SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers();
                    ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName");

                    ProductsBusinessModelLayers       productsBusinessModelLayers = new ProductsBusinessModelLayers();
                    BusinessModelLayer.ProductsSingle products = new BusinessModelLayer.ProductsSingle();
                    TryUpdateModel(products);
                    if (ModelState.IsValid)
                    {
                        //mm
                        productsBusinessModelLayers.AddProducts(products);
                        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 Details(int SupplierID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    SuppliersBusinessModelLayers suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();

                    BusinessModelLayer.SuppliersSingle suppliers = suppliersBusinessModelLayers.GetAllSupplierss().FirstOrDefault(x => x.SupplierID == SupplierID);

                    return(View(suppliers));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #7
0
 public ActionResult Create_Get()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers();
             ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName");
             SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers();
             ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName");
             return(View());
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #8
0
        public ActionResult Edit(int SupplierID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ViewBag.CurrentSort = sortOrder;
                    ViewBag.SupplierID  = SupplierID;

                    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;

                    //SUPPLIERS TABLE MASTER
                    BusinessModelLayer.Suppliers.SuppliersMasterDetailModel pageModel = new BusinessModelLayer.Suppliers.SuppliersMasterDetailModel();
                    SuppliersBusinessModelLayers         suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();
                    Suppliers.SuppliersMasterDetailModel suppliersMasterDetailModel   = new Suppliers.SuppliersMasterDetailModel();

                    pageModel.Suppliers = suppliersBusinessModelLayers.GetAllSupplierss().FirstOrDefault(x => x.SupplierID == SupplierID);

                    int pageSize = 10;
                    if (PgeSize != null)
                    {
                        Int32.TryParse(PgeSize, out pageSize);
                    }
                    ViewBag.PgeSize = pageSize;

                    int pageNumber = (page ?? 1);


                    //PRODUCTS DETAIL BEGIN

                    ViewBag.SupplierIDSortParm = String.IsNullOrEmpty(sortOrder) ? "SupplierID_desc" : "";
                    ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers();

                    List <BusinessModelLayer.Vwproducts> productss = productsBusinessModelLayers.GetAllVwproductss().FindAll(x => x.SupplierID == SupplierID).ToList();

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        productss = productss.Where(s => s.SupplierID == SupplierID && s.ProductName.ToString().ToLower().Contains(searchString.ToLower())).ToList();
                    }

                    switch (sortOrder)
                    {
                    case "SupplierID_desc":
                        productss = productss.OrderByDescending(s => s.SupplierID).ToList();
                        break;

                    default:      // SupplierID ascending
                        productss = productss.OrderBy(s => s.SupplierID).ToList();
                        break;
                    }
                    pageModel.ProductsVwDetl = productss.ToPagedList(pageNumber, pageSize);

                    //PRODUCTS 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.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;

                    SuppliersBusinessModelLayers          suppliersBusinessModelLayers = new SuppliersBusinessModelLayers();
                    List <BusinessModelLayer.Vwsuppliers> vwsupplierss = suppliersBusinessModelLayers.GetAllVwsupplierss();

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

                    switch (sortOrder)
                    {
                    case "ContactName_desc":
                        vwsupplierss = vwsupplierss.OrderByDescending(s => s.ContactName).ToList();
                        break;

                    //case "!!!":
                    //	vwsupplierss = vwsupplierss.OrderBy(s => s.!!!).ToList();
                    //	break;
                    //case "!!!_desc":
                    //	vwsupplierss = vwsupplierss.OrderByDescending(s => s.!!!).ToList();
                    //	break;
                    default:      // ContactName ascending
                        vwsupplierss = vwsupplierss.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(vwsupplierss.ToPagedList(pageNumber, pageSize)));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }