Пример #1
0
        //***EAC update count, shipcosts etc
        protected void BindTotals()
        {
            if (Zipcode.isXPO(shipto != null ? shipto.State : ""))
            {
                divCCExplanation.Visible = false;
                lblTot.Text = this.shoppingcart.TotalQty.ToString();
                divOrderingHelp.InnerText = "Please note: We will provide free shipping via U.S. Postal Service for orders up to " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items to your location. We are sorry we cannot send orders of more than " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items or send items via FedEx or UPS to your shipping address.";
            }
            else
            {
                if (shoppingcart.isFree2Order(shipto != null ? shipto.State : ""))
                {
                    divCCExplanation.Visible = false;
                    lblTot.Text = this.shoppingcart.TotalQty.ToString();
                    divOrderingHelp.InnerText = "";
                }
                else
                {
                    divCCExplanation.Visible = true;
                    lblTot.Text = this.shoppingcart.TotalQty.ToString() + " (" + this.shoppingcart.TotalWeight.ToString(".#") + " lbs)<sup>*</sup>";
                    divOrderingHelp.InnerHtml = "Ordering more than 20 items? You will be asked to log in or register, and provide a FedEx or UPS shipping number to pay actual shipping costs. <a href='nciplhelp.aspx#register'>Learn more about registering for an account</a>";
                }
            }

            //Hide or unhide the cart
            if (this.shoppingcart.Count > 0)
            {
                //***EAC at this point we have a usable cart
                Panel1.Visible = true;
                Panel2.Visible = false;
            }
            else//shopping cart is empty
            {
                Panel1.Visible = false;
                Panel2.Visible = true;
            }

            // Enable-disable the submit button (XPO requirement)
            if (shoppingcart.isOrderAllowed(shipto != null ? shipto.State : ""))
            {
                btn2shipping.Enabled = true;
                divOrderingHelp.Attributes["style"] = "text-align: left; padding-bottom: 10px;";
            }
            else
            {
                btn2shipping.Enabled = false;
                divOrderingHelp.Attributes["style"] = "text-align: left; padding-bottom: 10px; color: #FF0000";
            }
            //Display the master page tabs
            GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils();
            if (Session["NCIPL_Pubs"] != null)
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), "cart");
            }
            else
            {
                Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", "cart");
            }
            UtilMethod = null;
        }
Пример #2
0
        //***EAC update count, shipcosts etc
        protected void BindTotals(string state)
        {
            if (Zipcode.isXPO(state))
            {
                HideBillingItems();
            }
            else
            {
                ShowBillingItems();
            }

            //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;
        }
Пример #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region Toggle Billing Validators
            if (chkSameaddress.Checked)
            {
                RequiredFieldValidator9.Enabled  = false;
                RequiredFieldValidator10.Enabled = false;
                RequiredFieldValidator11.Enabled = false;
                RequiredFieldValidator12.Enabled = false;
                RequiredFieldValidator14.Enabled = false;
                RequiredFieldValidator16.Enabled = false;
                RequiredFieldValidator17.Enabled = false;

                RegularExpressionValidator2.Enabled = false;
                RegularExpressionValidator4.Enabled = false;
            }
            else
            {
                RequiredFieldValidator9.Enabled  = true;
                RequiredFieldValidator10.Enabled = true;
                RequiredFieldValidator11.Enabled = true;
                RequiredFieldValidator12.Enabled = true;
                RequiredFieldValidator14.Enabled = true;
                RequiredFieldValidator16.Enabled = true;
                RequiredFieldValidator17.Enabled = true;

                RegularExpressionValidator2.Enabled = true;
                RegularExpressionValidator4.Enabled = true;
            }
            #endregion

            if (Page.IsValid)
            {
                //*** EAC We passed .Net validation so now just
                //*** validate the lengths so AppScan doesn't get angry
                if (txtzip5.Text.Length + txtzip4.Text.Length + txtcity.Text.Length + txtstate.Text.Length +
                    txtname.Text.Length + txtorg.Text.Length + txtaddr1.Text.Length + txtaddr2.Text.Length + txtphone.Text.Length + txtemail.Text.Length > 220)
                {
                    throw (new ArgumentOutOfRangeException("Shipping object is too big"));
                }

                if (txt2zip5.Text.Length + txt2zip4.Text.Length + txt2city.Text.Length + txt2state.Text.Length +
                    txt2name.Text.Length + txt2org.Text.Length + txt2addr1.Text.Length + txt2addr2.Text.Length + txt2phone.Text.Length + txt2email.Text.Length > 220)
                {
                    throw (new ArgumentOutOfRangeException("Billing object is too big"));
                }

                //***EAC At this point, data looks clean
                this.shipto = new Person(1, txtname.Text, txtorg.Text, txtemail.Text, txtaddr1.Text, txtaddr2.Text, (txtcity.Visible == true ? txtcity.Text : drpcity.SelectedValue), txtstate.Text, txtzip5.Text, txtzip4.Text, txtphone.Text);
                //this.cc = new CreditCard(drpcard.SelectedValue, txtccnum.Text, drpmonth.SelectedValue, drpyr.SelectedValue, txtcvv2.Text, this.cc.Cost, drpcard.SelectedValue );
                if (chkSameaddress.Checked)
                {
                    this.billto = this.shipto;
                }
                else
                {
                    this.billto = new Person(1, txt2name.Text, txt2org.Text, txt2email.Text, txt2addr1.Text, txt2addr2.Text, (txt2city.Visible == true ? txt2city.Text : drpcity2.SelectedValue), txt2state.Text, txt2zip5.Text, txt2zip4.Text, txt2phone.Text);
                }

                if (!UserExists(txtUserName.Text.ToString()))
                {
                    //*** Update PubEnt Registration table
                    bool retSaveRegistration = DAL.DAL.SaveRegistration(txtUserName.Text, shipto, billto, -1);  //***EAC typeofcustomerid is now ignored

                    if (retSaveRegistration)
                    {
                        //*** Create user in GUAM
                        try
                        {
                            new UserServiceClient().Using(client =>
                            {
                                ReturnObject ro;

                                //*** Add a new user
                                ro = client.AddUser(txtUserName.Text.ToString());
                                if (ro.ReturnCode != 0)
                                {
                                    RemoveUser();
                                    lblGuamMsg.Text    = ro.DefaultErrorMessage;
                                    lblGuamMsg.Visible = true;
                                }
                                else
                                {
                                    lblGuamMsg.Text    = "";
                                    lblGuamMsg.Visible = false;
                                    //*** Set User Email
                                    ro = client.SetUserMetaData(txtUserName.Text.ToString(), "Email", txtUserName.Text.ToString());

                                    //*** Generate Password
                                    ro            = client.GeneratePassword(txtUserName.Text.ToString());
                                    string newpwd = ro.ReturnValue.ToString();

                                    //*** Assign Password
                                    ro = client.AssignPassword(txtUserName.Text.ToString(), newpwd);

                                    //*** Set questions and answer
                                    UserQuestion[] questions_answer  = new UserQuestion[1];
                                    questions_answer[0]              = new UserQuestion();
                                    questions_answer[0].QuestionText = ddlQuestions.SelectedItem.Text;
                                    questions_answer[0].Answer       = txtAnswer.Text;
                                    ro = client.SetUserQuestionsAndAnswers(txtUserName.Text.ToString(), questions_answer);

                                    //*** Add User to Role
                                    ro = client.AddUserToRole(txtUserName.Text.ToString(), "NCIPL_PUBLIC");

                                    //*** Registration Complete
                                    divUserReg.Visible             = false;
                                    divUserRegConfirmation.Visible = true;
                                    lblRegUserName.Text            = txtUserName.Text;
                                    lblRegPassword.Text            = newpwd;

                                    if (Zipcode.isXPO(txtstate.Text))
                                    {
                                        lblXPO.Text = "Please note: We will provide free shipping via U.S. Postal Service for orders up to " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items to your location. We are sorry we cannot send orders of more than " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items or send items via FedEx or UPS to your shipping address.";
                                    }
                                    Session["NCIPL_User"] = txtUserName.Text;
                                }
                            });
                        }
                        catch
                        {
                            RemoveUser();
                            divUserRegConfirmation.Visible = false;
                            lblGuamMsg.Text    = GuamErrorMsg;
                            lblGuamMsg.Visible = true;
                        }
                    }
                    else
                    {
                        divUserRegConfirmation.Visible = false;
                        lblGuamMsg.Text    = PubEntErrorMsg;
                        lblGuamMsg.Visible = true;
                    }
                }
                else
                {
                    divUserRegConfirmation.Visible = false;
                    lblGuamMsg.Text    = "You already have an account with us. Please login with your username and password or select the option to reset your password.";
                    lblGuamMsg.Visible = true;
                }
            }
        }
Пример #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            #region Toggle Billing Validators
            if (chkSameaddress.Checked)
            {
                RequiredFieldValidator9.Enabled  = false;
                RequiredFieldValidator10.Enabled = false;
                RequiredFieldValidator11.Enabled = false;
                RequiredFieldValidator12.Enabled = false;
                RequiredFieldValidator14.Enabled = false;
                RequiredFieldValidator16.Enabled = false;
                RequiredFieldValidator17.Enabled = false;

                RegularExpressionValidator2.Enabled = false;
                RegularExpressionValidator4.Enabled = false;
            }
            else
            {
                RequiredFieldValidator9.Enabled  = true;
                RequiredFieldValidator10.Enabled = true;
                RequiredFieldValidator11.Enabled = true;
                RequiredFieldValidator12.Enabled = true;
                RequiredFieldValidator14.Enabled = true;
                RequiredFieldValidator16.Enabled = true;
                RequiredFieldValidator17.Enabled = true;

                RegularExpressionValidator2.Enabled = true;
                RegularExpressionValidator4.Enabled = true;
            }
            #endregion

            if (Page.IsValid)
            {
                //*** EAC We passed .Net validation so now just
                //*** validate the lengths so AppScan doesn't get angry
                if (txtzip5.Text.Length + txtzip4.Text.Length + txtcity.Text.Length + txtstate.Text.Length +
                    txtname.Text.Length + txtorg.Text.Length + txtaddr1.Text.Length + txtaddr2.Text.Length + txtphone.Text.Length + txtemail.Text.Length > 220)
                {
                    throw (new ArgumentOutOfRangeException("Shipping object is too big"));
                }

                if (txt2zip5.Text.Length + txt2zip4.Text.Length + txt2city.Text.Length + txt2state.Text.Length +
                    txt2name.Text.Length + txt2org.Text.Length + txt2addr1.Text.Length + txt2addr2.Text.Length + txt2phone.Text.Length + txt2email.Text.Length > 220)
                {
                    throw (new ArgumentOutOfRangeException("Billing object is too big"));
                }

                //***EAC At this point, data looks clean
                this.shipto = new Person(1, txtname.Text, txtorg.Text, txtemail.Text, txtaddr1.Text, txtaddr2.Text, (txtcity.Visible == true ? txtcity.Text : drpcity.SelectedValue), txtstate.Text, txtzip5.Text, txtzip4.Text, txtphone.Text);
                //this.cc = new CreditCard(drpcard.SelectedValue, txtccnum.Text, drpmonth.SelectedValue, drpyr.SelectedValue, txtcvv2.Text, this.cc.Cost, drpcard.SelectedValue );
                if (chkSameaddress.Checked)
                {
                    this.billto = this.shipto;
                }
                else
                {
                    this.billto = new Person(1, txt2name.Text, txt2org.Text, txt2email.Text, txt2addr1.Text, txt2addr2.Text, (txt2city.Visible == true ? txt2city.Text : drpcity2.SelectedValue), txt2state.Text, txt2zip5.Text, txt2zip4.Text, txt2phone.Text);
                }

                //*** Update PubEnt Registration table
                bool retSaveRegistration = DAL.DAL.UpdateRegistration(Session["NCIPL_User"].ToString(), shipto, billto);

                if (retSaveRegistration)
                {
                    //*** Update Registration Complete
                    divUserReg.Visible             = false;
                    divUserRegConfirmation.Visible = true;
                    if (Zipcode.isXPO(txtstate.Text))
                    {
                        lblXPO.Text = "Please note: We will provide free shipping via U.S. Postal Service for orders up to " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items to your location. We are sorry we cannot send orders of more than " + PubEnt.GlobalUtils.Const.XPOMaxQuantity.ToString() + " items or send items via FedEx or UPS to your shipping address.";
                    }
                }
                else
                {
                    divUserRegConfirmation.Visible = false;
                    lblGuamMsg.Text    = PubEntErrorMsg;
                    lblGuamMsg.Visible = true;
                }
            }
        }