public IEnumerable <Open_Orders__ByShipToResult> GetOpenOrders(int shipToID, DateTime fromDate, string user)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    //IEnumerable<Open_Orders__ByShipToResult> openOrds = db.Open_Orders__ByShipToAsync(69249, Convert.ToDateTime("12/26/2019"), "mmartino").Result.ToList();
                    IEnumerable <Open_Orders__ByShipToResult> openOrds = db.Open_Orders__ByShipToAsync(shipToID, fromDate, user).Result.ToList();

                    if (openOrds.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(openOrds);
                    }
                    else
                    {
                        return(openOrds);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
Esempio n. 2
0
        public IEnumerable <OrderHeaderWithDetailResult> GetOrderHeader_OrdNbr(Decimal OrderNbr, string OrdStatus)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <OrderHeaderWithDetailResult> ordInfo = db.GetOrderHeader_OrdNbrAsync(OrderNbr, OrdStatus).Result.ToList();

                    if (ordInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(ordInfo);
                    }
                    else
                    {
                        List <OrderHeaderWithDetailResult> lst = new List <OrderHeaderWithDetailResult>();
                        lst = (List <OrderHeaderWithDetailResult>)ordInfo;

                        foreach (OrderHeaderWithDetailResult item in lst)
                        {
                            if (item != null)
                            {
                                IEnumerable <OrderDetailResult> ordDetailInfo = db.GetOrderDetail_OrdNbrAsync(item.Order_Number.Value, OrdStatus).Result.ToList();
                                item.Line_Items = ordDetailInfo;
                            }
                        }


                        return(ordInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <OrderSummaryResult> GetOrderSummary_PONbr(String PONbr, Decimal BillToID, string OrdStatus, string OrdType, DateTime?StartDate, DateTime?EndDate)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <OrderSummaryResult> ordInfo = db.GetOrderSummary_PONbrAsync(PONbr, BillToID, OrdStatus, OrdType, StartDate, EndDate).Result.ToList();

                    if (ordInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(ordInfo);
                    }
                    else
                    {
                        return(ordInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <IsItemPartOrWholeResult> IsItemPartOrWhole(string SKU, string CustID)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <IsItemPartOrWholeResult> itemInfo = db.IsItemPartOrWholeAsync(SKU, CustID).Result.ToList();

                    if (itemInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(itemInfo);
                    }
                    else
                    {
                        return(itemInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
Esempio n. 5
0
        public IEnumerable <NetPriceResult> GetPartPrice(string SKU, string PriceGrp, Decimal CustID)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <NetPriceResult> partsPriceInfo = db.Get_Parts_Price_CPAsync(SKU, PriceGrp, CustID).Result.ToList();

                    if (partsPriceInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(partsPriceInfo);
                    }
                    else
                    {
                        return(partsPriceInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <Open_Orders__ByShipToResult> GetOpenOrdersByPO_ByBillTo(string PONbr, DateTime fromDate, string user, int billToID)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <Open_Orders__ByShipToResult> openOrds = db.Open_Orders__ByPO_BillToAsync(PONbr, fromDate, user, billToID).Result.ToList();

                    if (openOrds.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(openOrds);
                    }
                    else
                    {
                        return(openOrds);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
Esempio n. 7
0
        public IEnumerable <Customer_InfoResult> GetCustomerInfo_ByBillTo(Decimal BillToID, string StateProv)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <Customer_InfoResult> custInfo = db.GetCustomerInfo_ByBillToAsync(BillToID, StateProv).Result.ToList();

                    if (custInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(custInfo);
                    }
                    else
                    {
                        return(custInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
Esempio n. 8
0
        public IEnumerable <Shipment_TrackingResult> ShipmentTrackingByOrderNbrandInvoiceDt(int OrderNbr, String Ord_Type, DateTime Invoice_Dt)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <Shipment_TrackingResult> trackingInfo = db.Shipment_TrackingAsync(OrderNbr, Ord_Type, Invoice_Dt).Result.ToList();

                    if (trackingInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(trackingInfo);
                    }
                    else
                    {
                        return(trackingInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <GetPriceGroupResult> GetPriceGroup(string BranchID)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <GetPriceGroupResult> priceGrpInfo = db.GetPriceGroupAsync(BranchID).Result.ToList();

                    if (priceGrpInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(priceGrpInfo);
                    }
                    else
                    {
                        return(priceGrpInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <AccountsResult> GetAccounts()
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <AccountsResult> accountsInfo = db.GetAccountsAsync().Result.ToList();

                    if (accountsInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(accountsInfo);
                    }
                    else
                    {
                        return(accountsInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }
        public IEnumerable <OrderSummaryWithDetailResult> GetOpenOrder_DateRange(string OrdType, DateTime?StartDate, DateTime?EndDate)
        {
            try
            {
                using (symportalSPsContext db = new symportalSPsContext())
                {
                    IEnumerable <OrderSummaryWithDetailResult> ordInfo = db.GetOpenOrder_DateRangeAsync(OrdType, StartDate, EndDate).Result.ToList();

                    if (ordInfo.Count() == 0)
                    {
                        Response.StatusCode = 404; //Not Found
                        return(ordInfo);
                    }
                    else
                    {
                        List <OrderSummaryWithDetailResult> lst = new List <OrderSummaryWithDetailResult>();
                        lst = (List <OrderSummaryWithDetailResult>)ordInfo;

                        foreach (OrderSummaryWithDetailResult item in lst)
                        {
                            if (item != null)
                            {
                                IEnumerable <OrderDetailResult> ordDetailInfo = db.GetOrderDetail_OrdNbrAsync(item.Order_Number.Value, "open").Result.ToList();
                                item.Line_Items = ordDetailInfo;
                            }
                        }

                        return(ordInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex; //Error Controller will return error status code
            }
        }