Exemple #1
0
        //Login
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //Matching the name
            MarinaManager newMM     = new MarinaManager();
            var           FirstName = txtFirstName.Text;
            var           LastName  = txtLastName.Text;

            Customer cust = newMM.Authinticate(FirstName, LastName);

            if (cust != null)
            {
                //Creating session
                Session["FullName"]   = FirstName + " " + LastName;
                Session["CustomerID"] = cust.ID;

                FormsAuthentication.RedirectFromLoginPage(FirstName + " " + LastName + " ", false);
                Response.Redirect("~/Secure/LeaseSlip");
            }
            else
            {
                //Error if the user is not registered
                Response.Write("<script>alert('User does not exist, please register first.');</script>");
                //For registering
                txtPhone.Visible  = true;
                txtCity.Visible   = true;
                lblCity.Visible   = true;
                lblPhone.Visible  = true;
                btnSubmit.Visible = true;
            }
        }