Exemplo n.º 1
0
        public void AddCategory()
        { // TODO: Untestable, rewrite for unit testing.
            // Ask user for category data:
            DataInputDialog = dialogFactory.GetDialog(EDialog.StringInput, Resources.CategoryNameInputDialogText);
            DataInputDialog.AskUser();

            if (DataInputDialog.IsDataProvided())
            {
                var addedCategory = categoryFactory.GetCategory(ECategory.Standard);
                addedCategory.Name  = (string)DataInputDialog.ReturnValue;
                addedCategory.Tasks = new List <ITask>();

                // Check if user tries to add category that already exists:
                var equalSearchCategory = QueryCategory((string)DataInputDialog.ReturnValue);
                if (equalSearchCategory != null)
                {
                    messageBoxFactory.ShowMessageBox(
                        EMessageBox.Standard,
                        Resources.CategoryAlreadyExistsErrorMessage,
                        Settings.Default.AppName,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    return;
                }

                Categories.Add(addedCategory);
                Settings.Default.Categories.Add(addedCategory.Name);
                Settings.Default.Save();
                ActiveForm.AddCategoryToDisplay(addedCategory);

                // TODO: Prepare storage access for new categories!
            }
            else
            {
                messageBoxFactory.ShowMessageBox(
                    EMessageBox.Standard,
                    Resources.NoDataProvidedErrorText,
                    Settings.Default.AppName,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }

            var dialog = (Form)DataInputDialog;

            dialog.Dispose();
        }
Exemplo n.º 2
0
        //
        // GET: /Category/

        //public ActionResult Index(Guid id)
        //{
        //    ViewData.Model = categoryFactory.GetCategory(id);
        //    return View();
        //}

        public ActionResult Details(Guid id)
        {
            ViewData.Model = categoryFactory.GetCategory(id);
            return(View());
        }