예제 #1
0
파일: Order.cs 프로젝트: cmol/cinemaxxx
 public override string ToString()
 {
     DataMaster user = new User();
     user.id = Convert.ToInt32(this.read("usid"));
     user.get();
     DataMaster show = new Show();
     show.id = Convert.ToInt32(this.read("shid"));
     show.get();
     return this.id.ToString() + " " + user.ToString() + " - " + show;
 }
예제 #2
0
 protected void loginDo(object sender, System.EventArgs e)
 {
     User currentUser = new User();
     User tmp = new User();
     currentUser = tmp.Login(((TextBox)ticketOrder.FindControl("loginEmail")).Text, ((TextBox)ticketOrder.FindControl("loginPasswd")).Text);
     LoginHelper.drawByAuthenticated((PlaceHolder)Master.FindControl("loginBox"));
     if (currentUser != null) {
         Order order = (Order) Session["tmpOrder"];
         doOrder(order);
     }
     else {
         ticketOrder.Controls.Add(new LiteralControl("Login failed"));
     }
 }
예제 #3
0
        protected void createUser(object sender, System.EventArgs e)
        {
            // Starts with lots of input validation
            TextBox[] checks = {fname, lname, phone, email, human, passwd, passwdAgain};
            TextBox[] lenChecks = {phone, email, passwd};
            bool notFilled = false, pwNoMatch = false, toShort = false, notHuman = false;

            foreach (TextBox check in checks) {
                if (check.Text.Length < 1) {
                    notFilled = true;
                    break;
                }
            }

            foreach (TextBox check in lenChecks) {
                if (check.Text.Length < 4) {
                    notFilled = true;
                    break;
                }
            }

            if (passwd.Text != passwdAgain.Text) pwNoMatch = true;
            if (human.Text.ToLower() != "yes") notHuman = true;

            if (notFilled || pwNoMatch || toShort || notHuman) { // There are errors in input, show them
                errors.Controls.Clear();
                if (notFilled) errors.Controls.Add(new LiteralControl("You need to fill out all of the items<br />"));
                if (pwNoMatch) errors.Controls.Add(new LiteralControl("The two passwords do not match<br />"));
                if (toShort) errors.Controls.Add(new LiteralControl("Some input is to short<br />"));
                if (notHuman) errors.Controls.Add(new LiteralControl("Sorry, you are not human!<br />"));

            }
            else { // This is where we try to save the user data
                User user = new User();
                user.write("fname", fname.Text);
                user.write("lname", lname.Text);
                user.write("phone", phone.Text);
                user.write("email", email.Text);
                user.write("passwd", passwd.Text);
                user.insert();
                Session["UserToken"] = user;
                Response.Redirect("Default.aspx");
            }
        }
예제 #4
0
 protected void loginDo(object sender, System.EventArgs e)
 {
     if (Session["UserToken"] != null) {
         Session["UserToken"] = null;
         LoginHelper.drawByAuthenticated(loginBox);
         System.Web.HttpContext.Current.Response.Redirect("Default.aspx");
     }
     else {
         User currentUser = new User();
         User tmp = new User();
         currentUser = tmp.Login(((TextBox)loginBox.FindControl("loginEmail")).Text, ((TextBox)loginBox.FindControl("loginPasswd")).Text);
         if (currentUser != null) {
             LoginHelper.drawByAuthenticated(loginBox);
             System.Web.HttpContext.Current.Response.Redirect("Default.aspx");
         }
         else {
             loginBox.Controls.Add(new LiteralControl("Login failed!"));
         }
     }
 }