Exemple #1
0
        bool IPresenter.Open(IUserDefinedSearch search)
        {
            IFiltersList tempList  = search.Filters.Clone();
            bool         confirmed = false;

            using (dialogView = view.CreateDialog(this))
                using (var filtersManagerPresenter = filtersManagerFactory(tempList, dialogView))
                {
                    dialogView.SetData(new DialogData()
                    {
                        Name = search.Name
                    });
                    confirm = () =>
                    {
                        string name = dialogView.GetData().Name;
                        if (string.IsNullOrWhiteSpace(name))
                        {
                            alerts.ShowPopup(
                                alertsCaption,
                                "Bad filter name.",
                                AlertFlags.Ok
                                );
                            return(false);
                        }
                        if (name != search.Name && userDefinedSearches.ContainsItem(name))
                        {
                            alerts.ShowPopup(
                                alertsCaption,
                                string.Format("Name '{0}' is already used by another filter. Enter another name.", name),
                                AlertFlags.Ok
                                );
                            return(false);
                        }
                        if (tempList.Items.Count == 0)
                        {
                            alerts.ShowPopup(
                                alertsCaption,
                                "Can not save: filter must have at least one rule.",
                                AlertFlags.Ok
                                );
                            return(false);
                        }
                        confirmed = true;
                        return(confirmed);
                    };
                    dialogView.OpenModal();
                    confirm = null;
                    if (confirmed)
                    {
                        search.Name    = dialogView.GetData().Name;
                        search.Filters = tempList;
                    }
                    else
                    {
                        tempList.Dispose();
                    }
                }
            dialogView = null;
            return(confirmed);
        }
Exemple #2
0
        private void AssignedTaskDialogView_OnSaveButtonClick(object sender, System.EventArgs e)
        {
            var assignedTask = assignedTaskDialogView.GetData();

            if (assignedTask == null)
            {
                return;
            }

            if (!ValidateAssignment(assignedTask))
            {
                return;
            }

            if (assignedTaskDialogView.IsEditing)
            {
                assignedTaskService.Update(assignedTask);
            }
            else
            {
                assignedTaskService.Create(assignedTask);
            }

            ExecuteAndClose(sender as Button,
                            MenuOption.AssignedTasks.GetAttribute <MenuOptionAttribute>().Name);
        }
Exemple #3
0
        private void TaskDialogView_OnSaveButtonClick(object sender, System.EventArgs e)
        {
            var task = taskDialogView.GetData();

            if (task == null)
            {
                return;
            }

            if (taskDialogView.IsEditing)
            {
                taskService.Update(task);
            }
            else
            {
                taskService.Create(task);
            }

            this.assignedTaskDialogView.LoadTasks(taskService.Get(t => !t.IsDeleted));

            ExecuteAndClose(sender as Button,
                            MenuOption.AssignedTasks.GetAttribute <MenuOptionAttribute>().Name,
                            MenuOption.Tasks.GetAttribute <MenuOptionAttribute>().Name);
        }
Exemple #4
0
        private void EmployeeDialogView_OnSaveButtonClick(object sender, System.EventArgs e)
        {
            var employee = employeeDialogView.GetData();

            if (employee == null)
            {
                return;
            }

            if (employeeDialogView.IsEditing)
            {
                employeeService.Update(employee);
            }
            else
            {
                employeeService.Create(employee);
            }

            this.assignedTaskDialogView.LoadEmployees(employeeService.Get(emp => !emp.IsDeleted));

            ExecuteAndClose(sender as Button,
                            MenuOption.AssignedTasks.GetAttribute <MenuOptionAttribute>().Name,
                            MenuOption.Employees.GetAttribute <MenuOptionAttribute>().Name);
        }