Пример #1
0
 public IHttpActionResult Get()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             ShippersBusinessModelLayers shippersBusinessModelLayers = new ShippersBusinessModelLayers();
             List <BusinessModelLayer.ShippersSingle> shipperss      = shippersBusinessModelLayers.GetAllShipperss();
             return(Ok(shipperss));
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
        public ActionResult Details(int ShipperID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ShippersBusinessModelLayers shippersBusinessModelLayers = new ShippersBusinessModelLayers();

                    BusinessModelLayer.ShippersSingle shippers = shippersBusinessModelLayers.GetAllShipperss().FirstOrDefault(x => x.ShipperID == ShipperID);

                    return(View(shippers));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public ActionResult Edit(int ShipperID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ViewBag.CurrentSort = sortOrder;
                    ViewBag.ShipperID   = ShipperID;

                    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;

                    //SHIPPERS TABLE MASTER
                    BusinessModelLayer.Shippers.ShippersMasterDetailModel pageModel = new BusinessModelLayer.Shippers.ShippersMasterDetailModel();
                    ShippersBusinessModelLayers        shippersBusinessModelLayers  = new ShippersBusinessModelLayers();
                    Shippers.ShippersMasterDetailModel shippersMasterDetailModel    = new Shippers.ShippersMasterDetailModel();

                    pageModel.Shippers = shippersBusinessModelLayers.GetAllShipperss().FirstOrDefault(x => x.ShipperID == ShipperID);

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

                    int pageNumber = (page ?? 1);


                    //ORDERS DETAIL BEGIN

                    ViewBag.ShipViaSortParm = String.IsNullOrEmpty(sortOrder) ? "ShipVia_desc" : "";
                    OrdersBusinessModelLayers ordersBusinessModelLayers = new OrdersBusinessModelLayers();

                    List <BusinessModelLayer.Vworders> orderss = ordersBusinessModelLayers.GetAllVworderss().FindAll(x => x.ShipVia == ShipperID).ToList();

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        orderss = orderss.Where(s => s.ShipVia == ShipperID && s.CustomerID.ToString().ToLower().Contains(searchString.ToLower())).ToList();
                    }

                    switch (sortOrder)
                    {
                    case "ShipVia_desc":
                        orderss = orderss.OrderByDescending(s => s.ShipVia).ToList();
                        break;

                    default:      // ShipVia ascending
                        orderss = orderss.OrderBy(s => s.ShipVia).ToList();
                        break;
                    }
                    pageModel.OrdersVwDetl = orderss.ToPagedList(pageNumber, pageSize);

                    //ORDERS DETAIL END
                    return(View(pageModel));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }