private void ButtonCreateSection_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ValidateInput())
                {
                    Section section = new Section
                    {
                        Name      = name.Text,
                        ProjectId = projectID,
                        DueDate   = DateTime.Parse(deadline.Text)
                    };

                    SectionDAO sectionDAO = new SectionDAO();

                    int sectionID = sectionDAO.CreateSection(section);

                    if (sectionDAO.Read(sectionID) != null)
                    {
                        SectionElement sectionElement = new SectionElement(sectionList);

                        sectionElement.SectionID.Name   = "Section" + sectionID;
                        sectionElement.SectionName.Text = name.Text;

                        sectionList.Children.Insert(sectionList.Children.Count - 1, sectionElement);
                        this.Close();
                    }
                }
            }
            catch (Exception exception)
            {
                utilities.GetNotifier().ShowError(utilities.HandleException(exception));
            }
        }
Beispiel #2
0
        public ActionResult DeleteSection(string Section)
        {
            SectionDAO dao = new SectionDAO();

            dao.DeleteSection(Section);
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult AddSection(Section_articles section)
        {
            SectionDAO dao = new SectionDAO();

            dao.AddSection(section);
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult AddArticle()
        {
            SectionDAO sectionDAO = new SectionDAO();

            ViewBag.Section = sectionDAO.GetListSection();
            ViewBag.Count   = sectionDAO.GetSectionCount();
            return(View());
        }
Beispiel #5
0
        public ActionResult DeleteSection()
        {
            SectionDAO dao          = new SectionDAO();
            var        list_section = dao.GetListSection();

            ViewBag.Count = dao.GetSectionCount();
            return(View(list_section));
        }
Beispiel #6
0
        public ActionResult ChangeArticle(int id)
        {
            ArticleDAO articleDAO = new ArticleDAO();
            var        article    = articleDAO.GetArticle(id);
            SectionDAO sectionDAO = new SectionDAO();

            ViewBag.Section = sectionDAO.GetListSection();
            ViewBag.Count   = sectionDAO.GetSectionCount();
            return(View(article));
        }
Beispiel #7
0
        public ActionResult AddArticle(string Section, Article article)
        {
            SectionDAO sectionDAO = new SectionDAO();
            var        section    = sectionDAO.GetSection(Section);
            Article    addArticle = new Article()
            {
                Section_articlesID = section.Id,
                Title       = article.Title,
                Description = article.Description,
                Body        = article.Body,
                Author      = article.Author,
                Date        = article.Date
            };

            ArticleDAO articleDAO = new ArticleDAO();

            articleDAO.AddArticle(addArticle);
            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public Board()
        {
            InitializeComponent();

            try
            {
                MainController mainController = MainController.Instance;
                SectionDAO     sectionDAO     = new SectionDAO();

                if (mainController.Project != null)
                {
                    List <Section> sections = sectionDAO.GetAll(mainController.Project.Id);

                    StackPanel sectionList = (StackPanel)FindName("SectionList");
                    WorkLogDAO workLogDAO  = new WorkLogDAO();

                    foreach (Section section in sections)
                    {
                        SectionElement sectionElement = new SectionElement(sectionList);

                        StackPanel taskList          = (StackPanel)sectionElement.SectionID;
                        StackPanel completedTaskList = (StackPanel)sectionElement.CompletedTaskList;

                        foreach (Task task in section.TaskList)
                        {
                            TaskElement taskElement = new TaskElement(task.Id);

                            taskElement.TaskID.Name = "Task" + task.Id;

                            taskElement.title.Text       = task.Name;
                            taskElement.description.Text = task.Description;

                            if (task.AssignedUser != null)
                            {
                                taskElement.avatar.ImageSource = new BitmapImage(new Uri(task.AssignedUser.Picture));
                                taskElement.UserButton.ToolTip = task.AssignedUser.Firstname + " " + task.AssignedUser.Lastname;
                            }


                            taskElement.UpdateProgress((workLogDAO.GetWorkSum(task.Id) / task.EstimatedTime) * 100);

                            if (task.Completed)
                            {
                                taskElement.Opacity = 0.5;
                                completedTaskList.Children.Add(taskElement);
                            }
                            else
                            {
                                taskList.Children.Insert(taskList.Children.Count - 1, taskElement);
                            }
                        }

                        sectionElement.SectionID.Name   = "Section" + section.Id;
                        sectionElement.SectionName.Text = section.Name;
                        sectionElement.Name             = "Section" + section.Id;

                        sectionList.Children.Add(sectionElement);
                    }

                    sectionList.Children.Add(new NewSectionElement(sectionList));
                }
            }
            catch (Exception exception)
            {
                utilities.GetNotifier().ShowError(utilities.HandleException(exception));
            }
        }
Beispiel #9
0
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            SectionDAO dao = DAOFactory.CreateSectionDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }