Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            ManagerProfile m = new ManagerProfile();

            this.Hide();
            m.Show();
        }
Exemplo n.º 2
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (textBox1.Text == "" || textBox2.Text == "" || textBox1.Text == "")
     {
         MessageBox.Show("Please fill the form correctly...");
     }
     else
     {
         if (textBox2.Text.Length == 14)
         {
             string id      = textBox4.Text;
             string name    = textBox1.Text;
             string address = textBox3.Text;
             string phone   = textBox2.Text;
             if (s.UpdateSalesman(id, name, address, phone))
             {
                 MessageBox.Show("Successfully Person Updated");
                 ManagerProfile m = new ManagerProfile();
                 this.Hide();
                 m.Show();
             }
             else
             {
                 MessageBox.Show("Error in creating");
             }
         }
         else
         {
             MessageBox.Show("Please insert Phone number correctly");
         }
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string id       = textBox2.Text;
         string name     = textBox1.Text;
         int    invoice  = int.Parse(textBox4.Text);
         int    sell     = int.Parse(textBox5.Text);
         int    quantity = int.Parse(textBox3.Text);
         if (p.UpdateProduct(id, name, invoice, quantity, sell))
         {
             MessageBox.Show("Successfully Updated");
             ManagerProfile m = new ManagerProfile();
             this.Hide();
             m.Show();
         }
         else
         {
             MessageBox.Show("Error in updating");
         }
     }
     catch
     {
         MessageBox.Show("Please fill the form....");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox5.Text == "")
            {
                MessageBox.Show("Please Fill Up The Form");
            }
            else
            {
                if (textBox2.Text.Length == 14)
                {
                    string phone   = textBox2.Text;
                    string name    = textBox1.Text;
                    string address = textBox3.Text;
                    string nid     = textBox5.Text;


                    string dob    = dateTimePicker1.Value.ToShortDateString();
                    string gender = "";
                    if (radioButton1.Checked == true)
                    {
                        gender = "male";
                    }
                    if (radioButton2.Checked == true)
                    {
                        gender = "female";
                    }


                    if (s.AddSalesman(name, address, nid, phone, dob, gender))
                    {
                        MessageBox.Show("Successfully Person Created");
                    }
                    else
                    {
                        MessageBox.Show("Error in creating");
                    }
                    textBox1.Text = textBox2.Text = textBox3.Text = textBox5.Text = string.Empty;
                    this.Hide();
                    ManagerProfile m = new ManagerProfile();
                    m.Show();
                }
                else
                {
                    MessageBox.Show("Please insert Phone number correctly");
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox3.Text == "" || textBox4.Text == "")
            {
                MessageBox.Show("Please give Id & password");
            }
            else
            {
                s.ID       = textBox4.Text;
                s.Password = textBox3.Text;
                dt         = da.Login(s);



                if (dt.Rows.Count > 0)
                {
                    utype = dt.Rows[0][8].ToString().Trim();
                    if (utype == "M")
                    {
                        id = textBox4.Text;
                        this.Hide();
                        ManagerProfile mda = new ManagerProfile();
                        mda.Show();
                    }
                    else
                    {
                        id = textBox4.Text;
                        this.Hide();
                        Form1 mde = new Form1();
                        mde.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Please enter valid Id & password");
                }
            }
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string id = textBox4.Text;

            if (textBox4.Text == "")
            {
                MessageBox.Show("Nothing to search");
            }
            else
            {
                if (s.DeleteSalesman(id))
                {
                    GridUpdate();
                    MessageBox.Show("Successfully Person deleted");
                    ManagerProfile m = new ManagerProfile();
                    this.Hide();
                    m.Show();
                }
                else
                {
                    MessageBox.Show("Error in deleting");
                }
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "")
         {
             MessageBox.Show("Please select any product");
         }
         else
         {
             DialogResult res = MessageBox.Show("Are You Sure?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (res.Equals(DialogResult.Yes))
             {
                 int invoice = int.Parse(textBox1.Text);
                 if (p.DeleteProduct(invoice))
                 {
                     GridUpdate();
                     MessageBox.Show("Successfully product deleted");
                     ManagerProfile m = new ManagerProfile();
                     this.Hide();
                     m.Show();
                 }
             }
             else
             {
                 dataGridView1.DataSource = p.GetAllProduct();
             }
         }
     }
     catch
     {
         MessageBox.Show("Please give invoice number correctly");
         dataGridView1.DataSource = dt;
     }
     textBox1.Text = string.Empty;
 }