private void addAdvisorToolStripMenuItem_Click(object sender, EventArgs e) { Advisor l = Advisor.getInstance(); l.Show(); this.Hide(); }
private void cmd_advisor_Click(object sender, EventArgs e) { Advisor o = new Advisor(); o.Show(); this.Hide(); }
private void advisorToolStripMenuItem1_Click(object sender, EventArgs e) { Advisor a = new Advisor(); a.Show(); this.Hide(); }
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Advisor ad = new Advisor(); this.Hide(); ad.Show(); }
private void button2_Click(object sender, EventArgs e) { Advisor b = new Advisor(); b.Show(); this.Hide(); }
private void button3_Click(object sender, EventArgs e) { Advisor ad = new Advisor(); this.Hide(); ad.Show(); }
private void setGrid() { Advisor.getAdvisors(); advisors = Advisor.Advisors; BindingSource s = new BindingSource(); s.DataSource = advisors; dgvAdvisors.DataSource = s; }
private void setGrid() { Advisor.getAdvisors(); advisors = Advisor.Advisors; BindingSource s = new BindingSource(); s.DataSource = advisors; dgvAdvisors.DataSource = s; dgvAdvisors.AllowUserToAddRows = false; }
public static Advisor getInstance() { if (l == null) { l = new Advisor(); l.Show(); return(l); } else { return(l); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { SqlConnection con = new SqlConnection(AddProject.conStr); con.Open(); if (e.ColumnIndex == 0) { Id = Advisor.Advisors[e.RowIndex].Id1; Advisor advisor = Advisor.Advisors[e.RowIndex]; txtID.Text = advisor.Id1.ToString(); txtSalary.Text = advisor.Salary1.ToString(); cmbDesignation.SelectedIndex = advisor.Designation1 - 6; txtID.ReadOnly = true; Mode = 1; } else if (e.ColumnIndex == 1) { try { int Delete_Id = Advisor.Advisors[e.RowIndex].Id1; string Delete_Project_Advisor = "DELETE FROM ProjectAdvisor WHERE AdvisorId = '" + Delete_Id + "'"; string Delete = "DELETE FROM Advisor WHERE Id = '" + Delete_Id + "'"; if (con.State == ConnectionState.Open) { SqlCommand cmd = new SqlCommand(Delete_Project_Advisor, con); cmd.ExecuteNonQuery(); } if (con.State == ConnectionState.Open) { SqlCommand cmd = new SqlCommand(Delete, con); cmd.ExecuteNonQuery(); } setGrid(); } catch (Exception ex) { MessageBox.Show("Error:" + ex); } } }
private void cmdAddAdvisor_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtadvisorid.Text) && !string.IsNullOrEmpty(txtsalary.Text)) { SqlConnection con = new SqlConnection(conStr); con.Open(); if (con.State == System.Data.ConnectionState.Open) { string Desig = ""; string data; if (cmbDesignation.SelectedIndex == 0) { Desig = "6"; //data = "insert into (Designation , Salary) Values ()" } if (cmbDesignation.SelectedIndex == 1) { Desig = "7"; } if (cmbDesignation.SelectedIndex == 2) { Desig = "8"; } if (cmbDesignation.SelectedIndex == 3) { Desig = "9"; } if (cmbDesignation.SelectedIndex == 4) { Desig = "10"; } data = "insert into Advisor(Id, Designation , Salary) values ( '" + Convert.ToString(txtadvisorid.Text) + "' , '" + Convert.ToInt32(Desig) + "', '" + Convert.ToInt32(txtsalary.Text) + "')"; SqlCommand cmd = new SqlCommand(data, con); try { if (cmd.ExecuteNonQuery() > 0) { MessageBox.Show("Advisor Added in database"); //string show = "select * from OnlyName"; //DataTable table = new DataTable(); //SqlDataAdapter dat = new SqlDataAdapter(show, con); //dat.Fill(table); //dataGridView1.DataSource = table; //cmd.CommandText = "Select @@Identity"; //id = Convert.ToInt32(cmd.ExecuteScalar()); //string InsertStudent = "INSERT INTO Student(Id, RegistrationNo) VALUES('" + id + "','" + Convert.ToString(txtRegNo.Text) + "')"; //SqlCommand sqlCommand = new SqlCommand(InsertStudent, con); //sqlCommand.ExecuteNonQuery() this.Close(); Advisor a = new Advisor(); a.Show(); } } catch (System.Exception ex) { MessageBox.Show("Error is " + ex.ToString()); } } } else { MessageBox.Show("Enter values"); } }
private void button8_Click(object sender, EventArgs e) { Advisor fm2 = new Advisor(); fm2.Show(); }