Example #1
0
        //In this method we create a new project object and call the search method to look for projects
        private void Search()
        {
            //At first, we hide the main grid and enable the projectPanel, where the found projects will display
            MainPanel.Visibility     = Visibility.Hidden;
            projectsPanel.IsEnabled  = true;
            projectsPanel.Visibility = Visibility.Visible;
            //Calling this function, we clean the projects panel, so each time a new search is made, the panel will not have
            //the results from the previous searches
            ManagePanels.ClearPanel(projectsPanel);

            //And here, we create a projects object to manage the methods and a buttons list to record all the found proects
            ProjectsController PC   = new ProjectsController();
            List <Button>      btns = PC.SearchProjects(txtSearch.Text);

            //Create the go back button from the project class
            Button btnGoBack = PC.CreateButton("Go Back", "Images/icons8-go-back-96.png");

            btnGoBack.Click += new RoutedEventHandler(Go_Back);
            projectsPanel.Children.Add(btnGoBack);

            if (btns != null)
            {
                //Once the search is performed, now we add an event to each founded button
                foreach (Button btn in btns)
                {
                    projectsPanel.Children.Add(btn);
                    btn.Click += new RoutedEventHandler(Move);
                }
            }
            else
            {
                var home = new HomeView();
                Content = home;
            }
        }
Example #2
0
        private void LoadTasksAsync()
        {
            //get all the tasks from a project
            tbProjectT.Text             = "My tasks";
            ProjectTasksPanel.IsEnabled = true;
            ManagePanels.ClearPanel(ProjectTasksPanel);


            List <Button> tasks = TC.GetTasks(Environment.UserName);

            foreach (Button task in tasks)
            {
                task.LostFocus += new RoutedEventHandler(LostFocus);
                task.Style      = (Style)FindResource("SquareButtonStyle");
                task.Click     += new RoutedEventHandler(TaskLoadAsync);
                ProjectTasksPanel.Children.Add(task);
            }
        }
Example #3
0
        private void btnShowAll_Click(object sender, RoutedEventArgs e)
        {
            //get all the tasks from a project
            tbProjectT.Text             = "My tasks";
            ProjectTasksPanel.IsEnabled = true;
            ManagePanels.ClearPanel(ProjectTasksPanel);


            List <Button> Tasks = TC.GetAllTasks(Environment.UserName);

            foreach (Button Task in Tasks)
            {
                Task.LostFocus += new RoutedEventHandler(LostFocus);
                Task.Style      = (Style)FindResource("SquareButtonStyle");
                Task.Click     += new RoutedEventHandler(TaskLoadAsync);
                ProjectTasksPanel.Children.Add(Task);
            }
            btnHide.Visibility    = Visibility.Visible;
            btnShowAll.Visibility = Visibility.Hidden;
        }
Example #4
0
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            P = PC.SearchProject(GlobalVariables.projecViewNav);
            M = MC.SearchMember(Environment.UserName);

            GlobalVariables.projectArea = P.area;
            rtbDescription.Document.Blocks.Clear();
            rtbDescription.Document.Blocks.Add(new Paragraph(new Run(P.projectDescription)));

            if (P.area == "SCM")
            {
                tabPN.IsEnabled  = true;
                tabVI.IsEnabled  = true;
                tabPN.Visibility = Visibility.Visible;
                tabVI.Visibility = Visibility.Visible;
            }

            if (Convert.ToString(P.endDate) != "1/1/0001 12:00:00 AM")
            {
                btnPCompleted.IsEnabled  = false;
                btnPCompleted.Visibility = Visibility.Hidden;
                btnUnfinish.Visibility   = Visibility.Visible;
            }

            foreach (ProjectMembersView Member in PC.GetMembers(P.idProject))
            {
                lvMembers.Items.Add(Member.displayName);
            }

            //get all the tasks from a project
            tbProjectT.Text = P.projectName;

            ProjectTasksPanel.IsEnabled = true;
            ManagePanels.ClearPanel(ProjectTasksPanel);


            foreach (Button task in TC.GetProjectTasks(P.projectName))
            {
                task.LostFocus += new RoutedEventHandler(lostFocus);
                task.Style      = (Style)FindResource("SquareButtonStyle");
                task.Click     += new RoutedEventHandler(TaskLoad);
                ProjectTasksPanel.Children.Add(task);
            }

            int aux = 0;

            _values = new ChartValues <GanttPoint>();
            var labels = new List <string>();



            foreach (TaskMembersView TV in TC.LoadTasksInfo(GlobalVariables.projecViewNav))
            {
                labels.Add(TV.taskName);
                if (Convert.ToDateTime(TV.startDate).Ticks < Convert.ToDateTime(TV.endDate).Ticks)
                {
                    _values.Add(new GanttPoint(Convert.ToDateTime(TV.startDate).Ticks, Convert.ToDateTime(TV.endDate).Ticks));
                }
                else
                {
                    _values.Add(new GanttPoint(Convert.ToDateTime(TV.startDate).Ticks, Convert.ToDateTime(TV.endDate).AddDays(1).Ticks));
                }
                aux = 1;
            }

            try
            {
                Series = new SeriesCollection
                {
                    new RowSeries
                    {
                        Values     = _values,
                        DataLabels = true
                    }
                };
                Formatter = value => new DateTime((long)value).ToString("dd MMM");

                Labels = labels.ToArray();

                ResetZoomOnClick(null, null);

                DataContext = this;
                startDates.ToArray();
                endDates.ToArray();
                names.ToArray();
                if (aux == 0)
                {
                    //ChartGrid.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception)
            {
                //ChartGrid.Visibility = Visibility.Hidden;
            }

            try
            {
                List <string> attachments = AC.GetProjectAttachments(P.idProject);

                foreach (string attachment in attachments)
                {
                    lbAttachments.Items.Add(attachment);
                }
            }
            catch (Exception ex)
            {
                await metroWindow.ShowMessageAsync("Atention", "Project can not be loaded");
            }
        }