Esempio n. 1
0
        public override float GetSalary(DateTime customDate)
        {
            float salary = 0.00f, baseSalary;

            baseSalary = SQLiteDataAccess.GetBaseSalary(2);
            TimeSpan span = customDate - this.employmentDate;

            if (span.Ticks > 0)
            {
                int workingYears = (new DateTime(1, 1, 1) + span).Year - 1;
                salary = baseSalary;
                if (workingYears > 8)
                {
                    salary = baseSalary + baseSalary * 0.4f;
                }
                else
                {
                    salary = baseSalary + baseSalary * 0.05f * workingYears;
                }
                if (!(subordinates == null))
                {
                    salaryList = new List <float>();
                    for (int index = 0; index < subordinates.Length / 2; index++)
                    {
                        int subordinateId = int.Parse(subordinates[index, 0]);
                        SQLiteDataAccess.MakeSecondWorker(subordinateId);
                        salaryList.Add(SQLiteDataAccess.secondPerson.Salary);
                    }
                    salary += (salaryList.Sum() * 0.005f);
                }
                salary = (float)Math.Round(salary, 2);
            }

            return(salary);
        }
Esempio n. 2
0
        public override float GetSalary(DateTime customDate)
        {
            float salary = 0.00f, baseSalary;

            baseSalary = SQLiteDataAccess.GetBaseSalary(3);
            float    totalAllowance;
            TimeSpan span = customDate - this.employmentDate;

            if (span.Ticks > 0)
            {
                int workingYears = (new DateTime(1, 1, 1) + span).Year - 1;
                salary = baseSalary;
                if (workingYears > 35)
                {
                    salary = baseSalary + baseSalary * 0.35f;
                }
                else
                {
                    salary = baseSalary + baseSalary * 0.35f * workingYears;
                }
                if (!(subordinatesOfEveryLevel == null))
                {
                    salaryList = new List <float>();
                    List <float> salaryListForCounting = new List <float>();
                    for (int index = 0; index < subordinatesOfEveryLevel.Length; index++)
                    {
                        int id = subordinatesOfEveryLevel[index];
                        SQLiteDataAccess.MakeSecondWorker(id);
                        for (int subordinatesIndex = 0; subordinatesIndex < subordinates.Length / 2; subordinatesIndex++)
                        {
                            if (int.Parse(subordinates[subordinatesIndex, 0]) == id)
                            {
                                salaryList.Add(SQLiteDataAccess.secondPerson.Salary);
                            }
                        }
                        salaryListForCounting.Add(SQLiteDataAccess.secondPerson.Salary);
                    }
                    salary += (salaryListForCounting.Sum() * 0.005f);
                }
                salary = (float)Math.Round(salary, 2);
            }

            return(salary);
        }
Esempio n. 3
0
        public override float GetSalary(DateTime customDate)
        {
            float salary = 0.00f, baseSalary;

            baseSalary = SQLiteDataAccess.GetBaseSalary(1);
            TimeSpan span = customDate - this.employmentDate;

            if (span.Ticks > 0)
            {
                int workingYears = (new DateTime(1, 1, 1) + span).Year - 1;
                salary = baseSalary;
                if (workingYears > 10)
                {
                    salary = baseSalary + baseSalary * 0.3f;
                }
                else
                {
                    salary = baseSalary + baseSalary * 0.03f * workingYears;
                }
                salary = (float)Math.Round(salary, 2);
            }

            return(salary);
        }