public HomeDelivary(Salesman_Home shm, string ss)
        {
            InitializeComponent();
            this.shm    = shm;
            label3.Text = ss;
            label5.Hide();

            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 CId,status,totalCost,mobileno FROM Orderdetails");

            SqlCommand s = new SqlCommand(sl, con1);

            SqlDataAdapter dt = new SqlDataAdapter(s);

            dt.Fill(t);
            dataGridView1.DataSource = t;
        }
Beispiel #2
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=D:\C# pro\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 if (l == 8 || l == 9 || l == 10 || l == 11)
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\C# pro\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
            {
                MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
 public PasswordChangeS(Salesman_Home s, string nm)
 {
     InitializeComponent();
     this.s  = s;
     this.nm = nm;
 }