public PriceValueCollection FetchByQuery(Query qry) { PriceValueCollection coll = new PriceValueCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public PriceValueCollection FetchAll() { PriceValueCollection coll = new PriceValueCollection(); Query qry = new Query(PriceValue.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public PriceValueCollection FetchAll() { PriceValueCollection coll = new PriceValueCollection(); Query qry = new Query(PriceValue.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public PriceValueCollection FetchByID(object QuoteId) { PriceValueCollection coll = new PriceValueCollection().Where("quote_Id", QuoteId).Load(); return(coll); }
public PriceValueCollection FetchByQuery(Query qry) { PriceValueCollection coll = new PriceValueCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public PriceValueCollection FetchByID(object QuoteId) { PriceValueCollection coll = new PriceValueCollection().Where("quote_Id", QuoteId).Load(); return coll; }
//public PriceInfo GetPriceInfo(string Title, double Length, double Width, double Depth, double Weight, string Origin, string Final_Destination, int Copies) public string GetPaperQuote(int Dimensions, string Currency, string Pallet, string Title, double Length, double Width, double Extent, double PaperGsm, bool Hardback, string Origin, string Country, string Final_Destination, int Copies, Int32 cId, Int32 uId, Int32 qId, string testGsm) { //040712 has a pricer been passed back with pallet type? string _pricer = pricer_submitted(Pallet); string _pallet = wwi_func.get_string_element(Pallet, "&", 0); AssignBaseValues(); _pr.RequestCompanyId = cId; _pr.RequestDate = DateTime.Now; _pr.RequestUserId = uId; _pr.RequestIp = wwi_func.user_RequestingIP(); // _pr.BookTitle = Title; _pr.InDimensions = Dimensions; _pr.InCurrency = Currency; _pr.InPallet = _pallet; //Pallet; _pr.InLength = Length; _pr.InWidth = Width; _pr.InDepth = 0; _pr.InWeight = 0; _pr.CopiesCarton = 0; _pr.InExtent = Extent; _pr.InPapergsm = PaperGsm; _pr.InHardback = Hardback; _pr.OriginName = Origin; _pr.CountryName = Country; _pr.FinalName = Final_Destination; _pr.TotCopies = Copies; //if a quoteid has been passed though it might be positive (a copy of a previous quote treat as new) or negative (re-doing a previous quote) _pr.ClientVisible = qId == 0 ? true : qId > 0 ? true : false; _pr.CopyFromId = Math.Abs(qId); //dump to exel pricer and calculate submitPricerXl(Dimensions, _pricer, testGsm); //16/06/2011 use DAL //use generics to build a list so we can return 1-n results if required //IList<PriceValues> _prices = new List<PriceValues>(); Pricer.PriceValueCollection _prices = new PriceValueCollection(); _prices.Add(_pr); //return ilistQuoteToJson(_prices); return QuoteToJson(_prices); }
//end reset formulas /// <summary> /// serialise price data to JSON formatted string /// </summary> /// <param name="prices">pricevalue collection of calculated price quotes</param> /// <returns></returns> private string QuoteToJson(PriceValueCollection prices) { string _json = string.Empty; try { //Return JSON data //beware using the serialiser on tables with a timestamp - timsetamps will not convert //use linq to select the data to return, any other method will return the whole class inc. structure and we would have to enumerate columns/rows! if (prices.Count > 0) { var _rec = from p in prices select new uPriceValues { quoteId = p.QuoteId, price_loose_gbp = (double)p.PriceLooseGbp, price_pallet_gbp = (double)p.PricePalletGbp, price_total_gbp = (double)p.PriceTotalGbp, price_loose = (double)p.PriceLoose, price_pallet = (double)p.PricePallet, price_total = (double)p.PriceTotal, price_client = (double)p.PriceClient, ship_via = p.ShipVia, pallet_type = p.PalletType, loose_name = p.LooseName, lcl_name = p.LclName, lcl_v = (double)p.LclV, lcl_v20 = (double)p.LclV20, lcl_v40 = (double)p.LclV40, lcl_v40hc = (double)p.LclV40hc, lcl_loose_name = p.LclLooseName, lcl_vloose = (double)p.LclVloose, lcl_vloose20 = (double)p.LclVloose20, lcl_vloose40 = (double)p.LclVloose40, lcl_vloose40hc = (double)p.LclVloose40hc, out_length = (double)p.OutLength, out_width = (double)p.OutWidth, out_depth = (double)p.OutDepth, out_weight = (double)p.OutWeight }; JavaScriptSerializer _js = new JavaScriptSerializer(); _json += _js.Serialize(_rec); } else { _json = "{pricevalues=0}"; } } catch (Exception ex) { _json = ex.InnerException.ToString(); } return _json; }