Beispiel #1
0
 static void Main(string[] args)
 {
     var employee = new Employee("Илья", "Романов", "Александрович", new DateTime(1983, 09, 24), 5, "электрик");
     Console.WriteLine("{0}: {1} {2} {3} {4} лет", employee.Position, employee.LastName, employee.FirstName,
         employee.MiddleName, employee.Age);
     Console.ReadKey();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            Employee newMan = new Employee("Thomas", "Amnet");
            newMan.Salary();

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            //Employee e1 = new Employee("Smith", 20000);
            //Console.WriteLine(e1.displayInfo());
            //Manager m1 = new Manager("Brown", 40000, "Sales");
            //Console.WriteLine(m1.displayInfo());

            List<Employee> names = new List<Employee>();
            Manager m1 = new Manager("Brown", 40000, "Sales");
            names.Add(m1);

            Employee e1 = new Employee("Brown", 20000);
            names.Add(e1);

            Manager m2 = new Manager("Jones", 55000, "Finance");
            names.Add(m2);

            Employee e2 = new Employee("Green", 30000);
            names.Add(e2);

            for (int i = 0; i < names.Count; ++i)
                Console.WriteLine(names[i].displayInfo()); // polymorphic-compiler calls the right displayInfo for each object

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            ApplicationUtilities.DisplayApplicationInformation();           // Here we call the Methods from the ApplicationUtilities Class

            ApplicationUtilities.DisplayDivider("Start Program");

            Employee[] employeeList = new Employee[2];

            //employeeList[0] = new Employee();
            employeeList[0] = new Hourly("Hourly");
            employeeList[1] = new Salaried("Salaried");

            foreach (Employee emp in employeeList)
            {
                EmployeeInput.CollectEmployeeInformation(emp);

                if (emp is Hourly)
                {
                    EmployeeInput.CollectHourlyInformation((Hourly)emp);
                }
                else if (emp is Salaried)
                {
                    EmployeeInput.CollectSalaryInformation((Salaried)emp);
                }
                EmployeeOutput.DisplayEmployeeInformation(emp);
                ApplicationUtilities.PauseExecution();
            }
                EmployeeOutput.DisplayNumberObject();

                ApplicationUtilities.TerminateApplication();
        }
 public static void DisplayEmployeeInformation(Employee theEmployee)
 {
     //this method will display theEmployee object to string method to the console
     //Create an Employee object using default constructor
     ApplicationUtilities.DisplayDivider(theEmployee.FirstName + " " + theEmployee.LastName);
     Console.WriteLine(theEmployee.ToString());
 }   
 static void Main(string[] args)
 {
     Employee e1 = new Employee("Smith", 20000);
     Console.WriteLine(e1.displayInfo());
     Manager m1 = new Manager("Brown", 40000, "Sales");
     Console.WriteLine(m1.displayInfo());
     Console.ReadKey();
 }
 public static void CollectEmployeeInformation(Employee theEmployee)
 {
     theEmployee.FirstName = InputUtilities.getStringInputValue("First Name");
     theEmployee.LastName = InputUtilities.getStringInputValue("Last Name");
     theEmployee.Gender = InputUtilities.getCharInputValue("Gender");
     theEmployee.Dependents = InputUtilities.getIntegerInputValue("Dependents");
     theEmployee.EmployeeBenefits.HealthInsuranceCompany = InputUtilities.getStringInputValue("Health Insurance Company");
     theEmployee.EmployeeBenefits.LifeInsuranceAmount = InputUtilities.getDoubleInputValue("Life Insurance Amount");
     theEmployee.EmployeeBenefits.VacationDays = InputUtilities.getIntegerInputValue("Vacation Days");
 }
Beispiel #8
0
 //this class gathers all necessary information for the base class object
 public static void CollectEmployeeInformation(Employee theEmployee)
 {
     theEmployee.FirstName = InputUtilities.UppercaseFirst(InputUtilities.getStringInputValue("first name"));
     theEmployee.LastName = InputUtilities.UppercaseFirst(InputUtilities.getStringInputValue("last name"));
     theEmployee.Gender = Char.ToUpper(InputUtilities.getCharInputValue("gender (M or F)"));
     theEmployee.Dependents = InputUtilities.getIntegerInputValue("number of dependents");
     theEmployee.Benefits.HealthInsuranceCompany = InputUtilities.UppercaseFirst(InputUtilities.getStringInputValue("health insurance company"));
     theEmployee.Benefits.LifeInsuranceAmount = InputUtilities.getDoubleInputValue("life insurance amount");
     theEmployee.Benefits.VacationDays = InputUtilities.getIntegerInputValue("vacation days");
 }
        public void Main(string[] args)
        {
            //Remember to use .notation to call a method
            //Display Program Information
            ApplicationUtilities.DisplayApplicationInformation();
            ApplicationUtilities.DisplayDivider("Start Program");
            ApplicationUtilities.DisplayDivider("Prompt for Employee Information and creat first employee");

            //array of employees
            Employee[] listEmployees = new Employee[2];
            
            listEmployees[0] = new Hourly();
            listEmployees[1] = new Salaried();

            for (int i = 0; i < 2; i++)
            {
                if (listEmployees[i] is Hourly)
                {
                    ApplicationUtilities.DisplayDivider("Get Hourly Information");
                    EmployeeInput.CollectEmployeeInformation(listEmployees[i]);
                    EmployeeInput.CollectHourlyInformation((Hourly)listEmployees[i]);

                    EmployeeOutput.DisplayEmployeeInformation((Hourly)listEmployees[i]);

                    ApplicationUtilities.PauseExecution();
                }

                else if (listEmployees[i] is Salaried)
                {
                    ApplicationUtilities.DisplayDivider("Get Salaried Information");
                    EmployeeInput.CollectEmployeeInformation(listEmployees[i]);
                    EmployeeInput.CollectSalariedInformation((Salaried)listEmployees[i]);

                    EmployeeOutput.DisplayEmployeeInformation((Salaried)listEmployees[i]);

                    ApplicationUtilities.PauseExecution();
                }
            }

            EmployeeOutput.DisplayNumberObjects();
            ApplicationUtilities.TerminateApplication();
        }
        /// <summary>
        /// Purpose: This is the AddEmp button even handler. Handles necesary steps when you add en employee
        /// Preconditions: None
        /// Postconditions: None
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddEmp_Click(object sender, EventArgs e)
        {
            Object selected = CBxEmpType.SelectedItem;
            if (selected == null)
            {
                MessageBox.Show(ER_MSG_EMPTYPE, ER_MSG_NAME_INVD_DATA, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
            else
            {
                string item = selected.ToString();
                switch (item)
                {
                    case HRLY_EMP:
                        try
                        {
                            _obj_holder= new Hourly(TxtBxEmpID.Text, TxtFirstName.Text, TxtLastName.Text,TxtMiddInit.Text,CBxMarital.Text,TxtPhoneNum.Text,TxtDepartment.Text,TxtTitle.Text,MCalStartDate.SelectionRange.Start.ToString(),TxtBxLable1.Text, TxtBxLable2.Text);
                            _rules.employees.Add(_obj_holder.EmpID,_obj_holder);
                            empID_holder =_obj_holder.EmpID;
                            _obj_holder = _rules.employees[empID_holder];
                            RTBxBack.AppendText("\n" + _obj_holder.EmpNameFirst +" "+ _obj_holder.EmpNameLast+"\n");
                            RTBxBack.AppendText(_obj_holder.EmpID.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpType.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.HourlyRate.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.HoursWorked.ToString() + "\n");
                            BtnClear_Click(sender, e);
                            _count++;
                        }
                        catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
                        break;
                    case SALE_EMP:
                        try
                        {
                            _obj_holder = new Sales(TxtBxEmpID.Text, TxtFirstName.Text,TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text, TxtBxLable2.Text, TxtBxLable3.Text);
                            _rules.employees.Add(_obj_holder.EmpID, _obj_holder);
                            empID_holder = _obj_holder.EmpID;
                            _obj_holder = _rules.employees[empID_holder];
                            RTBxBack.AppendText("\n" + _obj_holder.EmpNameFirst + " " + _obj_holder.EmpNameLast + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpID.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpType.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.MonthlySalary.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.ComSales.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.GrossSales.ToString() + "\n");
                            BtnClear_Click(sender, e);
                            _count++;
                        }
                        catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
                        break;
                    case CONT_EMP:
                        try
                        {
                            _obj_holder = new Contract(TxtBxEmpID.Text, TxtFirstName.Text,TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text);
                            _rules.employees.Add(_obj_holder.EmpID, _obj_holder);
                            empID_holder = _obj_holder.EmpID;
                            _obj_holder = _rules.employees[empID_holder];
                            RTBxBack.AppendText("\n" + _obj_holder.EmpNameFirst + " " + _obj_holder.EmpNameLast + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpID.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpType.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.ContractSalary.ToString() + "\n");
                            BtnClear_Click(sender, e);
                            _count++;
                        }
                        catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
                        break;
                    case SRLY_EMP:
                        try
                        {
                            _obj_holder = new Salary(TxtBxEmpID.Text, TxtFirstName.Text,TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text);
                            _rules.employees.Add(_obj_holder.EmpID, _obj_holder);
                            empID_holder = _obj_holder.EmpID;
                            _obj_holder = _rules.employees[empID_holder];
                            RTBxBack.AppendText("\n" + _obj_holder.EmpNameFirst + " " + _obj_holder.EmpNameLast + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpID.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.EmpType.ToString() + "\n");
                            RTBxBack.AppendText(_obj_holder.MonthlySalary.ToString() + "\n");
                            BtnClear_Click(sender, e);
                            _count++;
                        }
                        catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
                        break;
                }//End of switch
            }//End of else
        }
 /// <summary>
 /// Purpose: Values to be loaded on window load.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MnWindow_Load_1(object sender, EventArgs e)
 {
     CBxEmpType.Items.Add("Hourly Employee");
     CBxEmpType.Items.Add("Salary Employee");
     CBxEmpType.Items.Add("Contract Employee");
     CBxEmpType.Items.Add("Sales Employee");
     CBxSearchType.Items.Add("Employee ID");
     CBxSearchType.Items.Add("Last Name");
     CBxEIGrade.Items.Add("A");
     CBxEIGrade.Items.Add("A-");
     CBxEIGrade.Items.Add("B+");
     CBxEIGrade.Items.Add("B");
     CBxEIGrade.Items.Add("B-");
     CBxEIGrade.Items.Add("C+");
     CBxEIGrade.Items.Add("C");
     CBxEIGrade.Items.Add("C-");
     CBxEIGrade.Items.Add("D+");
     CBxEIGrade.Items.Add("D");
     CBxEIGrade.Items.Add("D-");
     CBxEIGrade.Items.Add("E");
     CBxMarital.Items.Add("Married");
     CBxMarital.Items.Add("Single");
     CBxEICreditHours.Items.Add(1);
     CBxEICreditHours.Items.Add(2);
     CBxEICreditHours.Items.Add(3);
     CBxEICreditHours.Items.Add(4);
     CBxEICreditHours.Items.Add(5);
     Lbl01.Hide();
     Lbl02.Hide();
     Lbl03.Hide();
     TxtBxLable1.Hide();
     TxtBxLable2.Hide();
     TxtBxLable3.Hide();
     _count = 0;
     _testDataCount = 0;
     _rules = BusinessRules.INSTANCE;
     _currentViewedEmp = null;
     _currentViewedCourse = null;
        _file = new FileIO();
     _course_holder = null;
     _searchList = new List<string>();
     _searchListEI = new List<string>();
     BtnSaveEmp.Enabled = false;
     UpdateEducBenefitsTab();
 }
        /// <summary>
        /// Purpose: This is the event handler for the search button on the front tab.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            Object selected = CBxSearchType.SelectedItem;
            if (selected == null)
            {
                MessageBox.Show(ER_MSG_EMPTYPE, ER_MSG_NAME_INVD_DATA, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
            else
            {
                string item = selected.ToString();
                string itemSearch = TxtSearch.Text;
                switch (item)
                {
                    case SEARCH_EMP_ID:
                        //Code for search on emp id.
                        try
                        {
                            _currentViewedEmp = _rules[itemSearch];
                            _searchList.Clear();
                            AddToSearchList(_currentViewedEmp.EmpNameFirst,_currentViewedEmp.EmpNameLast, _currentViewedEmp.EmpID);
                            LBxFoundEmp.DataSource = null;
                            LBxFoundEmp.DataSource = _searchList;
                        }
                        catch(OverflowException)
                        {
                            MessageBox.Show(ER_MSG_EMPID, ER_MSG_NAME_INVD_DATA, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        catch(KeyNotFoundException)
                        {
                            MessageBox.Show(ER_MSG_EMPID_NOEXSIST, ER_MSG_NAME_NOTFOUND, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        catch(Exception ex)
                        {
                            MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;
                    case SEARCH_LAST_NAME:
                        //Code for search on last name.
                        try
                        {
                            _searchList.Clear();
                            List<Employee> foundEmp = _rules.FindEmpByLastName(itemSearch);
                            foreach(Employee emp in foundEmp)
                            {
                                AddToSearchList(emp.EmpNameFirst, emp.EmpNameLast, emp.EmpID);
                            }
                            LBxFoundEmp.DataSource = null;
                            LBxFoundEmp.DataSource = _searchList;
                        }
                        catch(Exception ex)
                        {
                            MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        break;
                }

            }
        }
 /// <summary>
 /// Purpose: This is the event handler for with an item is selected in the search box.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LBxFoundEmp_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string currentItem = LBxFoundEmp.SelectedItem.ToString();
         uint id = GetIDFromSearchList(currentItem);
         _currentViewedEmp = _rules.employees[id];
         UpdateMainTab();
         UpdateEducBenefitsTab();
         BtnSaveEmp.Enabled = true;
         BtnAddEmp.Enabled = false;
     }
     catch (NullReferenceException)
     {
     }
 }
 /// <summary>
 /// Purpse: Event handler for the save emp button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnSaveEmp_Click(object sender, EventArgs e)
 {
     Object selected = CBxEmpType.SelectedItem;
     string item = selected.ToString();
     switch (item)
     {
         case HRLY_EMP:
             try
             {
                 _obj_holder = new Hourly(TxtBxEmpID.Text, TxtFirstName.Text, TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text, TxtBxLable2.Text);
             }
             catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
             break;
         case SALE_EMP:
             try
             {
                 _obj_holder = new Sales(TxtBxEmpID.Text, TxtFirstName.Text, TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text, TxtBxLable2.Text, TxtBxLable3.Text);
             }
             catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
             break;
         case CONT_EMP:
             try
             {
                 _obj_holder = new Contract(TxtBxEmpID.Text, TxtFirstName.Text, TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text);
             }
             catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
             break;
         case SRLY_EMP:
             try
             {
                 _obj_holder = new Salary(TxtBxEmpID.Text, TxtFirstName.Text, TxtLastName.Text, TxtMiddInit.Text, CBxMarital.Text, TxtPhoneNum.Text, TxtDepartment.Text, TxtTitle.Text, MCalStartDate.SelectionRange.Start.ToString(), TxtBxLable1.Text);
             }
             catch (Exception ex) { MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
             break;
     }
     if(_obj_holder.EmpID == _currentViewedEmp.EmpID)
     {
         _rules.employees[_obj_holder.EmpID] = _obj_holder;
     }
     else
     {
         _rules.employees.Remove(_currentViewedEmp.EmpID);
         _rules.employees.Add(_obj_holder.EmpID, _obj_holder);
     }
     _searchList.Clear();
     LBxFoundEmp.DataSource = null;
     LBxFoundEmp.DataSource = _searchList;
     UpdateRichTextBox();
     ClearMainWindow();
     ClearEducBenifitsTab();
     BtnSaveEmp.Enabled = false;
     BtnAddEmp.Enabled = true;
     _currentViewedEmp = null;
     UpdateEducBenefitsTab();
 }
 /// <summary>
 /// Purpose: This is the Save Button DB event handler. Handles what happens when the Save DB button is pressed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnSave_Click(object sender, EventArgs e)
 {
     _file.DB = _rules.employees;
     _file.CloseDB();
     _rules.employees = _file.DB;
     RTBxBack.Text = "";
     ClearMainWindow();
     TxtDBName.Text = "";
     _searchList.Clear();
     LBxFoundEmp.DataSource = null;
     _currentViewedEmp = null;
     TxtSearch.Text = "";
     ClearMainWindow();
 }
 /// <summary>
 /// Purpose: This is the Open DB Button event handler. Handles what happens when the Open DB button is pressed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnOpen_Click(object sender, EventArgs e)
 {
     bool _validDB = true;
     try {
         _file.OpenDB();
         _file.ReadDB();
         _searchList.Clear();
         LBxFoundEmp.DataSource = null;
         _currentViewedEmp = null;
         TxtSearch.Text = "";
         ClearMainWindow();
     }
     catch (SerializationException)
     {
         MessageBox.Show(ER_MSG_INVALIDDB, ER_MSG_NAME_INVALIDDB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         _validDB = false;
     }
     catch (IOException)
     {
         MessageBox.Show(ER_MSG_INVALIDDB, ER_MSG_NAME_INVALIDDB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         _validDB = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ER_MSG_NAME_ERR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         _validDB = false;
     }
     if (_validDB)
     {
         _rules.employees = _file.DB;
         TxtDBName.Text = _file.FileDBName;
         if (_rules.employees.Count != 0)
         {
             UpdateRichTextBox();
         }
         else
         {
             RTBxBack.Text = "";
             RTBxBack.AppendText("--Display--");
         }
     }
 }
 public static void DisplayEmployeeInformation(Employee theEmployee)
 {
     ApplicationUtilities.DisplayDivider(theEmployee.EmployeeType);
     Console.WriteLine(theEmployee.ToString());
 }
Beispiel #18
0
        static void Main(string[] args)
        {
            int personID = 0;
            int workerID = 100;

            Employee.Employee johnS     = new Employee.Employee(personID++, "John", "Smith", "03/24/1992", "Sales", workerID++, "11/12/2010");
            Customer.Customer customer1 = new Customer.Customer(personID++, "Andrew", "Beans", "04/26/1985", "123 Parkway Lane", "Jerky", "Nevada");
            Employee.Employee codyG     = new Employee.Employee(personID++, "Cody", "Godfreed", "05/07/2000", "Human Resources", workerID++, "08/05/2017");
            Employee.Employee harryP    = new Employee.Employee(personID++, "Harry", "Potter", "11/13/1974", "Sales", workerID++, "06/30/1990");
            Customer.Customer customer2 = new Customer.Customer(personID++, "Nick", "Sharp", "12/26/1983", "456 Jungle Avenue", "Spoon", "Californa");
            Customer.Customer customer3 = new Customer.Customer(personID++, "Phil", "Write", "05/01/1957", "789 Space Boulevard", "Townsvill", "Oregon");
            Customer.Customer customer4 = new Customer.Customer(personID++, "Cleo", "Jones", "04/19/1935", "101 Teachers Way", "Springston", "Georgia");
            Employee.Employee zakJ      = new Employee.Employee(personID++, "Zak", "Jack", "02/22/1992", "Marketing", workerID++, "01/24/2008");
            Customer.Customer customer5 = new Customer.Customer(personID++, "Jessica", "Whyzen", "06/20/1974", "258 Terror Drive", "Hampton", "Maine");
            Employee.Employee zackH     = new Employee.Employee(personID++, "Zack", "Hound", "09/03/1969", "Public Relations", workerID++, "07/23/2018");

            Employee.Employee[] store   = new Employee.Employee[5];
            Customer.Customer[] clients = new Customer.Customer[5];

            store[0] = johnS;
            store[1] = codyG;
            store[2] = harryP;
            store[3] = zakJ;
            store[4] = zackH;

            clients[0] = customer1;
            clients[1] = customer2;
            clients[2] = customer3;
            clients[3] = customer4;
            clients[4] = customer5;

            //Sorts Employees
            Employee.Employee[] storeHold = new Employee.Employee[1];
            for (int i = 0; i < store.Length; i++)
            {
                for (int j = 0; j < store.Length; j++)
                {
                    int c = string.Compare(store[j].firstName, store[i].firstName);
                    if (c == 1)
                    {
                        storeHold[0] = store[i];
                        store[i]     = store[j];
                        store[j]     = storeHold[0];
                    }
                }
            }

            //Sorts Clients
            Customer.Customer[] clientHold = new Customer.Customer[1];
            for (int i = 0; i < clients.Length; i++)
            {
                for (int j = 0; j < clients.Length; j++)
                {
                    int c = string.Compare(clients[j].firstName, clients[i].firstName);
                    if (c == 1)
                    {
                        clientHold[0] = clients[i];
                        clients[i]    = clients[j];
                        clients[j]    = clientHold[0];
                    }
                }
            }

            Console.WriteLine("This stores employees include:");
            for (int i = 0; i < store.Length; i++)
            {
                Console.WriteLine($"PID: {store[i].ID} First Name: {store[i].firstName} Last Name: {store[i].lastName} Date of Birth: {store[i].DOB} " +
                                  $"Department: {store[i].department} Employee ID: {store[i].employeeID} Date Employeed: {store[i].DOJ}");
            }

            Console.WriteLine("This stores clients include:");
            for (int t = 0; t < clients.Length; t++)
            {
                Console.WriteLine($"PID: {clients[t].ID} First Name: {clients[t].firstName} Last Name: {clients[t].lastName} Date of Birth:{clients[t].DOB} " +
                                  $"Address: {clients[t].address} City: {clients[t].city} State: {clients[t].state}");
            }
        }
Beispiel #19
0
 //this method invokes the ToString and WriteToFile methods of the provided object
 public static void DisplayEmployeeInformation(Employee theEmployee)
 {
     Console.WriteLine("\n*************" + theEmployee.EmployeeName + "*************\n");
     Console.WriteLine(theEmployee.ToString());
     theEmployee.WriteToFile();
 }
 public void EditEmployee(Employee emp)
 {
     employeeData[emp.EmployeeID] = emp;
 }