public static int operator +(Trainers t1, int x) { Trainers t2 = new Trainers(); t2.Salary = t1.Salary + x; return(t2.Salary); }
private void button3_Click(object sender, EventArgs e) { con.Open(); Trainers c1 = new Trainers(); string name = txtname.Text; c1.delete(name); con.Close(); }
public displaytraine() { InitializeComponent(); con.Open(); #region paramter Trainers c1 = new Trainers(); #endregion dgv_display_cust.DataSource = c1.display(); con.Close(); }
private void button1_Click(object sender, EventArgs e) { con.Open(); #region paramter Trainers c1 = new Trainers(); string name = combname.Text; #endregion dgv_search_cust.DataSource = c1.search(name); con.Close(); }
public virtual void add(Trainers c1) { #region Paramters SqlCommand cmd; #endregion try { con.Open(); cmd = new SqlCommand("insert into Traineer (Traineer_Name,Sallary,halls_id,manager_id,Froms,Tos) values ('" + c1.Name + "','" + c1.Salary + "','" + c1.halls_id + "', '" + c1.manager_id + "','" + c1.froms + "','" + c1.tos + "') ", con); cmd.ExecuteNonQuery(); MessageBox.Show("Your Registeration was sucsessful"); con.Close(); } catch (Exception) { MessageBox.Show("Please check Name or Salary"); } }
public virtual void edit(Trainers c1, string n) { try { #region Paramters SqlCommand cmd; #endregion con.Open(); cmd = new SqlCommand("update Traineer set Traineer_Name='" + c1.Name + "', Sallary='" + c1.Salary + "', halls_id='" + c1.halls_id + "', manager_id='" + c1.manager_id + "', Froms='" + c1.froms + "', Tos='" + c1.tos + "' where Traineer_Name='" + n + "'", con); cmd.ExecuteNonQuery(); MessageBox.Show("Your Update was sucsessful"); con.Close(); } catch (Exception) { MessageBox.Show("Please check Name or Salary"); } }
private void button2_Click(object sender, EventArgs e) { #region all statements of add Equipments #region paramter int b = int.Parse(txtbouns.Text); Trainers t = new Trainers(); Trainers c2 = new Trainers(); #endregion if (txtnames.Text != string.Empty && txtsalary.Text != string.Empty && combhall.Text != string.Empty && combmanage.Text != string.Empty && txtfroms.Text != string.Empty && txttos.Text != string.Empty) { #region paramter string name = combname.Text; int salary = Int32.Parse(txtsalary.Text) + Int32.Parse(txtbouns.Text); string dtf = txtfroms.Text; string dtt = txttos.Text; int x = 0, y = 0; #endregion if ((dtf == "12 pm" && dtt == "8 pm") || (dtf == "8 pm" && dtt == "4 am")) { con.Open(); if (combmanage.Text.Equals("Mohamed Salah Salem")) { x = 1; } else if (combmanage.Text.Equals("Marawan Mahmoud")) { x = 2; } else if (combmanage.Text.Equals("Yossief Sayed")) { x = 3; } else if (combmanage.Text.Equals("Youmna")) { x = 4; } else { x = 5; } 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 Trainers c1 = new Trainers(); c1.Name = txtnames.Text; c1.Salary = salary; c1.halls_id = y; c1.manager_id = x; c1.froms = dtf; c1.tos = dtt; #endregion c1.edit(c1, name); con.Close(); } else { MessageBox.Show("Please check trainers shift"); } } else { MessageBox.Show("Please make sure that you have entered all the information"); } c2.Salary = int.Parse(txtsalary.Text); t.Salary = c2 + b; MessageBox.Show("Bouns =" + t.Salary); #endregion }