Exemple #1
0
    protected void LinkButtonUserAddr_Click(object sender, EventArgs e)
    {
        MultiViewUserAddr.ActiveViewIndex = 0;

        //Disable User profile
        MultiViewUserChoice.ActiveViewIndex = -1;

        //To check customer has already a Shipping address or not
        cust.MyId = id;

        cust.DisplayCustomerData();

        cust.CheckShipAddr();

        if (custMpData.ShowCustIdentity().Count == 0)
        {
            MultiViewUserAddr.ActiveViewIndex = 2;
        }

        else
        {
            RptUserAddr.DataSource = custMpData.ShowCustIdentity();

            RptUserAddr.DataBind();
        }
    }
Exemple #2
0
    //If Customer has already addresses
    protected void ButtonUserAddrSave_Click(object sender, EventArgs e)
    {
        //If all controls aren't valid
        if (!Page.IsValid)
        {
            return;
        }

        //If all controls are valid, proceed the underneath code

        string fullAddr = String.Concat(TboxLine1.Text, " ", TboxLine2.Text).Trim();

        //Set the objects properties
        cust.CustShippAddr = fullAddr;

        cust.CustShipCountry = DropDownListUserCountry.SelectedItem.Text;

        cust.CustShipState = DropDownListUserState.SelectedItem.Text;

        cust.CustShipCity = TboxCity.Text;

        cust.CustShipPinCode = Convert.ToInt32(TboxPinCode.Text);

        cust.MyId = id;

        // save info into Database at the paricular AddressId
        //Of the customer
        cust.SaveShipAddr(Convert.ToInt32(ButtonUserAddrSave.CommandArgument));

        //Fetch from database
        cust.DisplayCustomerData();

        cust.CheckShipAddr();

        //Update the ManipulateCustom obj
        custMpData = cust.ShowCustManupulatedData();

        //Store updated Customer Obj in ViewState
        // ViewState["Customer"] = cust;

        //Sore updated Manupulated Obj in ViewState
        ViewState["CustManupData"] = custMpData;

        //Fect the Dicitionary Obj & Update the Repeater
        RptUserAddr.DataSource = custMpData.ShowCustIdentity();

        RptUserAddr.DataBind();

        //Switch to 1st tab
        MultiViewUserAddr.ActiveViewIndex = 0;

        //Update UI
        ShowDisplayedData();
    }
Exemple #3
0
    protected void BtnShipNewAddrSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        //If all controls are valid, proceed the underneath code

        string fullAddr = String.Concat(TBoxNewAddrLine1.Text, TBoxNewAddrLine2.Text).Trim();

        //Set the objects properties
        cust.CustShippAddr = fullAddr;

        cust.CustShipCountry = ListShipNewCountry.SelectedItem.Text;

        cust.CustShipState = ListShipNewState.SelectedItem.Text;

        cust.CustShipCity = TBoxNewAddrCity.Text;

        cust.CustShipPinCode = Convert.ToInt32(TBoxNewAddrPinCode.Text);

        cust.MyId = id;
        // save info into Database
        cust.SaveShipNewAddr();

        //Fetch from database
        cust.DisplayCustomerData();

        cust.CheckShipAddr();

        //Update the ManipulateCustom obj
        custMpData = cust.ShowCustManupulatedData();

        //Sore updated Manupulated Obj in ViewState
        ViewState["CustManupData"] = custMpData;

        //Fect the Dicitionary Obj & Update the Repeater
        RptUserAddr.DataSource = custMpData.ShowCustIdentity();

        RptUserAddr.DataBind();

        //Switch to 1st tab
        MultiViewUserAddr.ActiveViewIndex = 0;

        //Update UI
        ShowDisplayedData();
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Display user info
        cust = new Customer();
        if (!this.IsPostBack)
        {
            userSelectionTab = Request.QueryString["TabSelection"];

            if (cust.CheckCookie())
            {
                //Store customer in view state

                ViewState["CustId"] = cust.MyId;

                cust.DisplayCustomerData();

                cust.CheckShipAddr();

                custMpData = cust.ShowCustManupulatedData();

                custMpData.ShowCustIdentity();

                ShowDisplayedData();

                //Check for clicked links i.e User Profile or User Address tab

                switch (userSelectionTab)
                {
                case "Profile":
                    //To set the Multiview property
                    LinkButtonUserProf_Click(LinkButtonUserProf, null);
                    break;

                case "Addr":
                    LinkButtonUserAddr_Click(LinkButtonUserAddr, null);
                    break;

                case "Order":
                    LinkButtonuserOrdered_Click(LinkButtonuserOrdered, null);
                    break;
                }
            }

            else
            {
                Response.Redirect("~/UserAccount/Login.aspx");
            }

            //This function will add the Country and state
            //In the dropdown List
            AddCountryList();
        }

        if (this.IsPostBack)
        {
            //Retreive CustId
            id = (int)ViewState["CustId"];
            //    cust = (Customer)ViewState["Customer"];

            //Retreive CustManupulated Obj
            custMpData = (ManipulateCustomerData)ViewState["CustManupData"];
        }
    }