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(); } }
//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(); }
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(); }