Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string             id1 = TextBox1.Text;
            Database1Entities4 db  = new Database1Entities4();
            User_DB            u1  = db.User_DB.Where(us => (us.u_id == id1)).FirstOrDefault <User_DB>();

            if (u1 == null)
            {
                int ag = System.DateTime.Now.Year - Calendar1.SelectedDate.Year;

                User_DB u = new User_DB();
                u.u_id       = TextBox1.Text;
                u.u_password = TextBox2.Text;
                db.User_DB.Add(u);
                db.SaveChanges();

                Customer c = new Customer();
                c.c_id      = TextBox1.Text;
                c.c_name    = TextBox3.Text;
                c.c_dob     = DateTime.Parse(TextBox4.Text);
                c.c_age     = ag;
                c.c_mail    = TextBox5.Text;
                c.c_address = TextBox6.Text;
                c.c_contact = TextBox7.Text;
                db.Customers.Add(c);
                db.SaveChanges();
                Label8.Text = "register sucessfully";
                // Response.Redirect("~/Login.aspx");
                Button2.Visible = true;
            }
            else
            {
                Label8.Text = "This ID is already taken.Try another one";
            }
        }
Exemplo n.º 2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string             id1       = TextBox1.Text;
            string             password1 = TextBox2.Text;
            Database1Entities4 db        = new Database1Entities4();
            User_DB            u         = db.User_DB.Where(us => (us.u_id == id1) && (us.u_password == password1)).FirstOrDefault <User_DB>();

            if (u == null)
            {
                Label3.Text = "ID or Password is Incorrect.Try Again!!";
            }
            else
            {
                Admin a = db.Admins.Where(ad => (ad.a_id == id1)).FirstOrDefault <Admin>();
                if (a == null)
                {
                    Label3.Text = "You Are not registerd as Admin";
                }
                else
                {
                    Session["aid"] = id1;
                    Response.Redirect("~/WelcomeAdmin.aspx");
                }
            }
        }
Exemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string             id       = TextBox1.Text;
            string             password = TextBox2.Text;
            Database1Entities4 db       = new Database1Entities4();
            User_DB            u        = db.User_DB.Where(us => (us.u_id == id) && (us.u_password == password)).FirstOrDefault <User_DB>();

            if (u == null)
            {
                Label3.Text = "ID or Password is Incorrect.Try Again!!";
            }
            else
            {
                Customer c = db.Customers.Where(cs => (cs.c_id == id)).FirstOrDefault <Customer>();
                if (c == null)
                {
                    Label3.Text = "You are not registered as customer";
                }
                else
                {
                    Session["cid"] = id;
                    Response.Redirect("~/WelcomeCus.aspx");
                }
            }
        }
Exemplo n.º 4
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            string             id       = TextBox1.Text;
            string             password = TextBox2.Text;
            Database1Entities4 db       = new Database1Entities4();
            User_DB            u        = db.User_DB.Where(us => (us.u_id == id) && (us.u_password == password)).FirstOrDefault <User_DB>();

            if (u == null)
            {
                Label3.Text = "ID or Password is Incorrect.Try Again!!";
            }
            else
            {
                Session["cid"] = id;
                Response.Redirect("~/Feedback.aspx?Customer=" + id);
            }
        }