Beispiel #1
0
        private void OpenAdministratorForm()
        {
            var adminForm = new AdminForm();

            adminForm.Show();

            adminForm.FormClosed += (sender, args) => OpenLoginForm();

            int index = 0;

            adminForm.UserListView.SelectedIndexChanged += (sender, args) =>
            {
                for (int i = 0; i < PayrollSystem.Users.Count; i++)
                {
                    if (adminForm.UserListView.SelectedIndices.Contains(i))
                    {
                        index = i;
                    }
                }
            };

            adminForm.UserInfoButton.Click += (sender, args) => OpenUserForm(PayrollSystem.Users[index]);

            adminForm.AddUserButton.Click += (sender, args) =>
            {
                var addNewUserForm = OpenAddNewUserForm();
                addNewUserForm.FormClosed += (s, a) => LoadUsersListAdminForm(adminForm);
            };

            adminForm.DeleteUserButton.Click += (sender, args) =>
            {
                PayrollSystem.Users.RemoveAt(index);
                LoadUsersListAdminForm(adminForm);
            };

            adminForm.ProduceAccrualButton.Click += (sender, args) =>
            {
                var produceAccrualForm = new ProduceAccrualForm();
                produceAccrualForm.Show();
                produceAccrualForm.SendButton.Click += (s, a) =>
                {
                    var    user    = PayrollSystem.Users[index];
                    double sum     = Convert.ToDouble(produceAccrualForm.SumTextBox.Text);
                    String comment = produceAccrualForm.CommentTextBox.Text;
                    var    accrual = new Accrual(user, sum, comment);
                    PayrollSystem.Users[index].PersonalBankAccount.ProduceAccrual(accrual);
                    produceAccrualForm.Close();
                };
            };

            LoadUsersListAdminForm(adminForm);
        }
Beispiel #2
0
 public void ProduceAccrual(Accrual accrual)
 {
     Accruals.Add(accrual);
     SumOfMoney += accrual.Sum;
 }
Beispiel #3
0
        public void PayAccrual(User user, int sum)
        {
            var accrual = new Accrual(user, 1000, "Простое начисление");

            Accruals.Add(accrual);
        }
Beispiel #4
0
        public void ProduceAccrual(User user, double sum, String comment)
        {
            var accrual = new Accrual(user, sum, comment);

            user.PersonalBankAccount.ProduceAccrual(accrual);
        }