Exemplo n.º 1
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;
     }
 }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
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;
            }
        }