示例#1
0
        public IActionResult Index()
        {
            ListEmployees liEmp = new ListEmployees();

            liEmp.liEmp = Employees.GetEmployees();
            return(View(liEmp));
        }
示例#2
0
        async Task ExecuteLoadEmployeesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                ListEmployees.Clear();
                var items = await DataStore.GetAllAsync();

                foreach (var item in items)
                {
                    ListEmployees.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
示例#3
0
        private void UpdateEmployee(Employee employee)
        {
            var index = ListEmployees.IndexOf(employee);

            ListEmployees.Remove(employee);
            ListEmployees.Insert(index, employee);
        }
示例#4
0
        public async Task GetListEmployeeMethod()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            await Task.Delay(1000);

            try
            {
                ListEmployees.Clear();
                var results = _empDAL.GetAll();
                foreach (var emp in results)
                {
                    ListEmployees.Add(emp);
                }
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Error", $"{ex.Message}", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
 public void TestInitialize()
 {
     this.dbStub                = new HatchlingCompanyDbContext(Effort.DbConnectionFactory.CreateTransient());
     this.writerStub            = new Mock <IWriter>();
     this.mapperStub            = new Mock <IMapper>();
     this.createEmployeeService = new CreateEmployee(dbStub, writerStub.Object, mapperStub.Object);
     this.listEmployeesService  = new ListEmployees(dbStub, writerStub.Object);
 }
示例#6
0
 public void Remove(Employee employee)
 {
     if (this.EmployeeHasProject(employee))
     {
         throw new Exception(string.Format("Employee {0}  {1} can't be Deleted, because has project",
                                           employee.Name, employee.Surname));
     }
     ListEmployees.Remove(employee);
 }
示例#7
0
            public void AddWorkers(string name, string surname, double salary, double monthsWorked)
            {
                ListEmployees worker = new ListEmployees
                {
                    name         = name,
                    surname      = surname,
                    salary       = salary,
                    monthsWorked = monthsWorked,
                    hoursWorked  = 0
                };

                workers.Add(worker);
            }
        public void ListEmployees_Should_Call_PrintInfo_Of_All_Employees()
        {
            // Arrange
            var employeeToReturn = new Employee
            {
                FirstName   = "Alex",
                LastName    = "Alexov",
                Email       = "*****@*****.**",
                PhoneNumber = "123456789"
            };

            mapperStub.Setup(x => x.Map <Employee>(It.IsAny <CreateEmployeeModel>())).Returns(employeeToReturn);

            var createEmployeeService = new CreateEmployee(dbStub, writerStub.Object, mapperStub.Object);

            createEmployeeService.Execute(new List <string>()
            {
                "createEmployee", "Alex", "Alexov", "*****@*****.**", "123456789"
            });

            var listEmployeesService = new ListEmployees(dbStub, writerStub.Object);

            // Act
            listEmployeesService.Execute(new List <string>()
            {
                "listemployees"
            });

            var employees = this.dbStub
                            .Employees
                            .ProjectTo <ListEmployeesModel>()
                            .ToList();

            // Assert
            Assert.IsNotNull(employees);
            Assert.AreEqual("Alex", employees[0].FirstName);
            Assert.AreEqual("Alexov", employees[0].LastName);
            Assert.AreEqual("*****@*****.**", employees[0].Email);
        }
示例#9
0
 public void Add(Employee employee)
 {
     ListEmployees.Add(employee);
 }
 public Employees()
 {
     this.listEmployees = new ListEmployees();
     InitializeComponent();
     this.OpenForms(this.listEmployees);
 }
示例#11
0
        public static void CalculateSalary()
        {
            double   BudgetTotal  = 0;
            double   BudgetHours  = 0;
            Employee listemployes = new Employee
            {
                name = "mathemathics"
            };

            listemployes.AddWorkers("paco", "gimenez", 200.0, 10);
            listemployes.AddWorkers("angel", "fernandez", 200.0, 5);
            listemployes.AddWorkers("maria", "fernandez", 200.0, 20);
            listemployes.AddWorkers("hanna", "fernandez", 200.0, 5);
            listemployes.AddWorkers("Elisabeth", "Persson", 200.0, 50);
            // SalaryCalculator Salary = new SalaryCalculator();
            // SalaryCalculator SalaryPerEmployee = new SalaryCalculator();
            // ListEmployees currentWorker2 = listemployes.workers[0];

            /* for (int x = 0; x <= listemployes.workers.Count - 1; x++)
             * {
             *   ListEmployees currentWorker = listemployes.workers[x];
             *   Salary.workers.Add(currentWorker);
             *   // Console.WriteLine("Name: " + currentWorker.name + "The salary total is :   " + Salary.Salary);
             * }*/


            for (int i = 0; i >= listemployes.workers.Count; i++)
            {
                ListEmployees currentWorker = listemployes.workers[i];
                listemployes.workers.Add(currentWorker);
            }

            double numberOfEmployees = listemployes.workers.Count();
            double HourlyEmployed    = numberOfEmployees / 3;

            //add 5 % to the salary of the 1 third hourly employed
            Console.WriteLine(" \n SALARY OF WORKERS DELTID  \n  ");
            for (int x = 0; x < listemployes.workers.Count / 3; x++)
            {
                Random        random        = new Random();
                double        hours         = random.Next(1, 169);
                ListEmployees currentWorker = listemployes.workers[x];
                currentWorker.hoursWorked = hours;
                currentWorker.salary      = currentWorker.salary * hours;
                //total hours

                if (currentWorker.monthsWorked >= 5)
                {
                    double monthsWorked = currentWorker.monthsWorked / 5;
                    for (int i = 0; i < monthsWorked; i++)
                    {
                        double incrementS = currentWorker.salary * 0.05;
                        currentWorker.salary = currentWorker.salary + incrementS;
                        currentWorker.salary = Math.Round(currentWorker.salary, 2);
                    }
                }
                BudgetTotal = BudgetTotal + currentWorker.salary;
                BudgetTotal = Math.Round(BudgetTotal, 2);
                Console.WriteLine($"Name:   {currentWorker.name }.  The salary total is :     {currentWorker.salary} $.    hours Worked:       { currentWorker.hoursWorked}. \n");
            }

            //calculation of the salaries of all workers fulltime

            Console.WriteLine("  SALARY OF THE WORKERS HELTID  \n");
            for (int x = 0; x < listemployes.workers.Count - (listemployes.workers.Count / 3); x++)
            {
                double        hours         = 169;
                ListEmployees currentWorker = listemployes.workers[x];
                currentWorker.hoursWorked = hours;
                //Basic salary
                currentWorker.salary = currentWorker.salary * hours;
                //budget hours workers full time
                BudgetHours += currentWorker.hoursWorked;
                if (currentWorker.monthsWorked >= 5)
                {
                    double monthsWorked = currentWorker.monthsWorked / 5;
                    for (int i = 0; i < monthsWorked; i++)
                    {
                        double incrementS = currentWorker.salary * 0.05;
                        currentWorker.salary = currentWorker.salary + incrementS;
                        currentWorker.salary = Math.Round(currentWorker.salary, 2);
                    }
                }
                BudgetTotal = BudgetTotal + currentWorker.salary;
                BudgetTotal = Math.Round(BudgetTotal, 2);
                Console.WriteLine($"Name:  { currentWorker.name}.   The salary total is :  {currentWorker.salary} $. hours Worked:   {currentWorker.hoursWorked}. \n");
            }
            Console.WriteLine("\tBUDGET TOTAL WAGES : \n");
            Console.WriteLine("\t" + BudgetTotal + " $\n");
        }
        //Projeto Larissa Iurk
        //github.com/larissaiurk/ProjetoFolhaPagamento

        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkRed;
            Console.ForegroundColor = ConsoleColor.White;
            SeedsDAO.Add();

            int opcao = 0;

            do
            {
                Console.Clear();

                Console.WriteLine("  -- MENU FOLHA DE PAGAMENTO -- \n");
                Console.WriteLine("1 - Cadastrar cargo \n");
                Console.WriteLine("2 - Cadastrar funcionário \n");
                Console.WriteLine("3 - Cadastrar folha de pagamento \n");
                Console.WriteLine("4 - Consultar folha de pagamento \n ");
                Console.WriteLine("5 - Consultar histórico de folhas de pagamento do funcionário \n ");
                Console.WriteLine("6 - Consultar histórico de folhas de pagamento do mês \n ");
                Console.WriteLine("0 - Sair\n");

                Console.WriteLine("Digite a opção desejada:");
                opcao = Convert.ToInt32(Console.ReadLine());
                Console.Clear();
                switch (opcao)
                {
                case 1:
                    ListPositions.Render();
                    RegisterPosition.Render();
                    break;

                case 2:
                    ListEmployees.Render();
                    RegisterEmployee.Render();
                    break;

                case 3:
                    ListPositions.Render();
                    ListEmployees.Render();
                    RegisterPayroll.Render();
                    ListPayrolls.Render();
                    break;

                case 4:
                    ListPayrolls.Render();
                    ListPayrolls.ListByEmployee();
                    break;

                case 5:
                    ListPayrolls.ListByEmployeeHistoricByCpf();
                    break;

                case 6:
                    ListPayrolls.ListByEmployeeHistoricByDate();
                    break;

                case 0:
                    Console.WriteLine("Saindo...");
                    break;

                default:
                    Console.WriteLine("Opção inválida!");
                    break;
                }
                Console.WriteLine("\n Aperte uma tecla para continuar...");
                Console.ReadKey();
            } while (opcao != 0);
        }