Esempio n. 1
0
        private void label5_Click(object sender, EventArgs e)
        {
            AdvisorHome adv = new AdvisorHome();

            this.Hide();
            adv.Show();
        }
Esempio n. 2
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            AdvisorHome adv = new AdvisorHome();

            this.Hide();
            adv.Show();
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int           key   = Convert.ToInt32(textBox1.Text);
                String        str   = "Data Source=HAIER-PC\\NIMRASQLSERVER;Initial Catalog=ProjectA;Integrated Security=True";
                String        query = "Update Advisor Set Designation = (select Id from Lookup where Lookup.Value ='" + comboBox1.Text + "'),Salary=('" + Convert.ToDecimal(textBox2.Text) + "')where Id = '" + Convert.ToInt32(textBox1.Text) + "';";
                SqlConnection con   = new SqlConnection(str);
                SqlCommand    cmd   = new SqlCommand(query, con);
                con.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Data Updated");


                con.Close();
                panel1.Hide();
                AdvisorHome ne = new AdvisorHome();
                this.Hide();
                ne.Show();
            }
            catch (Exception es)
            {
                MessageBox.Show(es.Message);
            }
        }
Esempio n. 4
0
 private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         //label1.Show();
         //label2.Show();
         //label3.Show();
         //textBox1.Show();
         //textBox2.Show();
         //comboBox1.Show();
         String        str = "Data Source=HAIER-PC\\NIMRASQLSERVER;Initial Catalog=ProjectA;Integrated Security=True";
         SqlConnection con = new SqlConnection(str);
         con.Open();
         if (e.RowIndex >= 0 && e.ColumnIndex == 4)
         {
             DataGridViewRow row   = this.dataGridView1.Rows[e.RowIndex];
             String          query = "Delete from ProjectAdvisor where AdvisorId = '" + row.Cells[0].Value + "';";
             SqlCommand      cmd   = new SqlCommand(query, con);
             cmd.ExecuteNonQuery();
             String     query1 = "Delete from Advisor where Id = '" + row.Cells[0].Value + "';";
             SqlCommand cmd1   = new SqlCommand(query1, con);
             cmd1.ExecuteNonQuery();
             MessageBox.Show("Advisor is deleted");
             AdvisorHome ne = new AdvisorHome();
             this.Hide();
             ne.Show();
         }
         if (e.RowIndex >= 0 && e.ColumnIndex == 3)
         {
             //Edit_Advisor edit = new Edit_Advisor();
             panel1.Show();
             textBox1.Text  = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
             textBox2.Text  = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
             comboBox1.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
             //edit.Show();
         }
     }
     catch (Exception es)
     {
         MessageBox.Show(es.Message);
     }
 }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try

            {
                String        str   = "Data Source=HAIER-PC\\NIMRASQLSERVER;Initial Catalog=ProjectA;Integrated Security=True";
                String        query = "INSERT INTO Advisor (Id,Designation,Salary)VALUES(('" + Convert.ToInt32(textBox2.Text) + "'),(select Id from Lookup where Lookup.Value ='" + comboBox1.Text + "'),('" + Convert.ToDecimal(textBox1.Text) + "'));";
                SqlConnection con   = new SqlConnection(str);
                SqlCommand    cmd   = new SqlCommand(query, con);
                con.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Data insert");


                con.Close();
                AdvisorHome showad = new AdvisorHome();
                this.Hide();
                showad.Show();
            }
            catch (Exception es)
            {
                MessageBox.Show(es.Message);
            }
        }