Esempio n. 1
0
        private void btn_add_adv_Click(object sender, EventArgs e)
        {
            if (val() == 0)
            {
                {
                    try
                    {
                        SqlConnection con = new SqlConnection(conStr);
                        con.Open();
                        if (con.State == ConnectionState.Open)
                        {
                            string p = "INSERT INTO Advisor(Id, Designation, Salary)VALUES('" + (txt_adv_id.Text).ToString() + "',(SELECT Id FROM Lookup WHERE Lookup.Value = '" + (com_desig.Text) + "'), '" + (txt_adv_sal.Text).ToString() + "');";


                            SqlCommand cmd = new SqlCommand(p, con);
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Data Inserted Successfully");
                        }


                        All_Advisor std = new All_Advisor();
                        this.Hide();
                        std.Show();
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            All_Advisor std = new All_Advisor();

            this.Hide();
            std.Show();
        }
Esempio n. 3
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         if (e.ColumnIndex == 0)
         {
             EditAdvisor edit = new EditAdvisor();
             edit.txt_adv_id.Text  = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
             edit.com_desig.Text   = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
             edit.txt_adv_sal.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
             edit.ShowDialog();
         }
         else if (e.ColumnIndex == 1)
         {
             DeleteAdvisor edit = new DeleteAdvisor();
             edit.txt_adv_id.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
             edit.ShowDialog();
         }
         All_Advisor std = new All_Advisor();
         this.Hide();
         std.Show();
     }
 }
Esempio n. 4
0
 public EditAdvisor(All_Advisor adv, long Id)
 {
     InitializeComponent();
     this.aadv   = adv;
     this.advnum = Id;
 }
Esempio n. 5
0
 public DeleteAdvisor(All_Advisor advdel, long Id)
 {
     InitializeComponent();
     this.aadv   = advdel;
     this.advnum = Id;
 }