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";
            }
        }
Example #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Database1Entities4 db = new Database1Entities4();

            string date = Session["ddate"].ToString();
            string iid  = Session["iid"].ToString();

            order_details od = new order_details();

            od.i_id     = Session["iid"].ToString();
            od.cc_id    = Session["ccid"].ToString();
            od.c_id     = Session["cid"].ToString();
            od.o_status = "In Process";
            od.o_date   = Session["ddate"].ToString();
            od.o_cost   = Session["fcost"].ToString();
            db.order_details.Add(od);
            db.SaveChanges();

            // Database1Entities4 db1 = new Database1Entities4();
            Item_DB it  = db.Item_DB.Where(i => i.I_id == iid).FirstOrDefault <Item_DB>();
            int     iq  = it.i_quantity;
            int     niq = iq - 1;

            it.i_quantity = niq;

            db.SaveChanges();
            //Label5.Text = iq.ToString();
            //Label6.Text = niq.ToString();

            Button3.Visible = true;
            Label5.Text     = "Your order place successfully";
            Label6.Text     = "your order id is:" + od.o_id.ToString();
            Button1.Enabled = false;
            Button4.Visible = true;
        }
Example #3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Database1Entities4 db = new Database1Entities4();
            Item_DB            i  = db.Item_DB.Where(it1 => it1.I_id == TextBox1.Text).FirstOrDefault <Item_DB>();

            if (i == null)
            {
                Item_DB it = new Item_DB();
                it.I_id          = TextBox1.Text;
                it.I_name        = TextBox2.Text;
                it.I_description = TextBox3.Text;
                it.cc_id         = TextBox8.Text;
                it.i_cost        = Int32.Parse(TextBox4.Text);
                it.i_discount    = Int32.Parse(TextBox5.Text);
                it.i_status      = TextBox9.Text;
                it.i_quantity    = Int32.Parse(TextBox6.Text);
                it.i_company     = TextBox7.Text;
                it.i_imagepath   = TextBox10.Text;
                db.Item_DB.Add(it);
                db.SaveChanges();

                Label13.Text    = "Item inserted sucessfully";
                Button3.Enabled = true;
                Button4.Enabled = true;
            }
            else
            {
                Label13.Text = "Item ID is already taken for another Item take another one for this";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string             catid = TextBox1.Text;
            Database1Entities4 db    = new Database1Entities4();
            Category           cat   = db.Categories.Where(c => (c.cc_id == catid)).FirstOrDefault <Category>();

            if (cat == null)
            {
                //Label4.Text = "Id can be used";
                Category category = new Category();
                category.cc_id          = TextBox1.Text;
                category.cc_name        = TextBox2.Text;
                category.cc_description = TextBox3.Text;
                db.Categories.Add(category);
                db.SaveChanges();
                Label4.Text = "category inserted sucessfully";
            }
            else
            {
                Label4.Text = "ID is already taken for another category.Try another one";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string             cid = Request.QueryString["Customer"];
            Database1Entities4 db  = new Database1Entities4();
            int           oid      = Int32.Parse(TextBox1.Text);
            order_details od       = db.order_details.Where(o => (o.o_id == oid) && (o.c_id == cid)).FirstOrDefault <order_details>();

            if (od == null)
            {
                Label1.Text = "Can't find any order.Try Again!!";
            }
            else
            {
                Feedback_DB fb = new Feedback_DB();
                fb.c_id     = od.c_id;
                fb.i_id     = od.i_id;
                fb.feedback = TextBox2.Text;
                db.Feedback_DB.Add(fb);
                db.SaveChanges();

                Label1.Text     = od.c_id + " Your feedback send sucessfully";
                Button2.Enabled = true;
            }
        }