Example #1
0
        private void DeleteSelectedButton_Click(object sender, EventArgs e)
        {
            var checkedEmployees = new List <Employee>();

            foreach (var checkedEmployeeItem in EmployeeListBox.CheckedItems)
            {
                checkedEmployees.Add(EmployeeRepo.GetEmployeeByOib(checkedEmployeeItem.ToString().GetOib()));
            }
            if (checkedEmployees.Count == 0)
            {
                return;
            }

            var confirmDeleteEmployee = new ConfirmForm();

            confirmDeleteEmployee.ShowDialog();
            if (!confirmDeleteEmployee.IsConfirmed)
            {
                return;
            }

            foreach (var employee in checkedEmployees)
            {
                TryDelete(employee);
            }

            RefreshEmployeesListBox();
        }
Example #2
0
        private void DeleteSelectedButton_Click(object sender, EventArgs e)
        {
            var checkedProjects = new List <Project>();

            foreach (var checkedProjectItem in ProjectListBox.CheckedItems)
            {
                checkedProjects.Add(ProjectRepo.GetProjectByName(checkedProjectItem.ToString().GetProjectName()));
            }
            if (checkedProjects.Count == 0)
            {
                return;
            }

            var confirmDeleteProject = new ConfirmForm();

            confirmDeleteProject.ShowDialog();
            if (!confirmDeleteProject.IsConfirmed)
            {
                return;
            }

            foreach (var project in checkedProjects)
            {
                Delete(project);
            }

            RefreshProjectsListBox();
        }
Example #3
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            var confirmCancel = new ConfirmForm();

            confirmCancel.ShowDialog();
            if (confirmCancel.IsConfirmed)
            {
                Close();
            }
        }