private void button3_Click(object sender, EventArgs e) { con.Open(); Equipments c1 = new Equipments(); string name = combname.Text; c1.delete1(name); con.Close(); }
private void button1_Click(object sender, EventArgs e) { con.Open(); #region paramter Equipments c1 = new Equipments(); string name = combname.Text; #endregion dgv_search_cust.DataSource = c1.search1(name); con.Close(); }
public displayequip() { InitializeComponent(); con.Open(); #region paramter Equipments c1 = new Equipments(); #endregion dgv_display_equip.DataSource = c1.display1(); con.Close(); }
public void edit1(Equipments c1, string n) { try { #region Paramters SqlCommand cmd; #endregion con.Open(); cmd = new SqlCommand("update Equipments set equip_Name='" + c1.Name + "', Counts='" + c1.count + "', halls_id='" + c1.hall_id + "', [Kind of equip_exer_id]='" + c1.kind_of_exer_id + "'where equip_Name='" + n + "'", con); cmd.ExecuteNonQuery(); MessageBox.Show("Your Update was sucsessful"); con.Close(); } catch (Exception) { MessageBox.Show("Please check Name "); } }
public void add1(Equipments c2) { try { #region Paramters SqlCommand cmd; SqlDataReader reader; #endregion con.Open(); cmd = new SqlCommand("insert into Equipments (equip_Name,Counts,halls_id,[Kind of equip_exer_id]) values ('" + c2.Name + "','" + c2.count + "','" + c2.hall_id + "', '" + c2.kind_of_exer_id + "') ", con); cmd.ExecuteNonQuery(); MessageBox.Show("Your Registeration was sucsessful"); con.Close(); } catch (Exception) { MessageBox.Show("Please check Name "); } }
private void button2_Click(object sender, EventArgs e) { #region all statements of add Equipments if (txtname.Text != string.Empty && txtcount.Text != string.Empty && combhall.Text != string.Empty && combkind.Text != string.Empty && combkind.Text != string.Empty) { int x = 0, y = 0; con.Open(); if (combkind.Text.Equals("Fitness")) { x = 1; } else if (combkind.Text.Equals("Body_Building")) { x = 2; } else { x = 3; } if (combhall.Text.Equals("Chest")) { y = 1; } else if (combhall.Text.Equals("Back")) { y = 2; } else if (combhall.Text.Equals("Shoulder")) { y = 3; } else if (combhall.Text.Equals("Biceps")) { y = 4; } else if (combhall.Text.Equals("Triceps")) { y = 5; } else if (combhall.Text.Equals("Leg")) { y = 6; } else { y = 7; } #region paramter string name = txtname.Text; int coun = Int32.Parse(txtcount.Text); Equipments c1 = new Equipments(); c1.Name = txtname.Text; c1.count = coun; c1.hall_id = y; c1.kind_of_exer_id = x; #endregion c1.add1(c1); con.Close(); } else { MessageBox.Show("Please make sure that you have entered all the information"); } #endregion }