Beispiel #1
0
        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            if (IsUpdate)
            {
                //updating the record
                //get customer id out of session
                if (Session["CustomerID"] != null)
                {
                    var id = Convert.ToInt32(Session["CustomerID"]);
                    //get the Authentication object from the manager
                    var auth = MarinaManager.FindAuthentication(id);

                    auth.FirstName = uxFirstName.Text;
                    auth.LastName  = uxLastName.Text;
                    auth.City      = uxCity.Text;
                    auth.Username  = uxUsername.Text;
                    auth.Password  = uxPassword.Text;
                    //pass auth to the manager for updating
                    MarinaManager.UpdateAuthentication(auth);

                    //remove from auth ticket, clear session and redirect
                    FormsAuthentication.SignOut();
                    Session.Clear();
                    Response.Redirect("~/Login");
                }
            }
            else
            {
                //inserting the record
                var auth = new AuthenticationDTO
                {
                    FirstName = uxFirstName.Text,
                    LastName  = uxLastName.Text,
                    Phone     = uxPhone.Text,
                    City      = uxCity.Text
                };
                //pass the auth object to the manager for inserting
                MarinaManager.AddAuthentication(auth);

                Response.Redirect("~/Login");
            }
        }