コード例 #1
0
        protected void SetContextToNewCustomer()
        {
            SearchCustomerPanel.Visible = false;
            CustomerIDPanel.Visible     = false;

            CustomerID.Text = String.Empty;
            FirstName.Text  = String.Empty;
            LastName.Text   = String.Empty;
            EMail.Text      = String.Empty;
            Phone.Text      = String.Empty;
            RadioButtonList1.SelectedIndex = 0;
            Over13.Checked = true;

            BillingFirstName.Text = String.Empty;
            BillingLastName.Text  = String.Empty;
            BillingPhone.Text     = String.Empty;
            BillingCompany.Text   = String.Empty;
            BillingResidenceType.ClearSelection();
            BillingResidenceType.SelectedIndex = 1;
            BillingAddress1.Text = String.Empty;
            BillingAddress2.Text = String.Empty;
            BillingSuite.Text    = String.Empty;
            BillingCity.Text     = String.Empty;
            BillingState.ClearSelection();
            BillingState.SelectedIndex = 0;
            BillingZip.Text            = String.Empty;
            BillingCountry.ClearSelection();
            BillingCountry.SelectedIndex = 0;

            ShippingFirstName.Text = String.Empty;
            ShippingLastName.Text  = String.Empty;
            ShippingPhone.Text     = String.Empty;
            ShippingCompany.Text   = String.Empty;
            ShippingResidenceType.ClearSelection();
            ShippingResidenceType.SelectedIndex = 1;
            ShippingAddress1.Text = String.Empty;
            ShippingAddress2.Text = String.Empty;
            ShippingSuite.Text    = String.Empty;
            ShippingCity.Text     = String.Empty;
            ShippingCountry.ClearSelection();
            ShippingCountry.SelectedIndex = -1;
            ShippingState.ClearSelection();
            ShippingState.SelectedIndex = -1;
            ShippingZip.Text            = String.Empty;

            try
            {
                AffiliateList.SelectedIndex = -1;
                AffiliateList.ClearSelection();
            }
            catch { }
            try
            {
                CustomerLevelList.SelectedIndex = -1;
                CustomerLevelList.ClearSelection();
            }
            catch { }

            CreateCustomer.Visible         = true;
            UseCustomer.Visible            = false;
            UpdateCustomer.Visible         = false;
            CreateNewCustomerPanel.Visible = true;
            CustomerStatsPanel.Visible     = false;
            ImpersonationPanel.Visible     = false;
            Panel3.Visible = false;
            Panel2.Visible = false;
        }
コード例 #2
0
        protected void SetContextToCustomerID(int iCustomerID)
        {
            CustomerID.Text = iCustomerID.ToString();
            using (SqlConnection conn = DB.dbConn())
            {
                conn.Open();
                using (IDataReader rs = DB.GetRS("select * from Customer  with (NOLOCK)  where deleted=0 and IsAdmin=0 and CustomerID=" + iCustomerID.ToString(), conn))
                {
                    if (rs.Read())
                    {
                        FirstName.Text = DB.RSField(rs, "FirstName");
                        LastName.Text  = DB.RSField(rs, "LastName");
                        EMail.Text     = DB.RSField(rs, "EMail").ToLowerInvariant().Trim();
                        Phone.Text     = DB.RSField(rs, "Phone");
                        Over13.Checked = DB.RSFieldBool(rs, "Over13Checked");
                        RadioButtonList1.SelectedIndex = CommonLogic.IIF(DB.RSFieldBool(rs, "OkToEMail"), 0, 1);

                        Address BillingAddress = new Address();
                        BillingAddress.LoadByCustomer(iCustomerID, AddressTypes.Billing);
                        BillingFirstName.Text = BillingAddress.FirstName;
                        BillingLastName.Text  = BillingAddress.LastName;
                        BillingPhone.Text     = BillingAddress.Phone;
                        BillingCompany.Text   = BillingAddress.Company;
                        try
                        {
                            BillingResidenceType.ClearSelection();
                            if (BillingAddress.ResidenceType != ResidenceTypes.Unknown)
                            {
                                BillingResidenceType.Items.FindByValue(((int)BillingAddress.ResidenceType).ToString()).Selected = true;
                            }
                        }
                        catch { }
                        BillingAddress1.Text = BillingAddress.Address1;
                        BillingAddress2.Text = BillingAddress.Address2;
                        BillingSuite.Text    = BillingAddress.Suite;
                        BillingCity.Text     = BillingAddress.City;
                        try
                        {
                            BillingState.SelectedIndex = -1;
                            BillingState.ClearSelection();
                            BillingState.Items.FindByValue(BillingAddress.State).Selected = true;
                        }
                        catch { }
                        BillingZip.Text = BillingAddress.Zip;
                        try
                        {
                            BillingCountry.SelectedIndex = -1;
                            BillingCountry.ClearSelection();
                            BillingCountry.Items.FindByValue(BillingAddress.Country).Selected = true;
                        }
                        catch { }

                        Address ShippingAddress = new Address();
                        ShippingAddress.LoadByCustomer(iCustomerID, AddressTypes.Shipping);
                        ShippingFirstName.Text = ShippingAddress.FirstName;
                        ShippingLastName.Text  = ShippingAddress.LastName;
                        ShippingPhone.Text     = ShippingAddress.Phone;
                        ShippingCompany.Text   = ShippingAddress.Company;
                        try
                        {
                            ShippingResidenceType.ClearSelection();
                            if (ShippingAddress.ResidenceType != ResidenceTypes.Unknown)
                            {
                                ShippingResidenceType.Items.FindByValue(((int)ShippingAddress.ResidenceType).ToString()).Selected = true;
                            }
                        }
                        catch { }
                        ShippingAddress1.Text = ShippingAddress.Address1;
                        ShippingAddress2.Text = ShippingAddress.Address2;
                        ShippingSuite.Text    = ShippingAddress.Suite;
                        ShippingCity.Text     = ShippingAddress.City;
                        try
                        {
                            ShippingState.SelectedIndex = -1;
                            ShippingState.ClearSelection();
                            ShippingState.Items.FindByValue(ShippingAddress.State).Selected = true;
                        }
                        catch { }
                        ShippingZip.Text = ShippingAddress.Zip;
                        try
                        {
                            ShippingCountry.SelectedIndex = -1;
                            ShippingCountry.ClearSelection();
                            ShippingCountry.Items.FindByValue(ShippingAddress.Country).Selected = true;
                        }
                        catch { }
                        try
                        {
                            AffiliateList.SelectedIndex = -1;
                            AffiliateList.ClearSelection();
                            AffiliateList.Items.FindByValue(DB.RSFieldInt(rs, "AffiliateID").ToString()).Selected = true;
                        }
                        catch { }
                        try
                        {
                            CustomerLevelList.SelectedIndex = -1;
                            CustomerLevelList.ClearSelection();
                            CustomerLevelList.Items.FindByValue(DB.RSFieldInt(rs, "CustomerLevelID").ToString()).Selected = true;
                        }
                        catch { }
                    }
                }
            }
        }