static void Main(string[] args) { Boss boss = new Boss(); //Action is an existing delegate in the System namespace. //It is compatible with any method that has no return value (its return type is void) // and that takes no parameters Action doSomething = boss.Display; doSomething(); ManageWorker manage1 = boss.Use; ManageWorker manage2 = boss.Fire; int empoyeeID = 1; Console.WriteLine("Dealing with {0}", manage1(empoyeeID)); Console.WriteLine("After dealing with that employee"); doSomething(); empoyeeID = 2; Console.WriteLine("Fire to {0}", manage2(empoyeeID)); Console.WriteLine("After firing that employee"); doSomething(); //======Filtering with LINQ======================================= boss.Staff = boss.FilterByGender(Gender.X); doSomething(); }
public static bool TextboxFilled(ManageWorker manageWorker) { if (manageWorker.txtBoxName.Text != string.Empty && manageWorker.txtBoxSurname.Text != string.Empty && manageWorker.txtBoxAge.Text != string.Empty && manageWorker.txtBoxGender.Text != string.Empty && manageWorker.txtBoxUsername.Text != string.Empty && manageWorker.txtBoxPassword.Text != string.Empty) { return(true); } else { System.Windows.Forms.MessageBox.Show("Please insert all textboxes", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return(false); } }