Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string        identi = textBox1.Text;
            SqlConnection con    = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Jahin\Documents\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand    s1 = new SqlCommand("SELECT * FROM Customerinfo where userId = '" + textBox1.Text + "' and password = '******'", con);
            SqlDataReader dt;

            dt = s1.ExecuteReader();
            int c = 0;

            while (dt.Read())
            {
                c += 1;
            }
            if (c == 1)
            {
                ChooseProduct cp = new ChooseProduct(identi);
                cp.Show();
                this.Hide();
            }
            else if (c > 0)
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            textBox1.Text = textBox1.Text;
            textBox2.Clear();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            string a, b;

            a = textBox2.Text;
            b = textBox3.Text;

            if (a.Equals(b))
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Customerinfo where userId = '" + nm + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;
                while (dt.Read())
                {
                    c += 1;
                }
                con.Close();
                if (c == 1)
                {
                    if (a.Equals(b) && a.Length > 0)
                    {
                        SqlConnection con2 = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                        con2.Open();
                        SqlCommand s = new SqlCommand("UPDATE Customerinfo SET  password = '******' where userId = '" + nm + "'", con2);
                        if (s.ExecuteNonQuery() == 1)
                        {
                            MessageBox.Show("Successfully Saved");
                        }
                        else
                        {
                            MessageBox.Show("Error");
                        }
                        con2.Close();
                    }
                    else
                    {
                        MessageBox.Show("Password don't Match", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                else if (c > 0)
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                //MessageBox.Show("Save Changes","Done",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
            }
        }
Пример #3
0
        public MyCart(ChooseProduct cp, string m)
        {
            InitializeComponent();
            this.cp = cp;

            t.Rows.Clear();
            dataGridView1.DataSource = t;
            SqlConnection con1 = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");

            con1.Open();

            string sl = string.Format("SELECT * FROM Orderinfo1 where CId='{0}'", m);

            SqlCommand s = new SqlCommand(sl, con1);

            SqlDataAdapter dt = new SqlDataAdapter(s);

            dt.Fill(t);
            dataGridView1.DataSource = t;
        }
Пример #4
0
        public EditProfile(ChooseProduct p, string m)
        {
            InitializeComponent();
            this.p = p;
            this.m = m;

            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");

            con.Open();
            SqlCommand    s  = new SqlCommand("SELECT * From Customerinfo where userId='" + m + "'", con);
            SqlDataReader dt = s.ExecuteReader();

            while (dt.Read())
            {
                label14.Text  = Convert.ToString(dt["name"]);
                label13.Text  = Convert.ToString(dt["userId"]);
                textBox1.Text = Convert.ToString(dt["mobileNo"]);
                textBox2.Text = Convert.ToString(dt["email"]);
                textBox3.Text = Convert.ToString(dt["Address"]);
                label4.Text   = Convert.ToString(dt["DOB"]);
                label10.Text  = Convert.ToString(dt["gender"]);
                label3.Text   = Convert.ToString(dt["discount"]);
            }
        }
 public PasswordChange(ChooseProduct c, string nm)
 {
     InitializeComponent();
     this.c  = c;
     this.nm = nm;
 }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string identi = textBox1.Text;
            int    l      = textBox1.Text.Length;
            int    l1     = textBox2.Text.Length;

            if (l == 5 || l == 6 || l == 7)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Customerinfo where userId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    ChooseProduct cp = new ChooseProduct(identi);
                    cp.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }

            else if (l == 8 || l == 9 || l == 10 || l == 11)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Salesmaninfo where SId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    Salesman_Home sh = new Salesman_Home(identi);
                    sh.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }
            else if (l == 2 || l == 3 || l == 4)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Lenovo\Desktop\project final\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30");
                con.Open();
                SqlCommand    s1 = new SqlCommand("SELECT * FROM Admininfo where AId = '" + textBox1.Text + "' and password = '******'", con);
                SqlDataReader dt;
                dt = s1.ExecuteReader();
                int c = 0;

                while (dt.Read())
                {
                    c += 1;
                }
                if (c == 1)
                {
                    Admin_Home ah = new Admin_Home(identi);
                    ah.Show();
                    this.Hide();
                }
                else if (c > 0)
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                textBox1.Text = textBox1.Text;
                textBox2.Clear();
            }

            else
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }