// Display all employee private void allEmployeeToolStripMenuItem_Click(object sender, EventArgs e) { Employees myEmployees = myBusiness.Employees; string myDisplay = ""; foreach (Employee myEmployee in myEmployees) { myDisplay = myDisplay + "\n\t" + myEmployee.ToString() + "\n"; if (myEmployee is IPostHistory) { IPostHistory myIPostHistoryEmployee = (IPostHistory)myEmployee; myDisplay = myDisplay + "\t \t Posts \n"; foreach (Post myPost in myIPostHistoryEmployee.PostHistory) { myDisplay = myDisplay + "\t\t" + myPost.ToString() + "\n"; } myDisplay = myDisplay + "\n"; } } mainDisplay.Text = myDisplay; sslDisplayInfo.Text = "Record Count: " + myEmployees.Count.ToString(); }
/* * * * Display ToolStrip Menu * * * */ // Display individual employee private void displayEmployeeToolStripMenuItem_Click(object sender, EventArgs e) { string eId; string myDisplay = ""; Employee myEmployee; Form8 myForm8 = new Form8(); DialogResult dr = myForm8.ShowDialog(); if (dr == DialogResult.OK) { eId = myForm8.myEmployeeID; myEmployee = myBusiness.SelectEmployee(eId); myDisplay = myDisplay + "\n\t" + myEmployee.ToString() + "\n"; if (myEmployee is IPostHistory) { IPostHistory myIPostHistoryEmployee = (IPostHistory)myEmployee; myDisplay = myDisplay + "\t\t Posts \n"; foreach (Post myPost in myIPostHistoryEmployee.PostHistory) { myDisplay = myDisplay + "\t\t" + myPost.ToString() + "\n"; } myDisplay = myDisplay + "\n"; } mainDisplay.Text = myDisplay; sslDisplayInfo.Text = "Employee Displayed"; } }
public void RemovePost(string pEID, string pPID, IPostHistory pPostHistory) { //pEmployee = myEmployees[pEID]; pPostHistory = (IPostHistory)myEmployees[pEID]; pPostHistory.PostHistory.Remove(pPID); }
public void AddPost(string pEID, IPostHistory pPostHistory, Post pPost) { //pEmployee = myEmployees[pEID]; pPostHistory = (IPostHistory)myEmployees[pEID]; pPostHistory.PostHistory.Add(pEID, pPost); }