コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HandleMenuItems();
            bCurrentCustomer = false;

            if (!string.IsNullOrEmpty(Request.QueryString["current_customer"]))
            {
                bCurrentCustomer = true;
            }

            mCustomer = (PetfirstCustomer)Session["Customer"];
            mthisPet = (Pet)Session["Pet"];
            if (mCustomer == null)
            {
                Response.Redirect("Default.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    if (bCurrentCustomer)
                    {
                        chkInternetDiscount.Checked = mCustomer.DiscountInternetPurchase;
                        MilitaryBlock.Visible = mCustomer.DiscountMilitaryAvailable;
                        chkMilitary.Checked = mCustomer.DiscountMilitarySelected;
                        chkEmployeeGroup.Checked = mCustomer.DiscountEBEnrollmentCode;
                        txtEmployer.Text = mCustomer.EBEnrollmentCodeCompany;
                        VetBlock.Visible = mCustomer.DiscountVetAvailable;
                        chkVetEmp.Checked = mCustomer.DiscountVetSelected;
                        txtEmail.Text = mCustomer.MembershipInfo.Email;
                        load_militarybranches();
                        ddlBranch.SelectedIndex = mCustomer.MilitaryBranchID;
                        load_militarystatus();
                        rblServiceType.SelectedIndex = mCustomer.MilitaryStatusID;
                        bCurrentCustomer = true;

                    }
                    else
                    {
                        chkInternetDiscount.Checked = mCustomer.DiscountInternetPurchase;
                        PetfirstData pfData = new PetfirstData();
                        chkEmployeeGroup.Checked = mCustomer.DiscountEBEnrollmentCode = pfData.IsCorporateDiscount(mCustomer.EnrollmentCode);
                        MilitaryBlock.Visible = mCustomer.DiscountMilitaryAvailable;
                        VetBlock.Visible = mCustomer.DiscountVetAvailable;
                        load_militarystatus();
                        load_militarybranches();
                    }
                }

                this.Master.NumberofPets = mCustomer.MyPets.Count.ToString();
            }
        }