Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (shoppingcartV2 == null || shoppingcartV2.Count < 1)   //***EAC I need a shopping cart at this point
            {
                GlobalUtils.Utils.ClearAllSessions();
                Response.Redirect("~/login.aspx", true);
            }
            if (!GlobalUtils.Utils.isLoggedin())
            {  //***EAC I need a logged in user at this point
                GlobalUtils.Utils.ClearAllSessions();
                Response.Redirect("~/login.aspx", true);
            }
            string role = GlobalUtils.Utils.LoggedinRole();

            if (role != "NCIPL_LM")
            {
                throw (new ArgumentException("Your role is not allowed at this point."));
            }
            if (!IsPostBack)
            {
                //NCIPL_CC
                if (GlobalUtils.UserRoles.getLoggedInUserId().Length == 0 || GlobalUtils.UserRoles.getLoggedInUserRole() < 1)
                {
                    string currASPXfilename = System.IO.Path.GetFileName(Request.Path).ToString();
                    Session["NCIPL_REGISTERREFERRER"] = currASPXfilename;
                    Response.Redirect("~/login.aspx?msg=invaliduser&redir=" + currASPXfilename);
                }

                Session["NCIPL_DONE"] = "false";
                steps1.Activate("cell4");

                cc = new CreditCard();  //***EAC Create a dummy credit card object

                lblname.Text    = this.shipto.Fullname;
                lblOrg.Text     = this.shipto.Organization;
                lbladdr1.Text   = this.shipto.Addr1;
                lbladdr2.Text   = this.shipto.Addr2;
                lblcity.Text    = this.shipto.City;
                lblst.Text      = this.shipto.State;
                lblzip.Text     = this.shipto.Zip5 + ((this.shipto.Zip4.Trim() == "") ? "" : "-" + this.shipto.Zip4);
                lblemail.Text   = "E-mail: " + this.shipto.Email;
                lblphone.Text   = "Phone: " + this.shipto.Phone;
                lblcountry.Text = DAL2.DAL.GetCountryByID(shipto.Country);

                lbl2name.Text    = this.billto.Fullname;
                lbl2addr1.Text   = this.billto.Addr1;
                lbl2addr2.Text   = this.billto.Addr2;
                lbl2city.Text    = this.billto.City;
                lbl2st.Text      = this.billto.State;
                lbl2zip.Text     = this.billto.Zip5 + ((this.billto.Zip4.Trim() == "") ? "" : "-" + this.billto.Zip4);
                lbl2email.Text   = "E-mail: " + this.billto.Email;
                lbl2phone.Text   = "Phone: " + this.billto.Phone;
                lbl2org.Text     = this.billto.Organization;
                lbl2country.Text = DAL2.DAL.GetCountryByID(billto.Country);

                if (this.shipto.Organization.Trim().Length < 1)
                {
                    lblOrg.Visible = false;
                }
                if (this.shipto.Addr2.Trim().Length < 1)
                {
                    lbladdr2.Visible = false;
                }
                if (this.shipto.Email.Trim().Length < 1)
                {
                    lblemail.Visible = false;
                }
                if (this.shipto.Phone.Trim().Length < 1)
                {
                    lblphone.Visible = false;
                }

                pnlSplitOrder.Visible = (shoppingcartV2.SplitOrder == "1") ? true : false;

                if (this.billto.Organization.Trim().Length < 1)
                {
                    lbl2org.Visible = false;
                }
                if (this.billto.Addr2.Trim().Length < 1)
                {
                    lbl2addr2.Visible = false;
                }
                if (this.billto.Email.Trim().Length < 1)
                {
                    lbl2email.Visible = false;
                }
                if (this.billto.Phone.Trim().Length < 1)
                {
                    lbl2phone.Visible = false;
                }

                grdItems.DataSource = this.shoppingcartV2;
                grdItems.DataBind();

                lblTotalItems.Text = this.shoppingcartV2.TotalQty.ToString();
                lblCost.Text       = this.shoppingcartV2.ShipCost.ToString("c");

                if (Nerdos.Count > 0)
                {
                    ListNerdos.DataSource = Nerdos;
                    ListNerdos.DataBind();
                    pnlContentDownload.Visible = true;
                }
                //***EAC test the address
                if (shoppingcartV2.ShipMethod == "")
                {
                    USPS(this.shipto);
                }
                else if (shoppingcartV2.ShipMethod[0] == 'F')
                {
                    FEDEX(shipto);
                }
                else if (shoppingcartV2.ShipMethod[0] == 'U')
                {
                    UPS(shipto);
                }

                if (shoppingcartV2.isFree2Order(shipto != null ? shipto.State : ""))
                {
                    //lblCCText.Visible = false;
                    divCost.Visible          = false;
                    divCCExplanation.Visible = false;
                    pnlBillingInfo.Visible   = false;
                    pnlPaymentInfo.Visible   = false;
                    btn2Shipping.Text        = "Change Address";
                    divCCPrompt.Visible      = false;
                }
                else
                {
                    //lblCCText.Visible = true;
                    divCost.Visible          = true;
                    divCCExplanation.Visible = true;
                    pnlBillingInfo.Visible   = true;
                    pnlPaymentInfo.Visible   = false;
                    lblCost.Text             = shoppingcartV2.ShipCost.ToString("c");
                    btn2Shipping.Text        = "Change Addresses or Payment Information";
                    divCCPrompt.Visible      = true;
                }

                //***EAC check if order within the last 30 days
                if (btn2Submit.Enabled == true && ConfigurationManager.AppSettings["AllowCheckRecentOrder"] == "1") //NCIPLCC - Check only if other validations are okay and if web config setting value is 1
                {
                    CheckRecentOrders(this.shipto);
                }

                if (btn2Submit.Enabled == true) //NCIPLCC - Check for No Ship flag, only if other validations are okay
                {
                    CheckNoShipFlag(this.shipto);
                }
            }

            //Display the master page tabs
            GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils();
            if (Session["NCIPL_Pubs"] != null)
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), "");
            }
            else
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", "");
            }
            UtilMethod = null;
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //foreach (object item in Request.Form)
            //{
            //    Response.Write(item.ToString() + "=" + Request.Form[item.ToString()] + "<br>");
            //}

            if (this.shoppingcartV2 == null || this.shoppingcartV2.Count < 1)   //***EAC I need a shopping cart at this point
            {
                ResetSessions();
                Response.Redirect("default.aspx?missingsession=true", true);
            }

            if (!IsPostBack)
            {
                Session["NCIPL_DONE"] = "false";
                steps1.Activate("cell4");

                #region Omniture enable the Submit Order button
                btn2Submit.Attributes.Add("onclick", "NCIAnalytics.CartCompleted();");
                #endregion
                cc = new CreditCard();  //***EAC Create a dummy credit card object

                lblorderdt.Text = System.DateTime.Today.ToShortDateString();

                lblname.Text  = this.shipto.Fullname;
                lblOrg.Text   = this.shipto.Organization;
                lbladdr1.Text = this.shipto.Addr1;
                lbladdr2.Text = this.shipto.Addr2;
                lblcity.Text  = this.shipto.City;
                lblst.Text    = this.shipto.State;
                lblzip.Text   = this.shipto.Zip5 + ((this.shipto.Zip4.Trim() == "") ? "" : "-" + this.shipto.Zip4);
                lblemail.Text = "E-mail: " + this.shipto.Email;
                lblphone.Text = "Phone: " + this.shipto.Phone;


                lbl2name.Text  = this.billto.Fullname;
                lbl2addr1.Text = this.billto.Addr1;
                lbl2addr2.Text = this.billto.Addr2;
                lbl2city.Text  = this.billto.City;
                lbl2st.Text    = this.billto.State;
                lbl2zip.Text   = this.billto.Zip5 + ((this.billto.Zip4.Trim() == "") ? "" : "-" + this.billto.Zip4);
                lbl2email.Text = "E-mail: " + this.billto.Email;
                lbl2phone.Text = "Phone: " + this.billto.Phone;
                lbl2org.Text   = this.billto.Organization;

                if (this.shipto.Organization.Trim().Length < 1)
                {
                    lblOrg.Visible = false;
                }
                if (this.shipto.Addr2.Trim().Length < 1)
                {
                    lbladdr2.Visible = false;
                }
                if (this.shipto.Email.Trim().Length < 1)
                {
                    lblemail.Visible = false;
                }
                if (this.shipto.Phone.Trim().Length < 1)
                {
                    lblphone.Visible = false;
                }

                if (this.billto.Organization.Trim().Length < 1)
                {
                    lbl2org.Visible = false;
                }
                if (this.billto.Addr2.Trim().Length < 1)
                {
                    lbl2addr2.Visible = false;
                }
                if (this.billto.Email.Trim().Length < 1)
                {
                    lbl2email.Visible = false;
                }
                if (this.billto.Phone.Trim().Length < 1)
                {
                    lbl2phone.Visible = false;
                }

                if (!shoppingcartV2.isFree2Order(shipto != null ? shipto.State : ""))
                {
                    pnlPaymentInfo.Visible = true;
                    lblCost.Text           = shoppingcartV2.ShipCost.ToString("c");
                    btn2Shipping.Text      = "Change Addresses or Payment Information";
                    CostRecoveryInd        = "1"; //HITT 8716
                    divCCPrompt.Visible    = true;
                }
                else
                {
                    pnlPaymentInfo.Visible = false;
                    pnlBillingInfo.Visible = false;
                    btn2Shipping.Text      = "Change Address";
                    divCCPrompt.Visible    = false;
                }

                grdItems.DataSource = this.shoppingcartV2;
                grdItems.DataBind();

                lblTotalItems.Text = this.shoppingcartV2.TotalQty.ToString();
                lblCost.Text       = this.shoppingcartV2.ShipCost.ToString("c");

                if (Nerdos.Count > 0)
                {
                    ListNerdos.DataSource = Nerdos;
                    ListNerdos.DataBind();
                    pnlContentDownload.Visible = true;
                }
                //***EAC test the address
                if (shoppingcartV2.ShipMethod == "")
                {
                    USPS(this.shipto);
                }
                else if (shoppingcartV2.ShipMethod[0] == 'F')
                {
                    FEDEX(shipto);
                }
                else if (shoppingcartV2.ShipMethod[0] == 'U')
                {
                    UPS(shipto);
                }


                //***EAC check if order within the last 30 days
                if (ConfigurationManager.AppSettings["AllowCheckRecentOrder"] == "1")
                {
                    CheckRecentOrders(this.shipto);   //***EAC TODO: Enable this line when we go live in SOLAS
                }
                /*Begin HITT 8716*/
                if (string.Compare(CostRecoveryInd, "") == 0)
                {
                    //lblCCText.Visible = false;
                    divCost.Visible          = false;
                    divCCExplanation.Visible = false;
                }
                /*End HITT 8716*/
            }

            //Display the master page tabs
            GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils();
            if (Session["NCIPL_Pubs"] != null)
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), "");
            }
            else
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", "");
            }
            UtilMethod = null;
        }