Пример #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);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            float        salary       = SQLiteDataAccess.person.GetSalary(dateTimePicker1.Value);
            List <float> salariesList = new List <float>();

            if (SQLiteDataAccess.person.Subordinates != null)
            {
                for (int index = 0; index < SQLiteDataAccess.person.Subordinates.Length / 2; index++)
                {
                    int id = int.Parse(SQLiteDataAccess.person.Subordinates[index, 0]);
                    SQLiteDataAccess.MakeSecondWorker(id);
                    salariesList.Add(SQLiteDataAccess.secondPerson.GetSalary(dateTimePicker1.Value));
                }
                SQLiteDataAccess.person.SalaryList = salariesList;
            }
            label2.Text            = salary + " руб.";
            listBox1.SelectedIndex = -1;
            label4.Text            = "";

            float salarySum    = 0.00f;
            int   entriesCount = SQLiteDataAccess.GetEntriesCount();

            for (int index = 0; index < entriesCount; index++)
            {
                SQLiteDataAccess.MakeSecondWorker(index + 1);
                salarySum += SQLiteDataAccess.secondPerson.GetSalary(dateTimePicker1.Value);
            }
            label5.Text     = salarySum + " руб.";
            button1.Visible = false;
        }
Пример #3
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);
        }
Пример #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            label2.Text = SQLiteDataAccess.person.Salary + " руб.";

            float salarySum    = 0.00f;
            int   entriesCount = SQLiteDataAccess.GetEntriesCount();

            for (int index = 0; index < entriesCount; index++)
            {
                SQLiteDataAccess.MakeSecondWorker(index + 1);
                salarySum += SQLiteDataAccess.secondPerson.Salary;
            }
            label5.Text = salarySum + " руб.";
            if (SQLiteDataAccess.person is Manager || SQLiteDataAccess.person is Salesman)
            {
                string[,] subordinates = SQLiteDataAccess.person.Subordinates;
                for (int index = 0; index < subordinates.Length; index++)
                {
                    listBox1.Items.Add(subordinates[index, 1]);
                }
            }
        }