private void Btn_createProject_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int         parsedValue;
                var         pro     = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
                var         project = new ObservableCollection <Project>();
                Project     ps      = new Project();
                XmlDocument doc     = new XmlDocument();
                doc.Load("Projects.xml");
                int count = 1;
                foreach (XmlNode xn in doc.SelectNodes("ArrayOfProject/Project"))
                {
                    count = count + 1;
                }
                string projectID = Convert.ToString(count);
                ps.ProjectId           = projectID;
                ps.ProjectTitle        = projectTitle.Text;
                ps.ProjectDescription  = projectDescription.Text;
                ps.StartDate           = startDate.Text;
                ps.EndDate             = endDate.Text;
                ps.ToDoLimit           = toDoLimit.Text;
                ps.WorkInProgressLimit = workInProgressLimit.Text;
                ps.DoneLimit           = doneLimit.Text;

                if (string.IsNullOrEmpty(projectTitle.Text) || string.IsNullOrEmpty(projectDescription.Text) || string.IsNullOrEmpty(startDate.Text) || string.IsNullOrEmpty(endDate.Text) || string.IsNullOrEmpty(toDoLimit.Text) || string.IsNullOrEmpty(workInProgressLimit.Text) || string.IsNullOrEmpty(doneLimit.Text))
                {
                    MessageBox.Show("Please enter all the values");
                }

                else if (!int.TryParse(toDoLimit.Text, out parsedValue))
                {
                    MessageBox.Show("Please enter numeric value in set to do limit field ");
                    return;
                }
                else if (!int.TryParse(workInProgressLimit.Text, out parsedValue))
                {
                    MessageBox.Show("Please enter numeric value in set work in progress limit field ");
                    return;
                }
                else if (!int.TryParse(doneLimit.Text, out parsedValue))
                {
                    MessageBox.Show("Please enter numeric value in set done limit field ");
                    return;
                }
                else
                {
                    pro.Add(ps);
                    TestStorage.WriteXml <ObservableCollection <Project> >(pro, "Projects.xml");
                    var gobacktomain = new MainWindow();
                    gobacktomain.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public Projectdetail(string param)
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            //fetch the project details from Projects.xml and display it on Projectdetail page.
            projectdetailid = param;
            var projectdata   = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
            var projectdetail = from s in projectdata where s.ProjectId.Equals(projectdetailid) select s;

            projectdetailsstk.DataContext = projectdetail;
        }
Esempio n. 3
0
        // update projectdetails
        private void Btn_updateproject_Click(object sender, RoutedEventArgs e)
        {
            int parsedValue;
            var pro     = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
            var project = new ObservableCollection <Project>();
            //Project ps = new Project();
            var ps = pro.First(f => f.ProjectId == getprojectid.Text);

            ps.ProjectTitle        = projectTitle.Text;
            ps.ProjectTitle        = projectTitle.Text;
            ps.ProjectDescription  = projectDescription.Text;
            ps.StartDate           = startDate.Text;
            ps.EndDate             = endDate.Text;
            ps.ToDoLimit           = toDoLimit.Text;
            ps.WorkInProgressLimit = workInProgressLimit.Text;
            ps.DoneLimit           = doneLimit.Text;
            if (string.IsNullOrEmpty(projectTitle.Text) || string.IsNullOrEmpty(projectDescription.Text) || string.IsNullOrEmpty(startDate.Text) || string.IsNullOrEmpty(endDate.Text) || string.IsNullOrEmpty(toDoLimit.Text) || string.IsNullOrEmpty(workInProgressLimit.Text) || string.IsNullOrEmpty(doneLimit.Text))
            {
                MessageBox.Show("Please enter all the values ");
            }
            else if (!int.TryParse(toDoLimit.Text, out parsedValue))
            {
                MessageBox.Show("Please enter numeric value in set to do limit field ");
                return;
            }
            else if (!int.TryParse(workInProgressLimit.Text, out parsedValue))
            {
                MessageBox.Show("Please enter numeric value in work set in progress limit field ");
                return;
            }
            else if (!int.TryParse(doneLimit.Text, out parsedValue))
            {
                MessageBox.Show("Please enter numeric value set in done limit field ");
                return;
            }
            else

            {
                TestStorage.WriteXml <ObservableCollection <Project> >(pro, "Projects.xml");
                successMsg.Visibility = Visibility.Visible;
                var gotomainwindow = new MainWindow();
                gotomainwindow.Show();
                this.Close();
            }
        }
        private void createtask_Click(object sender, RoutedEventArgs e)
        {
            var    project   = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
            var    proj      = new ObservableCollection <Project>();
            var    pr        = project.First(f => f.ProjectId == proid);
            string todocount = pr.ToDoLimit;
            int    todoCount = Convert.ToInt32(todocount);
            //  MessageBox.Show(todocount);

            XmlDocument docu = new XmlDocument();

            docu.Load("Tasks.xml");
            int count = 0;

            foreach (XmlNode x in docu.SelectNodes("ArrayOfTask/Task"))
            {
                string taskstat = x.SelectSingleNode("TaskStatus").InnerText;
                string prid     = x.SelectSingleNode("ProjectId").InnerText;

                if (taskstat == "todo" && prid == proid)
                {
                    count = count + 1;
                }
            }

            string value = Convert.ToString(count);

            //  MessageBox.Show(value);
            if (todoCount == count)
            {
                MessageBox.Show("Oooopss you have reached to the limit of Todo  first complete the Task and then add more task");
            }
            else
            {
                var gotocreatetask = new Createtask(proid);
                gotocreatetask.Show();
                this.Close();
            }
        }
        public Createtask(string proid)
        {
            id            = proid;
            taskprojectid = proid;
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            var           gettasks       = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
            var           alltaskproject = from s in gettasks where s.ProjectId.Equals(proid) select s;
            var           xc             = gettasks.Select(f => f.ProjectId == proid);
            List <string> relatedtask    = new List <string>();

            relatedtask.Add("No Selection");
            foreach (var q in gettasks)
            {
                if (q.ProjectId == proid)
                {
                    relatedtask.Add(q.TaskId);
                }
            }
            relatedtasks.SelectedItem = "No Selection";
            relatedtasks.ItemsSource  = relatedtask;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var projects       = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
            var projectdetails = from s in projects where s.ProjectId.Equals(proid) select s;

            {
                prodetail.DataContext = projectdetails;
            }

            {
                var tasks = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                if (tasks != null)
                {
                    var todo = from s in tasks where s.ProjectId.Equals(proid) && s.TaskStatus.Contains("todo") select s;

                    {
                        taskstodo.ItemsSource = todo;
                    }
                }
                {
                    var inprogress = from s in tasks where s.ProjectId.Equals(proid) && s.TaskStatus.Contains("workinprogress") select s;

                    {
                        tasksinprogress.ItemsSource = inprogress;
                    }
                }

                {
                    var done = from s in tasks where s.ProjectId.Equals(proid) && s.TaskStatus.Contains("done") select s;

                    {
                        tasksdone.ItemsSource = done;
                    }
                }
            }
        }
        // To fetch the list of projects from Projects.xml file on window load
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var projects = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");

            Projectlistview.ItemsSource = projects;
        }
Esempio n. 8
0
        // fetching the values from different listview and displaying it on task detail page.
        public Taskdetail(string tastodoid, string tasinprogressid, string tasdoneid, string proid)
        {
            id = proid;
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            {
                //Based on TODO
                if (tastodoid != null)
                {
                    string tastodoids     = tastodoid;
                    var    tasktododetail = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                    var    tasktododata   = from s in tasktododetail where s.TaskId.Equals(tastodoid) select s;
                    {
                        taskdetailsstk.DataContext = tasktododata;

                        XmlDocument docum = new XmlDocument();
                        docum.Load("Tasks.xml");
                        foreach (XmlNode x in docum.SelectNodes("ArrayOfTask/Task"))
                        {
                            if (x.SelectSingleNode("TaskId").InnerText == tastodoid)
                            {
                                taskstatus.SelectedItem    = x.SelectSingleNode("TaskStatus").InnerText;
                                taskprioritys.SelectedItem = x.SelectSingleNode("TaskPriority").InnerText;
                                valu = x.SelectSingleNode("TaskId").InnerText;
                            }
                        }
                    }
                }

                //Based on Work In progress
                else if (tasinprogressid != null)
                {
                    string tasinprogressids     = tasinprogressid;
                    var    taskinprogressdetail = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                    var    taskinprogressdata   = from s in taskinprogressdetail where s.TaskId.Equals(tasinprogressid) select s;
                    {
                        taskdetailsstk.DataContext = taskinprogressdata;
                        XmlDocument docum = new XmlDocument();
                        docum.Load("Tasks.xml");
                        foreach (XmlNode x in docum.SelectNodes("ArrayOfTask/Task"))
                        {
                            if (x.SelectSingleNode("TaskId").InnerText == tasinprogressid)
                            {
                                taskstatus.SelectedItem    = x.SelectSingleNode("TaskStatus").InnerText;
                                taskprioritys.SelectedItem = x.SelectSingleNode("TaskPriority").InnerText;
                                valu = x.SelectSingleNode("TaskId").InnerText;
                            }
                        }
                    }
                }
                else
                {
                    // Based on Done
                    var taskdonedetail = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                    var taskdonedata   = from s in taskdonedetail where s.TaskId.Equals(tasdoneid) select s;
                    {
                        taskdetailsstk.DataContext = taskdonedata;
                        XmlDocument docum = new XmlDocument();
                        docum.Load("Tasks.xml");
                        foreach (XmlNode x in docum.SelectNodes("ArrayOfTask/Task"))
                        {
                            if (x.SelectSingleNode("TaskId").InnerText == tasdoneid)
                            {
                                taskstatus.SelectedItem    = x.SelectSingleNode("TaskStatus").InnerText;
                                taskprioritys.SelectedItem = x.SelectSingleNode("TaskPriority").InnerText;
                                valu = x.SelectSingleNode("TaskId").InnerText;
                            }
                        }
                    }
                }


                var           gettasks       = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                var           alltaskproject = from s in gettasks where s.ProjectId.Equals(proid) select s;
                var           xc             = gettasks.Select(f => f.ProjectId == proid);
                List <string> relatedtask    = new List <string>();
                relatedtask.Add("No Selection");
                foreach (var q in gettasks)
                {
                    if (q.ProjectId == proid)
                    {
                        relatedtask.Add(q.TaskId);
                    }
                }
                relatedtasks.ItemsSource = relatedtask;
                // relatedtasks.SelectedItem = brg.TaskId;


                XmlDocument doc = new XmlDocument();
                doc.Load("Tester.xml");
                foreach (XmlNode node in doc.SelectNodes("ArrayOfTask/TasksDependency"))
                {
                    string rdependenttaskidxml = node.SelectSingleNode("DependentTaskID").InnerText;
                    string rselecttaskidxml    = node.SelectSingleNode("TaskId").InnerText;
                    if (rselecttaskidxml == valu & rdependenttaskidxml != "")
                    {
                        relatedtasks.SelectedItem = node.SelectSingleNode("DependentTaskID").InnerText;
                    }
                }
            }
        }
Esempio n. 9
0
        //Update task
        private void Btn_updatetaskd_Click(object sender, RoutedEventArgs e)
        {
            // to get and the task status from the combobox to check work in progress condition
            var tsk  = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
            var tssk = new ObservableCollection <Task>();
            var br   = tsk.First(f => f.TaskId == updatetaskid.Text);

            br.TaskStatus = taskstatus.SelectionBoxItem.ToString();

            // to get the value of work in progress for the project.
            var    project  = TestStorage.ReadXml <ObservableCollection <Project> >("Projects.xml");
            var    proj     = new ObservableCollection <Project>();
            var    pr       = project.First(f => f.ProjectId == id);
            string wipcount = pr.WorkInProgressLimit;
            int    wipCount = Convert.ToInt32(wipcount);
            // MessageBox.Show(wipcount);

            // to get the number of tasks which have number of taskstatus as work in progress
            XmlDocument docu = new XmlDocument();

            docu.Load("Tasks.xml");
            int count = 0;

            string selectval = relatedtasks.SelectedItem.ToString();

            foreach (XmlNode x in docu.SelectNodes("ArrayOfTask/Task"))
            {
                string taskstat = x.SelectSingleNode("TaskStatus").InnerText;
                string prid     = x.SelectSingleNode("ProjectId").InnerText;
                string tsid     = x.SelectSingleNode("TaskId").InnerText;

                if (taskstat == "workinprogress" && prid == id)
                {
                    count = count + 1;
                }

                if (selectval == tsid)
                {
                    selectedtaskstatus = x.SelectSingleNode("TaskStatus").InnerText;
                }
            }
            string value = Convert.ToString(count);

            // MessageBox.Show(value);

            if (relatedtasks.SelectedItem.ToString() != "No Selection" & (br.TaskStatus == "done" || br.TaskStatus == "workinprogress") & selectedtaskstatus != "done")
            {
                string selecttask = relatedtasks.SelectedItem.ToString();
                MessageBox.Show("Sorry task is dependent on Task " + selecttask + " Complete it inorder to update");
            }
            else
            if (wipCount == count & br.TaskStatus != "done")
            {
                MessageBox.Show("Oooopss you have reached to the limit No. of Tasks as Work in progress first complete other Task and then add more task in Progress");
            }
            else
            {
                var tak  = TestStorage.ReadXml <ObservableCollection <Task> >("Tasks.xml");
                var task = new ObservableCollection <Task>();
                var ps   = tak.First(f => f.TaskId == updatetaskid.Text);
                ps.TaskTitle       = dtaskTitle.Text;
                ps.TaskDescription = dtaskDescription.Text;
                ps.TaskPriority    = taskprioritys.SelectionBoxItem.ToString();
                ps.TaskNotes       = dtaskNote.Text;
                ps.TaskStatus      = taskstatus.SelectionBoxItem.ToString();

                if (string.IsNullOrEmpty(dtaskTitle.Text) || string.IsNullOrEmpty(dtaskDescription.Text) || string.IsNullOrEmpty(dtaskNote.Text))
                {
                    MessageBox.Show("Please enter all the values");
                }
                else
                {
                    TestStorage.WriteXml <ObservableCollection <Task> >(tak, "Tasks.xml");
                    var gotokanbanboard = new Kanbanboard(id);
                    gotokanbanboard.Show();
                    this.Close();
                }
            }
        }