Ejemplo n.º 1
0
        protected void Register_ServerClick(object sender, EventArgs e)
        {
            if (Password.Value.ToString().Equals(Password1.Value.ToString()))
            {
                String Year;
                if (form1.Checked)
                {
                    Year = "Freshman";
                }
                else if (form2.Checked)
                {
                    Year = "Sophomore";
                }
                else if (form3.Checked)
                {
                    Year = "Junior";
                }
                else if (form4.Checked)
                {
                    Year = "Senior";
                }
                else
                {
                    Year = "None";
                }
                try
                {
                    Database.Register.RegisterAccount(Name.Value.ToString(), description.Value.ToString(), Password.Value.ToString(), email.Value.ToString(), phone.Value.ToString(), Year);

                    Cookies.WriteCookie((Database.HelloWorldQueryMethods.GenerateNewProfileID() - 1).ToString(), this.Response);
                    Response.Redirect("MainPage.aspx");
                }
                catch
                {
                    Error_Flag.Visible   = true;
                    Error_Flag.InnerText = "This email is already in use.";
                }
            }
            else
            {
                Error_Flag.Visible   = true;
                Error_Flag.InnerText = "Passwords do not match.";
            }
        }
Ejemplo n.º 2
0
        protected void Login_Click(object sender, EventArgs e)
        {
            String inEmail = email.Value.ToString();
            String inPass  = Password.Value.ToString();

            if (inEmail != null && inPass != null)
            {
                if (LoginCheck.Login(inEmail, inPass))
                {
                    DataTable output = Database.Query.ExecuteReturnCommand("select ID from Accounts WHERE Email = '" + inEmail + "';");
                    Cookies.WriteCookie(output.Rows[0].ItemArray[0].ToString(), this.Response);
                    Response.Redirect("MainPage.aspx");
                }
                else
                {
                    Error_Flag.Visible = true;
                }
            }
        }