public override bool Equals(object obj) { EmployeeOBT emp = (EmployeeOBT)obj; if (emp.EmployeeID == this.EmployeeID) { return(true); } return(false); }
public Dictionary <EmployeeOBT, EmployeeOBT> ParseData(string[] loadedData) { foreach (string value in loadedData) { string[] data = value.Split(','); _employee = new EmployeeOBT(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); if (!(_employees).ContainsKey(_employee)) { _employees.Add(_employee, _employee); } } Console.WriteLine(_employees.Count); return(_employees); }
public EmployeeOBT MaxSalariedEmployee(Dictionary <EmployeeOBT, EmployeeOBT> employees) { int max = 0; EmployeeOBT MaxSalariedEmployee = null; foreach (EmployeeOBT emp in employees.Values) { if (max < Convert.ToInt32(emp.Salary)) { max = Convert.ToInt32(emp.Salary); MaxSalariedEmployee = emp; } } return(MaxSalariedEmployee); }
static void Main(string[] args) { CSVLoader loader = new CSVLoader(); WebDataLoader loader1 = new WebDataLoader("https://swabhav-tech.firebaseapp.com/emp.txt"); loader1.LoadData(); EmployeeDataAnalyzer analyzerweb = new EmployeeDataAnalyzer(); EmployeeOBT employeeweb = (analyzerweb.MaxSalariedEmployee(loader1.GetParsedData())); Console.WriteLine("Employee ID = " + employeeweb.EmployeeID); Console.WriteLine("Employee Name = " + employeeweb.EmployeeName); Console.WriteLine("Employee Designation = " + employeeweb.Designation); Console.WriteLine("Manager ID = " + employeeweb.ManagerID); Console.WriteLine("Date of Joining = " + employeeweb.DateOfJoining); Console.WriteLine("Salary = " + employeeweb.Salary); Console.WriteLine("Commission = " + employeeweb.Commission); Console.WriteLine("Department Number = " + employeeweb.DepartmentNumber); Dictionary <string, int> designationWiseweb = analyzerweb.DesignationWiseCount(loader1.GetParsedData()); foreach (KeyValuePair <string, int> emp in designationWiseweb) { Console.WriteLine(emp.Key + emp.Value); } Dictionary <string, int> departmentWiseweb = analyzerweb.DepartmentWiseCount(loader1.GetParsedData()); foreach (KeyValuePair <string, int> emp in departmentWiseweb) { Console.WriteLine(emp.Key + emp.Value); } loader.LoadData(); EmployeeDataAnalyzer analyzer = new EmployeeDataAnalyzer(); EmployeeOBT employee = (analyzer.MaxSalariedEmployee(loader.GetParsedData())); Console.WriteLine("Employee ID = " + employee.EmployeeID); Console.WriteLine("Employee Name = " + employee.EmployeeName); Console.WriteLine("Employee Designation = " + employee.Designation); Console.WriteLine("Manager ID = " + employee.ManagerID); Console.WriteLine("Date of Joining = " + employee.DateOfJoining); Console.WriteLine("Salary = " + employee.Salary); Console.WriteLine("Commission = " + employee.Commission); Console.WriteLine("Department Number = " + employee.DepartmentNumber); Dictionary <string, int> designationWise = analyzer.DesignationWiseCount(loader.GetParsedData()); foreach (KeyValuePair <string, int> emp in designationWise) { Console.WriteLine(emp.Key + emp.Value); } Dictionary <string, int> departmentWise = analyzer.DepartmentWiseCount(loader.GetParsedData()); foreach (KeyValuePair <string, int> emp in departmentWise) { Console.WriteLine(emp.Key + emp.Value); } }