Пример #1
0
    protected void dxbtnget_Click(object sender, EventArgs e)
    {
        if (Page.Session["user"] != null)
        {
            
            const int _maxattempts = 2;
            
            int _attempts = 0;
            int _dims = 0;
            string _error = "";
            string _test = "";
            bool _returned = false;

            //050912 use currently selected values if not null otherwise check cookies & hidden fields for values 
            //int _dims = !string.IsNullOrEmpty(this.dxrblintpe.Value.ToString()) ? wwi_func.vint(this.dxrblintpe.Value.ToString()) : wwi_func.vint(get_saved_token("dims"));
            _dims = this.dxrblintpe.Value != null ? wwi_func.vint(this.dxrblintpe.Value.ToString()) : wwi_func.vint(get_saved_token("dims"));
            //make sure we have valid inputs for all dimensions
            _test = test_input_values(Math.Abs(_dims));
            if (_test != "")
            {
                while (_attempts <= _maxattempts && _returned == false)
                {
                    try
                    {
                        localhost.Publiship_Pricer _ws = new localhost.Publiship_Pricer();

                        //switch to this when debugging and check port number!
                        //use global resx to identify web site location

                        string _location = get_site_url(wwi_func.get_from_global_resx("web_site_location")); //for testing use: get_site_url("local");
                        _ws.Url = _location;

                        _ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
                        //consume web service
                        //Test string
                        //string _result = _ws.GetPriceQuote(1, this.dxhfpricer.Get("crnc").ToString(), this.dxtxttitle.Text.ToString(),
                        //        305, 242, 18, 800, 100, this.dxtxtorigin.Text.ToString(), this.dxtxtdest.Text.ToString(), 5000);

                        //080112 if this information is not in hidden fields (seems to be problematic for some users? mac os?
                        //use cookie values

                        Int32 _quoteid = this.dxhfpricer.Contains("cv") ? wwi_func.vint(this.dxhfpricer.Get("cv").ToString()) : 0; //210911 pass quote id through (as a negative number if re-doing quote)
                        Int32 _cid = (Int32)((UserClass)Page.Session["user"]).CompanyId;
                        Int32 _uid = (Int32)((UserClass)Page.Session["user"]).UserId;

                        //040712 only pass this through for publiship users, clients can't choose a pricer 
                        string _spreadsheet = _cid == -1 ? this.dxcbospreadsheet.Text.ToString() : "";

                        string _curr = !string.IsNullOrEmpty(this.dxcbocurrency.Text.ToString()) ? this.dxcbocurrency.Text.ToString() + "," + this.dxcbocurrency.Value.ToString() : get_saved_token("crnc");
                        string _pall = this.dxcbotypepallet.Value != null ? this.dxcbotypepallet.Value.ToString() : get_saved_token("pall");
                        _pall += "&&" + _spreadsheet; ;

                        //290113 check inputs for length, width, height, weight, etc.
                        string[] _inputs = _test.Split(";".ToCharArray());
                        double[] _size = Array.ConvertAll(_inputs, new Converter<string, double>(measurementsTosize));
                        string _title = test_title(Math.Abs(_dims));
                        int _cartons = test_cartons(Math.Abs(_dims));
                        bool _cover = (bool)this.dxckcover.Checked; ;
                        //clear result string
                        string _result = "";

                        switch (Math.Abs(_dims))
                        {
                            case 1:
                                {
                                    //120911 append quoteid and clientvisible status to title string
                                    //_title = !string.IsNullOrEmpty(this.dxtxttitle.Text.ToString()) ? this.dxtxttitle.Text.ToString() : get_saved_token("title"); // +(this.dxhfpricer.Contains("cv") ? this.dxhfpricer.Get("cv").ToString() : "");
                                    //_cartons = !string.IsNullOrEmpty(this.dxtcarton.Text.ToString()) ? wwi_func.vint(this.dxtcarton.Text.ToString()):  wwi_func.vint(get_saved_token("cartons"));

                                    _result = _ws.GetBookQuote(_dims, _curr, _pall, _title,
                                        _size[0], _size[1], _size[2], _size[3], _cartons, this.dxcborigin.Text.ToString(), this.dxcbcountry.Text.ToString(), this.dxcbfinal.Text.ToString(), wwi_func.vint(this.dxtxtcopies.Text.ToString()), _cid, _uid, _quoteid);

                                    break;
                                }
                            case 2:
                                {
                                    //120911 append quoteid and clientvisible status to title string
                                    //_title = !string.IsNullOrEmpty(this.dxtxtcarttitle.Text.ToString()) ? this.dxtxtcarttitle.Text.ToString() : get_saved_token("title");
                                    //_cartons = !string.IsNullOrEmpty(this.dxtxtcartcopy.Text.ToString())? wwi_func.vint(this.dxtxtcartcopy.Text.ToString()): wwi_func.vint(get_saved_token("cartons"));

                                    _result = _ws.GetCartonQuote(_dims, _curr, _pall, _title,
                                        _size[0], _size[1], _size[2], _size[3], _cartons, this.dxcborigin.Text.ToString(), this.dxcbcountry.Text.ToString(), this.dxcbfinal.Text.ToString(), wwi_func.vint(this.dxtxtcopies.Text.ToString()), _cid, _uid, _quoteid);

                                    break;
                                }
                            case 3:
                                {
                                    //120911 append quoteid and clientvisible status to title string
                                    //_title = !string.IsNullOrEmpty(this.dxtxttitle3.Text.ToString()) ? this.dxtxttitle3.Text.ToString() : get_saved_token("title");
                                    //_cover = (bool)this.dxckcover.Checked;

                                    _result = _ws.GetPaperQuote(_dims, _curr, _pall, _title,
                                    _size[0], _size[1], _size[2], _size[3], _cover, this.dxcborigin.Text.ToString(), this.dxcbcountry.Text.ToString(), this.dxcbfinal.Text.ToString(), wwi_func.vint(this.dxtxtcopies.Text.ToString()), _cid, _uid, _quoteid, _inputs[3]);
                                     //_result = pricer_test.GetPaperQuote(_dims, _curr, _pall, _title,
                                     //_size[0], _size[1], _size[2], _size[3], _cover, this.dxcborigin.Text.ToString(), this.dxcbcountry.Text.ToString(), this.dxcbfinal.Text.ToString(), wwi_func.vint(this.dxtxtcopies.Text.ToString()), _cid, _uid, _quoteid);

                                    break;
                                }
                        }

                        //this code creates an asynchronous request to web service - it works - but how do we get the results to a page?!
                        //the service will return a result but the UI can't see it
                        //_ws.BeginGetPriceQuote(1, this.dxhfpricer.Get("crnc").ToString(), this.dxtxttitle.Text.ToString(),
                        //        305, 242, 18, 800, 100, this.dxtxtorigin.Text.ToString(), this.dxtxtdest.Text.ToString(), 5000, new AsyncCallback(callbackHandler), _ws);

                        //get JSON string and format it
                        //this.dxlblquote.Text = _result;
                        this.dxhfpricer.Set("qote", _result);

                        //deserialise JSON string 
                        JavaScriptSerializer _js = new JavaScriptSerializer();
                        //DAL.Pricer.PriceValueCollection _pvs = _js.Deserialize<DAL.Pricer.PriceValueCollection>(_result);
                        //using ilist
                        IList<DAL.Services.uPriceValues> _pvs = _js.Deserialize<IList<DAL.Services.uPriceValues>>(_result);

                        if (_pvs.Count > 0)
                        {
                            //if there was an error total price should return as -1
                            if (_pvs[0].price_total > 0)
                            {
                                //get dimensions from output values - for paper size they might be different than input dims
                                this.dxlblsize.Text = String.Format("{0} x {1} x {2}", _pvs[0].out_length.ToString(), _pvs[0].out_width.ToString(), _pvs[0].out_depth.ToString());
                                this.dxlblweight.Text = String.Format("{0}", _pvs[0].out_weight.ToString());

                                //bind to template
                                //price request summary
                                this.dxlblqot1.Text = _dims == 1 ? "Book size (mm)" : _dims == 2 ? "Carton size" : "Paper size and extent";
                                this.dxlblqot2.Text = _dims == 1 ? "Book weight (gms)" : _dims == 2 ? "Carton weight (kgs)" : "Paper weight (gsm)";
                                this.dxlblbookname.Text = _dims == 1 ? this.dxtxttitle.Text : _dims == 2 ? this.dxtxtcarttitle.Text : this.dxtxttitle3.Text;
                                //size is formatted above

                                this.dxlblfrom.Text = this.dxcborigin.Text.ToString();
                                this.dxlblto.Text = this.dxcbfinal.Text.ToString(); //this.dxcbcountry.Text.ToString();
                                this.dxlblcopies.Text = String.Format("{0} copies", this.dxtxtcopies.Text.ToString());
                                this.dxlblppc.Text = String.Format("{0} per copy", this.dxcbocurrency.Text.ToString());

                                // code for ilist
                                this.dxlblquote.Text = _pvs[0].quoteId.ToString();
                                this.dxlblvia.Text = _pvs[0].ship_via != null ? _pvs[0].ship_via.ToString() : ""; //shipping via
                                this.dxlbltype.Text = _pvs[0].pallet_type.ToString(); //pallet type
                                this.dxlblshiploose.Text = _pvs[0].loose_name.ToString(); //description loose pallets
                                this.dxlbllclname.Text = _pvs[0].lcl_name.ToString(); //all lcl description
                                //prices
                                this.dxlblv.Text = Math.Round(_pvs[0].lcl_v, 2).ToString();
                                this.dxlblv20.Text = Math.Round(_pvs[0].lcl_v20, 2).ToString();
                                this.dxlblv40.Text = Math.Round(_pvs[0].lcl_v40, 2).ToString();
                                this.dxlblv40hc.Text = Math.Round(_pvs[0].lcl_v40hc, 2).ToString();
                                this.dxlblvloose.Text = Math.Round(_pvs[0].lcl_vloose, 2).ToString();
                                this.dxlblvloose20.Text = Math.Round(_pvs[0].lcl_vloose20, 2).ToString();
                                this.dxlblvloose40.Text = Math.Round(_pvs[0].lcl_vloose40, 2).ToString();
                                this.dxlblvloose40hc.Text = Math.Round(_pvs[0].lcl_vloose40hc, 2).ToString();

                                //client page uses a summary view 
                                this.dxlblbookname2.Text = _dims == 1 ? this.dxtxttitle.Text : _dims == 2 ? this.dxtxtcarttitle.Text : this.dxtxttitle3.Text;
                                this.dxlblquote2.Text = _pvs[0].quoteId.ToString();

                                //book price
                                this.dxlblclient1.Text = String.Format("{0} mm", this.dxtxtlength.Text.ToString());
                                this.dxlblclient2.Text = String.Format("{0} mm", this.dxtxtwidth.Text.ToString());
                                this.dxlblclient3.Text = String.Format("{0} mm", this.dxtxtdepth.Text.ToString());
                                this.dxlblclient4.Text = String.Format("{0} gms", this.dxtxtweight.Text.ToString());
                                this.dxlblclient5.Text = this.dxtcarton.Text.ToString();
                                //carton price
                                this.dxlblclient6.Text = String.Format("{0} mm", this.dxtxtside1.Text.ToString());
                                this.dxlblclient7.Text = String.Format("{0} mm", this.dxtxtside2.Text.ToString());
                                this.dxlblclient8.Text = String.Format("{0} mm", this.dxtxtcartdepth.Text.ToString());
                                this.dxlblclient9.Text = String.Format("{0} kgs", this.dxtxtcartweight.Text.ToString());
                                this.dxlblclient10.Text = this.dxtxtcartcopy.Text.ToString();
                                //paper price
                                this.dxlblclient11.Text = String.Format("{0} mm", this.dxtxtblock1.Text.ToString());
                                this.dxlblclient12.Text = String.Format("{0} mm", this.dxtxtblock2.Text.ToString());
                                this.dxlblclient13.Text = String.Format("{0} pp", this.dxtxtextent.Text.ToString());
                                //this.dxlblclient14.Text = String.Format(this.dxlblclient14.Text, this.dxspinpaper.Text.ToString());
                                this.dxlblclient14.Text = String.Format("{0} gsm", this.dxcboPaper.Text.ToString());
                                this.dxlblclient15.Text = this.dxckcover.Checked ? "Yes" : "No";
                                //other client summary stuff 
                                this.dxlblfrom2.Text = this.dxcborigin.Text.ToString();
                                this.dxlblto2.Text = this.dxcbfinal.Text.ToString(); //this.dxcbcountry.Text.ToString();
                                this.dxlblvia2.Text = this.dxlblvia.Text;
                                this.dxlblcopies2.Text = this.dxlblcopies.Text;
                                this.dxlblppc2.Text = this.dxlblppc.Text; //currency description

                                //05/08/11 moved to service
                                //exchange rate?
                                string _currvalue = this.dxcbocurrency.Value.ToString();
                                //double _rate = wwi_func.getexchangerate(_currvalue, "GBP");

                                //09/08/2011 don't display sterling price as well request by Dave Thompson
                                //so this section is unnecessary, gbp <dl>'s have beeen hidden in client page
                                //if (_currvalue != "GBP")
                                //{
                                //    this.dxlblpricepre.Text = Math.Round(_pvs[0].price_pallet, 2).ToString() + " (£" + Math.Round(_pvs[0].price_pallet_gbp, 2).ToString() + ")"; //pre-palletised price
                                //    this.dxlblpriceloose.Text = Math.Round(_pvs[0].price_loose, 2).ToString() + " (£" + Math.Round(_pvs[0].price_loose_gbp, 2).ToString() + ")"; //price loose 
                                //    this.dxlblppc3.Text = Math.Round(_pvs[0].price_loose, 2).ToString(); //per copy by currency
                                //    this.dxlbltotprice2.Text = Math.Round(_pvs[0].price_total,2).ToString(); //total price by currency
                                //    this.dxlblexprice2.Text = Math.Round(_pvs[0].price_loose_gbp, 2).ToString(); //per copy sterling
                                //    this.dxlblexprice3.Text = Math.Round(_pvs[0].price_total_gbp, 2).ToString(); //total sterling
                                //}
                                //else
                                //{
                                //    this.dxlblpricepre.Text = Math.Round(_pvs[0].price_pallet,2).ToString(); //pre-palletised price
                                //    this.dxlblpriceloose.Text = Math.Round(_pvs[0].price_loose,2).ToString(); //price loose 
                                //    this.dxlblppc3.Text = Math.Round(_pvs[0].price_loose_gbp, 2).ToString(); //per copy sterling
                                //    this.dxlbltotprice2.Text = Math.Round(_pvs[0].price_total_gbp, 2).ToString(); //total price sterling
                                //    //client view hide unnecessary fields
                                //    this.dxlblexprice0.Text = "";
                                //    this.dxlblexprice1.Text = "";
                                //    this.dxlblexprice2.Text = "";
                                //    this.dxlblexprice3.Text = "";
                                //}
                                //format currency description
                                string[] _currtext = this.dxcbocurrency.Text.Replace(")", "").ToString().Split('(');

                                //internal
                                this.dxlblpricepre.Text = Math.Round(_pvs[0].price_pallet, 2).ToString() + " " + _currtext[1].ToString(); //pre-palletised price
                                this.dxlblpriceloose.Text = Math.Round(_pvs[0].price_loose, 2).ToString() + " " + _currtext[1].ToString(); //price loose 
                                //client
                                this.dxlblppc3.Text = Math.Round(_pvs[0].price_client, 2).ToString() + " " + _currtext[1].ToString(); //per copy by currency that client sees
                                this.dxlbltotprice2.Text = Math.Round(_pvs[0].price_total, 2).ToString() + " " + _currtext[0].ToString(); //total price by currency
                                
                                //moved to end while
                                //show_quote_tab();
                                _returned = true;
                            }
                            else
                            {
                                _attempts += 1;
                                _error += Environment.NewLine + Environment.NewLine + "Attempt " + _attempts.ToString() + ": Price not available." + Environment.NewLine + "Unfortunately it was not possible to calculate a price using the information supplied." + Environment.NewLine + "Please check your input details or contact Publiship for more information."; ;
                                //this.dxlblerr.Text = "Price not available." + Environment.NewLine + "Unfortunately it was not possible to calculate a price using the information supplied." + Environment.NewLine + "Please check your input details or contact Publiship for more information.";
                                //this.dxpagepricer.ActiveTabIndex = 6;

                            }
                        }
                        else
                        {
                            _attempts += 1;
                            string _ex = _pvs[0].lcl_name == "exception" ? _pvs[0].lcl_loose_name.ToString() : "";
                            //this.dxlblerr.Text = "Price not available." + Environment.NewLine + "Unfortunately it was not possible to calculate a price using the information supplied." + Environment.NewLine + "Please check your input details or contact Publiship for more information." + _ex;
                            //this.dxpagepricer.ActiveTabIndex = 6;
                            _error += Environment.NewLine + Environment.NewLine + "Attempt " + _attempts.ToString() + ": Price not available." + Environment.NewLine + "Unfortunately it was not possible to calculate a price using the information supplied." + Environment.NewLine + _ex;

                        }
                    }
                    catch (Exception ex)
                    {
                        _attempts += 1;
                        string _ex = ex.Message.ToString();
                        //this.dxlblerr.Text = _ex;
                        //this.dxpagepricer.ActiveTabIndex = 6;
                        _error += Environment.NewLine + Environment.NewLine + "Attempt " + _attempts.ToString() + " Error: " + Environment.NewLine + _ex;
                    }
                } //end while

                if (_returned == false)
                {
                    string _mailsent = error_reported() == true ? Environment.NewLine + Environment.NewLine + "The details you entered have been forwarded to publiship for checking." : "";
                    this.dxlblerr.Text = _error + _mailsent;
                    this.dxpagepricer.ActiveTabIndex = 6;
                }
                else
                {
                    show_quote_tab();
                    //290113 clear tracking in hidden fields
                    if (this.dxhfpricer.Contains("title")) { this.dxhfpricer.Remove("title"); }
                    if (this.dxhfpricer.Contains("input")) { this.dxhfpricer.Remove("input"); }
                    if (this.dxhfpricer.Contains("cartons")) { this.dxhfpricer.Remove("cartons"); }
                }
            }//end if result != ""
        }
        else
        {
            Response.Redirect("../user_accounts/signin.aspx?" + "rp=" + wwi_security.EncryptString("pricer/price_quote", "publiship")); 
        }
    }
Пример #2
0
    /// <summary>
    /// get costing summary pre-palletised /loose / all
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxcbkcosting_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {
        string _type = e.Parameter.ToString(); 
        string _squoteid = this.dxlblquote.Text.ToString();
        int _idquote = wwi_func.vint(_squoteid);

        if (_idquote > 0)
        {
            localhost.Publiship_Pricer _ws = new localhost.Publiship_Pricer();
            string _location = get_site_url(wwi_func.get_from_global_resx("web_site_location"));
            _ws.Url = _location;
            
            _ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

            string _costing = _ws.GetCostingSummary(_idquote, _type);
            //deserialise JSON string 
            JavaScriptSerializer _js = new JavaScriptSerializer();
            //using ilist
            IList<DAL.Services.uCostingSummary> _pvs = _js.Deserialize<IList<DAL.Services.uCostingSummary>>(_costing);

            this.dxlblcostingh1.Text = "Costing summary " + _type;
            this.dxlblcostingh2.Text = string.Format(this.dxlblcostingh2.Text, " " + this.dxtxtcopies.Text.ToString(), _type == "loose" ? " " + this.dxlblloosename.Text.ToString() : " " + this.dxlbllclname.Text.ToString()); 
            //pre-carriage
            this.dxlblpre1.Text = Math.Round(_pvs[0].pre_part,2).ToString();
            this.dxlblpre2.Text = Math.Round(_pvs[0].pre_full,2).ToString();
            this.dxlblpre3.Text = Math.Round(_pvs[0].pre_thc20,2).ToString();
            this.dxlblpre4.Text = Math.Round(_pvs[0].pre_thc40,2).ToString();
            this.dxlblpre5.Text = Math.Round(_pvs[0].pre_thclcl,2).ToString();
            this.dxlblpre6.Text = Math.Round(_pvs[0].pre_docs,2).ToString();
            this.dxlblpre7.Text = Math.Round(_pvs[0].pre_origin,2).ToString();
            this.dxlblpre8.Text = Math.Round(_pvs[0].pre_haul20,2).ToString();
            this.dxlblpre9.Text = Math.Round(_pvs[0].pre_haul40, 2).ToString();
            //freight
            this.dxlblfre1.Text = Math.Round(_pvs[0].freight_lcl, 2).ToString();
            this.dxlblfre2.Text = Math.Round(_pvs[0].freight_20, 2).ToString();
            this.dxlblfre3.Text = Math.Round(_pvs[0].freight_40, 2).ToString();
            this.dxlblfre4.Text = Math.Round(_pvs[0].freight_40hq, 2).ToString();
            //on destination
            this.dxlblonc1.Text = Math.Round(_pvs[0].on_dest_lcl, 2).ToString();
            this.dxlblonc2.Text = Math.Round(_pvs[0].on_pier_etc, 2).ToString();
            this.dxlblonc3.Text = Math.Round(_pvs[0].on_dest_20, 2).ToString();
            this.dxlblonc4.Text = Math.Round(_pvs[0].on_dest_40, 2).ToString();
            this.dxlblonc5.Text = Math.Round(_pvs[0].on_docs, 2).ToString();
            this.dxlblonc6.Text = Math.Round(_pvs[0].on_customs, 2).ToString();
            this.dxlblonc7.Text = Math.Round(_pvs[0].on_part, 2).ToString();
            this.dxlblonc8.Text = Math.Round(_pvs[0].on_full, 2).ToString();
            this.dxlblonc9.Text = Math.Round(_pvs[0].on_haul20, 2).ToString();
            this.dxlblonc10.Text = Math.Round(_pvs[0].on_haul40, 2).ToString();
            this.dxlblonc11.Text = Math.Round(_pvs[0].on_shunt20, 2).ToString();
            this.dxlblonc12.Text = Math.Round(_pvs[0].on_shunt40, 2).ToString();
            this.dxlblonc13.Text = Math.Round(_pvs[0].on_pallets, 2).ToString();
            this.dxlblonc14.Text = Math.Round(_pvs[0].on_other, 2).ToString();
        }
    }
Пример #3
0
    //end get costing summary

    /// <summary>
    /// shipment size data callback
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxcbkshipment_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {
        string _squoteid = this.dxlblquote.Text.ToString();
        int _dims = wwi_func.vint(this.dxhfpricer.Get("dims").ToString());
        int _idquote = wwi_func.vint(_squoteid);

        if (_idquote > 0)
        {
            localhost.Publiship_Pricer _ws = new localhost.Publiship_Pricer();
            string _location = get_site_url(wwi_func.get_from_global_resx("web_site_location"));
            _ws.Url = _location;
            
            _ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

            string _shipment = _ws.GetShipmentSize(_idquote);
            //deserialise JSON string 
            JavaScriptSerializer _js = new JavaScriptSerializer();
            //using ilist
            IList<DAL.Services.uShipmentSize> _siz = _js.Deserialize<IList<DAL.Services.uShipmentSize>>(_shipment);

            //pre-palletised
            this.dxlblship1.Text = Math.Round(_siz[0].calc_copiescarton, 2).ToString(); //_dims ==1 ? this.dxtcarton.Text.ToString(): _dims==2? this.dxtxtcartcopy.Text.ToString(): "0"; 
            this.dxlblship2.Text = Math.Round(_siz[0].tot_cartons,2).ToString();
            this.dxlblship3.Text = Math.Round(_siz[0].pal_cartons,2).ToString();
            this.dxlblship4.Text = Math.Round(_siz[0].pal_full,2).ToString();
            this.dxlblship5.Text = Math.Round(_siz[0].pal_full_wt,2).ToString();
            this.dxlblship6.Text = Math.Round(_siz[0].pal_full_cu,2).ToString();
            this.dxlblship7.Text = Math.Round(_siz[0].pal_layers,2).ToString();
            this.dxlblship8.Text = Math.Round(_siz[0].pal_layer_count,2).ToString();
            this.dxlblship9.Text = Math.Round(_siz[0].pal_total_wt,2).ToString();
            this.dxlblship10.Text = Math.Round(_siz[0].pal_total_cu,2).ToString();
            this.dxlblship11.Text = Math.Round(_siz[0].pal_ratio,2).ToString();

            //cartons
            this.dxlblship12.Text = Math.Round(_siz[0].ctn_hgt,2).ToString();
            this.dxlblship13.Text = Math.Round(_siz[0].ctn_len,2).ToString();
            this.dxlblship14.Text = Math.Round(_siz[0].ctn_wid,2).ToString();
            this.dxlblship15.Text = Math.Round(_siz[0].ctn_wt,2).ToString();
            this.dxlblship16.Text = Math.Round(_siz[0].par_count,2).ToString();
            this.dxlblship17.Text = Math.Round(_siz[0].ctn_remaining,2).ToString();
            this.dxlblship18.Text = Math.Round(_siz[0].residue_cu,2).ToString();
            this.dxlblship19.Text = Math.Round(_siz[0].residue_wt,2).ToString();
            this.dxlblship20.Text = Math.Round(_siz[0].ctn_total_wt,2).ToString();
            this.dxlblship21.Text = Math.Round(_siz[0].ctn_total_cu,2).ToString();
            this.dxlblship22.Text = Math.Round(_siz[0].ctn_ratio, 2).ToString();
        }

    }
Пример #4
0
    //end callback group 


    /// <summary>
    /// get original price values from a previous quote and use in pricer
    /// </summary>
    /// <param name="quoteid"></param>
    protected void get_price_criteria(int quoteid, int pricergroup)
    {
        localhost.Publiship_Pricer _ws = new localhost.Publiship_Pricer();

        string _location = get_site_url(wwi_func.get_from_global_resx("web_site_location"));
        _ws.Url = _location;
        
        _ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

        string _params = _ws.GetQuoteCriteria(quoteid);
        //deserialise JSON string 
        JavaScriptSerializer _js = new JavaScriptSerializer();
        //using ilist
        IList<DAL.Services.uPriceParams> _val = _js.Deserialize<IList<DAL.Services.uPriceParams>>(_params);

        //common to all input types
        this.dxrblintpe.Items[_val[0].in_dimensions-1].Selected = true; 
        //11/08/2011 can use either 1st part of currency description (Text) or 2nd part (Value) to set currenct
        this.dxcbocurrency.Value  = _val[0].in_currency.Split(',').GetValue(1).ToString().Trim();
        
        //bound on load as it does as data does not need to change so we can get value immediately
        //this.dxcborigin.Value = this.dxcborigin.Items.FindByText(_val[0].origin_name != null ? _val[0].origin_name : ""); 
        //bind country amd final dlls based on selected text this way we can return the correct Value as well
        //we have to do this as otherwise the ddls will not have any data in them and therefore no valid value when we set the text
        string _orig = _val[0].origin_name != null ? _val[0].origin_name.ToString() : "";
        string _ctry = _val[0].country_name != null ? _val[0].country_name.ToString() : "";
        string _fnl = _val[0].final_name != null ? _val[0].final_name.ToString() : "";
        
        //120312 use datasource from pricer spreadsheet 
        //this.dxcborigin.Text = _val[0].origin_name != null? _val[0].origin_name:"";
        this.dxcborigin.SelectedItem = this.dxcborigin.Items.FindByText(_orig);
        //bind_cbo_country(this.dxcborigin.Value != null ? this.dxcborigin.Value.ToString() : "");
        bind_cbo_country(pricergroup, this.dxcborigin.Text);
        //this.dxcbcountry.Text = _ctry;
        this.dxcbcountry.SelectedItem = this.dxcbcountry.Items.FindByText(_ctry);  
        //120312 use datasource from pricer spreadsheet 
        //bind_cbo_final(this.dxcbcountry.Value != null ? this.dxcbcountry.Value.ToString() : "");
        bind_cbo_final(pricergroup, this.dxcbcountry.Text);
        this.dxcbfinal.SelectedItem = this.dxcbfinal.Items.FindByText(_fnl);

        
        this.dxtxtcopies.Text = _val[0].tot_copies.ToString();
        this.dxcbotypepallet.Text = _val[0].in_pallet != null? _val[0].in_pallet.ToString():"";
        
        //change from defaults so we dispay correct info
        this.dxhfpricer.Set("dims", _val[0].in_dimensions);
        this.dxhfpricer.Set("crnc", _val[0].in_currency.ToString());
        this.dxhfpricer.Set("pall", this.dxcbotypepallet.Text.ToString());
        
        //specific to input type
        switch (_val[0].in_dimensions)
        {
            case 1:
                {
                    this.dxtxttitle.Text = _val[0].book_title != null?_val[0].book_title.ToString():"";
                    this.dxtxtlength.Text = _val[0].in_length.ToString();
                    this.dxtxtwidth.Text = _val[0].in_width.ToString(); 
                    this.dxtxtdepth.Text = _val[0].in_depth.ToString(); 
                    this.dxtxtweight.Text = _val[0].in_weight.ToString();
                    this.dxtcarton.Text = _val[0].copies_carton.ToString();  
                    break;
                }
            case 2:
                {
                    this.dxtxtcarttitle.Text = _val[0].book_title != null ? _val[0].book_title.ToString() : "";
                    this.dxtxtside1.Text = _val[0].in_length.ToString();
                    this.dxtxtside2.Text = _val[0].in_width.ToString();
                    this.dxtxtcartdepth.Text = _val[0].in_depth.ToString();
                    this.dxtxtcartweight.Text = _val[0].in_weight.ToString();
                    this.dxtxtcartcopy.Text = _val[0].copies_carton.ToString();  
                    break;
                }
            case 3:
                {
                    this.dxtxttitle3.Text = _val[0].book_title != null ? _val[0].book_title.ToString() : "";
                    this.dxtxtblock1.Text = _val[0].in_length.ToString();
                    this.dxtxtblock2.Text = _val[0].in_width.ToString();
                    this.dxtxtextent.Text = _val[0].in_extent.ToString();
                    //this.dxspinpaper.Text = _val[0].in_papergsm.ToString();
                    this.dxcboPaper.Text = _val[0].in_papergsm.ToString();
                    this.dxckcover.Checked = _val[0].in_hardback;  
                    break;
                }
        }//end switch
    }