static void Main(string[] args) { Console.WriteLine("Welcome to Employee Payroll Service!"); EmployeeModel model = new EmployeeModel(); model.EmployeeName = "Akash"; model.PhoneNumber = "9875241630"; model.Address = "Mumbai"; model.Department = "SD"; model.Gender = 'M'; model.BasicPay = 53000; model.Deductions = 2000; model.TaxablePay = 500; model.Tax = 1000; model.NetPay = 50000; model.StartDate = DateTime.Now; model.City = "Mulund"; model.Country = "In"; EmployeeRepo repo = new EmployeeRepo(); Console.WriteLine("Displaying All Data"); repo.GetAllEmployee(); bool res = repo.AddEmployee(model); if (res) { Console.WriteLine("Employee Added Successfully"); repo.GetAllEmployee(); } else { Console.WriteLine("Employee isn't Added"); } Console.WriteLine("Retrieving Employee from StartDate"); EmployeeModel model1 = new EmployeeModel() { StartDate = DateTime.Parse("2018-06-26") }; repo.RetrieveEmployeeBasedOnStartDate(model1); Console.WriteLine("Retrieving Sum Avg Min Max from Employee"); EmployeeModel model2 = new EmployeeModel() { Gender = 'M' }; repo.FindSumAvgMinMaxSalaryOfEmployee(model2); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); EmployeeRepo er = new EmployeeRepo(); er.GetAllEmployee(); }
static void Main(string[] args) { //Console.WriteLine("Hello World!"); Console.WriteLine("Welcome to Employee Payroll!"); EmployeeRepo repo = new EmployeeRepo(); EmployeeModel employee = new EmployeeModel(); //employee.EmployeeName = "Indal1"; //employee.Department = "Tech1"; //employee.PhoneNumber = "6302907918"; //employee.Address = "02-Khajauli1"; //employee.Gender = 'M'; //employee.BasicPay = 10000.00M; //employee.Deductions = 1500.00; //employee.StartDate = employee.StartDate = Convert.ToDateTime("2020-11-03"); if (repo.AddEmployee(employee)) { Console.WriteLine("Records added successfully"); } repo.GetAllEmployee(); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Welcome to Employee Payroll Service!"); EmployeeRepo employeeRepo = new EmployeeRepo(); EmployeeModel employeeModel = new EmployeeModel(); SalaryUpdateModel updateModel = new SalaryUpdateModel(); ///Get All Employee present in Employee_Payroll table employeeRepo.GetAllEmployee(); ///Update Employee Salary employeeModel.SalaryId = 1; employeeModel.SalaryMonth = "Jan"; employeeModel.Salary = 500000.00; employeeModel.EmpId = 2; employeeRepo.UpdateEmployeeSalary(updateModel); ///Get All Employee in a particular data range employeeRepo.GetAllEmployeeInADataRange(); ///Get data by Gender employeeRepo.GetDataByGroupByGender(); ///Add Employee Details employeeModel.EmpName = "Appu"; employeeModel.Salary = 500000.00; employeeModel.Start_Date = Convert.ToDateTime("12/05/2020"); employeeModel.Gender = 'F'; employeeModel.Phone_Number = "9877553212"; employeeModel.Employee_Address = "Kharadi"; employeeModel.Department = "Tetsing"; employeeModel.Basic_Pay = 8765.00; employeeModel.Deductions = 9876.00; employeeModel.Taxable_Pay = 97765.00; employeeModel.Income_Tax = 7654.00; employeeModel.Net_Pay = 6543.00; employeeModel.EmpId = 6; employeeModel.DeptId = 7; employeeModel.DeptName = "Development"; employeeModel.DeptLocation = "Pune"; employeeModel.SalaryMonth = "Jan"; ///Add Employee in Employee_Payroll table employeeRepo.AddEmployee(employeeModel); ///Remove particular employee entry using EmpId employeeRepo.RemoveEmployee(); ///Get Employee Details present in Employee table employeeRepo.GetAllEmployeeDetails(); ///Get Department details from Department table employeeRepo.GetAllDepartment(); ///Get Salary of Employee from Salary table employeeRepo.GetEmployeeSalary(); ///Get Data by Gender using joins employeeRepo.GetDataByGroupByGenderER(); Console.WriteLine("Employee Payroll using Threads"); ///retrieve url string[] words = CreateWordArray(@"http://www.gutenberg.org/files/54700/54700-0.txt"); #region ParallelTasks Parallel.Invoke (() => { Console.WriteLine("Begin First Task..."); GetLongestWord(words); }, () => { Console.WriteLine("Begin Second Task..."); GetMostCommonWords(words); }, //close second action () => { Console.WriteLine("Begin Third Task..."); GetCountForWord(words, "Sleep"); } //close third action ); //close parallel.invoke #endregion }
static void Main(string[] args) { Console.WriteLine("Welcome To Employee Payroll Service System"); EmployeeRepo repo = new EmployeeRepo(); int loop = 1; while (loop == 1) { Console.WriteLine("Choose \n1. View all records \n2. Add record \n3. Update salary \n4. Retrieve information from name \n5. Retrieve Employees with joining date in a range \n6. Sum of basic pay gender wise \n7. Average of basic pay gender wise \n8. Minimum basic pay gender wise \n9. Maximum basic pay gender wise \n10. Count of employees gender wise \n11. Remove emloyee from active employees \n12. Exit"); int choice = Convert.ToInt32(Console.ReadLine()); switch (choice) { case 1: List <EmployeeModel> employeeList = repo.GetAllEmployee(); foreach (EmployeeModel employeeModel in employeeList) { System.Console.WriteLine(employeeModel.EmployeeName + " " + employeeModel.BasicPay + " " + employeeModel.StartDate + " " + employeeModel.Gender + " " + employeeModel.PhoneNumber + " " + employeeModel.Address + " " + employeeModel.Department + " " + employeeModel.Deductions + " " + employeeModel.TaxablePay + " " + employeeModel.Tax + " " + employeeModel.NetPay); System.Console.WriteLine("\n"); } break; case 2: Console.WriteLine("Enter number of employees to be added"); int noOfEmployeesAdded = Convert.ToInt32(Console.ReadLine()); List <EmployeeModel> list = new List <EmployeeModel>(); while (noOfEmployeesAdded >= 1) { EmployeeModel employee = new EmployeeModel(); Console.WriteLine("Enter Name"); employee.EmployeeName = Console.ReadLine(); Console.WriteLine("Enter Phone Number"); employee.PhoneNumber = Console.ReadLine(); Console.WriteLine("Enter Address"); employee.Address = Console.ReadLine(); Console.WriteLine("Enter Gender"); employee.Gender = Convert.ToChar(Console.ReadLine()); Console.WriteLine("Enter Basic Pay"); employee.BasicPay = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine("Enter Start date"); employee.StartDate = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Enter Department"); employee.Department = Console.ReadLine(); Console.WriteLine("Enter department id"); employee.DepartmentId = Convert.ToInt32(Console.ReadLine()); noOfEmployeesAdded--; list.Add(employee); } noOfEmployeesAdded = repo.AddMultipleEmployeesUsingThread(list); break; case 3: Console.WriteLine("Enter Name"); string name = Console.ReadLine(); Console.WriteLine("Enter Basic Pay"); double salary = Convert.ToDouble(Console.ReadLine()); bool result = repo.UpdateSalary(name, salary); Console.WriteLine(result == true ? "Salary Updated" : "Salary cannot be updated"); break; case 4: Console.WriteLine("Enter Name"); string employeeName = Console.ReadLine(); List <EmployeeModel> employeeNameList = repo.RetrieveDataByName(employeeName); foreach (EmployeeModel employeeInfo in employeeNameList) { System.Console.WriteLine(employeeInfo.EmployeeName + " " + employeeInfo.BasicPay + " " + employeeInfo.StartDate + " " + employeeInfo.Gender + " " + employeeInfo.PhoneNumber + " " + employeeInfo.Address + " " + employeeInfo.Department + " " + employeeInfo.Deductions + " " + employeeInfo.TaxablePay + " " + employeeInfo.Tax + " " + employeeInfo.NetPay); System.Console.WriteLine("\n"); } break; case 5: Console.WriteLine("Enter Start date"); DateTime startDate = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Enter End date"); DateTime endDate = Convert.ToDateTime(Console.ReadLine()); List <EmployeeModel> employeeWithStartDateList = repo.RetrieveEmployeesWithParticularDateRange(startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")); foreach (EmployeeModel employeeModel in employeeWithStartDateList) { System.Console.WriteLine(employeeModel.EmployeeName + " " + employeeModel.BasicPay + " " + employeeModel.StartDate + " " + employeeModel.Gender + " " + employeeModel.PhoneNumber + " " + employeeModel.Address + " " + employeeModel.Department + " " + employeeModel.Deductions + " " + employeeModel.TaxablePay + " " + employeeModel.Tax + " " + employeeModel.NetPay); System.Console.WriteLine("\n"); } break; case 6: repo.SumOfSalaryGenderWise(); break; case 7: repo.AverageOfSalaryGenderWise(); break; case 8: repo.MinimumSalaryGenderWise(); break; case 9: repo.MaximumSalaryGenderWise(); break; case 10: repo.CountOfEmployeesGenderWise(); break; case 11: Console.WriteLine("Enter employee Id of employee to be removed"); int empId = Convert.ToInt32(Console.ReadLine()); bool employeeRemoved = repo.RemoveEmployee(empId); if (employeeRemoved) { Console.WriteLine("Employee Removed successfully"); } break; case 12: loop = 0; break; } } }
static void Main(string[] args) { Console.WriteLine("Welcome to Employee Payroll Service!"); EmployeeRepo.GetAllEmployee(); /* * //update salary * var salaryUpdateModel = new SalaryUpdateModel { SalaryId = 1, EmployeeSalary = 30000000 }; * var salaryObj = new Salary(); * var salary = salaryObj.UpdateEmployeeSalary(salaryUpdateModel); * salaryObj.UpdateMultipleSalariesUsingThreads(new List<SalaryUpdateModel> { salaryUpdateModel }); */ //Console.WriteLine(salary); /* * //Retreiving Employees In a date range * var startDate = Convert.ToDateTime("01/01/2018"); * var endDate = Convert.ToDateTime("01/01/2019"); * * EmployeeRepo.GetAllEmployeeInDateRange(startDate, endDate); */ //EmployeeRepo.ExecuteAggregateFunctions(); /* * //Adding employee with stored procedure * var empModel = new EmployeeModel { EmployeeName = "Iron Man", Salary = 1300,Gender='M',PhoneNumber="5454545", * StartDate=Convert.ToDateTime("01/01/2019"),Address="In the sky full of starts",Department="Legal"}; * var employeePayroll = new EmployeePayroll { employeeModel = empModel}; * EmployeeRepo.AddEmployee(employeePayroll); */ /* * //Removing an employee * EmployeeRepo.RemoveEmployee(5); */ //Adding Multiple Employees var employees = new List <EmployeePayroll> { new EmployeePayroll { employeeModel = new EmployeeModel { EmployeeName = "Steel Man", Salary = 1000000, Gender = 'M', PhoneNumber = "5454545", StartDate = Convert.ToDateTime("01/01/2019"), Address = "In the sky full of starts", Department = "Legal" } }, new EmployeePayroll { employeeModel = new EmployeeModel { EmployeeName = "Copper Man", Salary = 1000000, Gender = 'M', PhoneNumber = "5454545", StartDate = Convert.ToDateTime("01/01/2019"), Address = "In the sky full of starts", Department = "Legal" } }, new EmployeePayroll { employeeModel = new EmployeeModel { EmployeeName = "Aluminium Man", Salary = 1000000, Gender = 'M', PhoneNumber = "5454545", StartDate = Convert.ToDateTime("01/01/2019"), Address = "In the sky full of starts", Department = "Legal" } } }; EmployeeRepo.AddMultipleEmployees(employees); EmployeeRepo.AddMultipleEmployeesUsingThreads(employees); }