Ejemplo n.º 1
0
        public FixedSalaryViewModel(FixedSalary entity, Action <FixedSalaryViewModel> act = null)
        {
            if (entity == null)
            {
                return;
            }

            Entity = entity;
            act?.Invoke(this);
        }
Ejemplo n.º 2
0
        public static List <IEmployee> GenerateMockEmployees()
        {
            /* Creati singolarmente per chiarezza. */
            IEmployee emp01 = new CommissionPaid(1, "Mario", "Rossi", 1200m);
            IEmployee emp02 = new CommissionPaid(2, "Maria", "Neri", 3200m);
            IEmployee emp03 = new CommissionPaid(3, "Marco", "Bianchi", 500m);
            IEmployee emp04 = new FixedSalary(4, "Gianna", "Red", 2200m);
            IEmployee emp05 = new FixedSalary(5, "Gianni", "Blak", 4400m);
            IEmployee emp06 = new FixedSalary(6, "Giovy", "White", 2600m);
            IEmployee emp07 = new HourlyPaid(7, "Ivan", "Rot", 25m, new decimal[] { 8m, 5m, 6.5m, 8m, 4.5m, 7m, 0m });
            IEmployee emp08 = new HourlyPaid(8, "Ifan", "Schwarz", 30m, new decimal[] { 0m, 0m, 8m, 8m, 4m, 0m, 0m });
            IEmployee emp09 = new HourlyPaid(9, "Ivanov", "Weiß", 18m, new decimal[] { 8m, 6.5m, 6.5m, 6.5m, 6.5m, 8m, 0m });

            return(new List <IEmployee>()
            {
                emp01, emp02, emp03, emp04, emp05, emp06, emp07, emp08, emp09
            });
        }
Ejemplo n.º 3
0
        private void processFile(string[] file)
        {
            int succesCount = 0;
            int failCount   = 0;

            foreach (var str in file)
            {
                //info[0] - fio, fio[1] - ставка, fio[2] - признак почасово оплаты
                var info = str.Split(',');
                if (info.Length == 3)
                {
                    Employee emp;
                    double   salary;
                    if (!Double.TryParse(info[1].Trim(), out salary))
                    {
                        failCount++;
                        continue;
                    }
                    if (info[2].Trim() == "+")
                    {
                        emp = new HourlySalary(info[0], salary).Empl;
                    }
                    else
                    {
                        emp = new FixedSalary(info[0], salary).Empl;
                    }
                    _employees.Add(emp);
                    succesCount++;
                }
                else
                {
                    failCount++;
                }
            }
            string infoMsg = $"Обработано сотрудников - {succesCount}" + Environment.NewLine
                             + $"Некорректных строк - {failCount}";

            MessageBox.Show(infoMsg);
        }
Ejemplo n.º 4
0
        static List <Employee> CreateMockEmployees()
        {
            var fs = new FixedSalary
            {
                Id   = 1,
                Name = "Mario Rossi",
                FPay = 1500.00M,
            };

            var hp = new HourlyPay
            {
                Id         = 2,
                Name       = "Luigi Neri",
                HourlyRate = 20,
            };

            hp.AddWorkedHours(2019, 8, 31, 4);
            hp.AddWorkedHours(2019, 8, 30, 6);
            hp.AddWorkedHours(2019, 8, 29, 2);
            hp.AddWorkedHours(2019, 8, 14, 5);

            var cp = new CommissionPay
            {
                Id         = 3,
                Name       = "Anna Gialli",
                Percentage = 2,
            };

            cp.AddCommission(2019, 8, 31, 2000);
            cp.AddCommission(2019, 8, 31, 1500.50M);
            cp.AddCommission(2019, 8, 7, 3000);

            return(new List <Employee> {
                fs, hp, cp
            });
        }