Esempio n. 1
0
 public bool loadname()
 {
     try
     {
         string    key  = comboBox1.Text;
         party     p    = new party();
         DataTable read = new DataTable();
         read = p.getpname(key);
         bool success = false;
         if (read.Rows.Count != 0)
         {
             if (comboBox1.Items.Count != 0)
             {
                 comboBox1.Items.Clear();
             }
             for (int i = 0; i < read.Rows.Count; i++)
             {
                 comboBox1.Items.Add(read.Rows[i]["name"]);
             }
             success = true;
         }
         return(success);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
     return(false);
 }
Esempio n. 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (richTextBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && comboBox2.Text != "" && comboBox1.Text != "")
         {
             party p = new party();
             p.address = richTextBox1.Text;
             p.name    = textBox2.Text;
             p.balance = Convert.ToInt32(textBox3.Text);
             p.contact = textBox4.Text;
             p.city    = comboBox2.SelectedItem.ToString();
             if (comboBox1.Text != "")
             {
                 p.update(comboBox1.Text);
                 clear();
                 button1.Show();
                 Focus();
             }
         }
         else
         {
             MessageBox.Show("PLZ ENTER DATA IN ALL TEXT BOSES", "ERROR");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Esempio n. 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            party p = new party();

            if (comboBox1.Text != "")
            {
                button1.Hide();
                p.search(comboBox1.Text);
                textBox2.Text     = p.name;
                richTextBox1.Text = p.address;
                textBox3.Text     = p.balance.ToString();
                textBox4.Text     = p.contact;
                comboBox2.Text    = p.city;
                button4.Show();
                button2.Show();
            }
        }
Esempio n. 4
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         party p = new party();
         if (comboBox1.Text != "")
         {
             p.del(comboBox1.Text);
             clear();
             button1.Show();
             textBox2.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (richTextBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && comboBox2.Text != "")
            {
                party p = new party();
                p.address = richTextBox1.Text;
                p.name    = textBox2.Text;
                try
                {
                    p.balance = Convert.ToInt32(textBox3.Text);



                    p.contact = textBox4.Text;
                    p.city    = comboBox2.SelectedItem.ToString();

                    if (p.add())
                    {
                        MessageBox.Show("Insertion Successful", "Insertion");
                    }
                    else
                    {
                        MessageBox.Show("Insertion Failed", "Insertion");
                    }
                    clear();
                    textBox2.Focus();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            else
            {
                MessageBox.Show("PLZ ENTER DATA IN ALL TEXT BOXES", "ERROR");
            }
        }