private void back1_Click(object sender, EventArgs e) { advisors s = new advisors(); this.Hide(); s.Show(); }
private void deladd_Click(object sender, EventArgs e) { if (dataGridadd.SelectedCells.Count != 0) { int rw = dataGridadd.SelectedCells[0].RowIndex; string cmd = string.Format("DELETE FROM Advisor where Id = '{0}'", dataGridadd.Rows[rw].Cells["Id"].Value.ToString()); SqlCommand del = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection()); int count = del.ExecuteNonQuery(); advisors s = new advisors(); this.Hide(); s.Show(); } }
private void saveupadd_Click(object sender, EventArgs e) { advisor p = new advisor(); Regexp(@"^[a-zA-Z]{1,100}", addfnametext, addfnme, "First name"); Regexp(@"^[a-zA-Z]{1,100}", addlnametext, addlnme, "Last name"); Regexp(@"^[0-9]{1,20}", addcontacttxt, adcon, "Contact"); Regexp(@"^([\\w\\.\\-]+)@([\\w\\-]+)((\\.(\\w){2,3})+)$", addemailtext, emailad, "Email"); Regexp(@"^[0-9]{1,30}", addsaltext, saladd, "Salary"); p.FirstName = addfnametext.Text; p.LastName = addlnametext.Text; p.Contact = addcontacttxt.Text; p.Email = addemailtext.Text; p.DateOfBirth = addobtext.Value; p.salary = Convert.ToDecimal(addsaltext.Text); String cmd = String.Format("Select Id from Lookup Where Value = '{0}'", addgendercombo.Text); SqlCommand a = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection()); int Gender; Gender = (Int32)a.ExecuteScalar(); cmd = String.Format("Update Person SET FirstName = '{0}', LastName = '{1}', Contact = '{2}', Email = '{3}', DateOfBirth = '{4}', Gender = '{5}' WHERE Id = '{6}'", p.FirstName, p.LastName, p.Contact, p.Email, p.DateOfBirth, Gender, ide); DatabaseConnection.getInstance().exectuteQuery(cmd); cmd = String.Format("Select Id from Lookup Where Value = '{0}'", degtext.Text); a = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection()); int designation; designation = (Int32)a.ExecuteScalar(); cmd = String.Format("UPDATE Advisor SET Id = '{0}', Designation = '{1}', Salary = '{2}' WHERE Id = '{2}'", ide, designation, p.salary, ide); DatabaseConnection.getInstance().exectuteQuery(cmd); advisors s = new advisors(); this.Hide(); s.Show(); }
private void button3_Click(object sender, EventArgs e) { s.Show(); this.Hide(); }