private void dButtonS_Click(object sender, EventArgs e) { Button myButton = sender as Button; String buffer = myButton.Name; foreach (Staff thisStaff in people.staff) { if (thisStaff.username == buffer) { FacStaff f2 = new FacStaff(thisStaff); f2.Show(); } } }
//preloading function of staff/fac /* * private void professorTabPage_Enter(object sender, EventArgs e) * { * if (situationFac == 0) * { * //TabPage buffer = sender as TabPage; * int lx = 108; * int ly = 48; * int iy = 5; * int ix = 10; * int counter = 0; * //play with data * foreach (Faculty thisFac in people.faculty) * { * //Console.WriteLine(thisFac.name); * Button dButtonF = new Button(); * dButtonF.Text = thisFac.name; * dButtonF.Show(); * dButtonF.Name = thisFac.username; * if (counter == 0) * { * dButtonF.Location = new Point(ix, iy); * } * else * { * if (counter % 6 == 0) * { * iy += ly; * ix = 10; * lx = 108; * dButtonF.Location = new Point(ix, iy); * } * else * { * dButtonF.Location = new Point(ix + lx, iy); * lx += 108; * } * } * counter++; * dButtonF.Visible = true; * facultyTabPage.Controls.Add(dButtonF); * dButtonF.Click += dButtonF_Click; * } * situationFac = 1; * } * //issue is how to find data on ONE ind * //getSingleInstance("dsbics"); * } * * private void staffTabPage_Enter(object sender, EventArgs e) * { * if (situationStaff == 0) * { * //TabPage buffer = sender as TabPage; * int lx = 108; * int ly = 48; * int iy = 5; * int ix = 10; * int counter = 0; * * //play with data * foreach (Staff thisStaff in people.staff) * { * //Console.WriteLine(thisStaff.name); * Button dButtonS = new Button(); * dButtonS.Text = thisStaff.name; * dButtonS.Show(); * dButtonS.Name = thisStaff.username; * if (counter == 0) * { * dButtonS.Location = new Point(ix, iy); * } * else * { * if (counter % 6 == 0) * { * iy += ly; * ix = 10; * lx = 108; * dButtonS.Location = new Point(ix, iy); * } * else * { * dButtonS.Location = new Point(ix + lx, iy); * lx += 108; * } * } * counter++; * dButtonS.Visible = true; * staffTabPage.Controls.Add(dButtonS); * dButtonS.Click += dButtonS_Click; * } * situationStaff = 1; * //issue is how to find data on ONE ind * //getSingleInstance("dsbics"); * } * } */ private void dButtonF_Click(object sender, EventArgs e) { Button myButton = sender as Button; String buffer = myButton.Name; foreach (Faculty thisFac in people.faculty) { if (thisFac.username == buffer) { FacStaff f2 = new FacStaff(thisFac); f2.Show(); } } }