Example #1
0
        private void Btn_Canceld_Click(object sender, RoutedEventArgs e)
        {
            var gotokanbanboard = new Kanbanboard(id);

            gotokanbanboard.Show();
            this.Close();
        }
Example #2
0
        // Delete Task
        private void Btn_deletetaskd_Click(object sender, RoutedEventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("Tasks.xml");
            foreach (XmlNode x in doc.SelectNodes("ArrayOfTask/Task"))
            {
                if (x.SelectSingleNode("TaskId").InnerText == updatetaskid.Text)
                {
                    x.ParentNode.RemoveChild(x);
                    doc.Save("Tasks.xml");
                }
            }
            MessageBox.Show("Deleted!!!!!");

            XmlDocument docu = new XmlDocument();

            docu.Load("Tester.xml");
            foreach (XmlNode x in docu.SelectNodes("ArrayOfTasksDependency/TasksDependency"))
            {
                if (x.SelectSingleNode("TaskId").InnerText == updatetaskid.Text)
                {
                    x.ParentNode.RemoveChild(x);
                    doc.Save("Tester.xml");
                }
            }
            var gotokanbanboard = new Kanbanboard(id);

            gotokanbanboard.Show();
            this.Close();
        }
        // fetches the Projectid of selected item from Projectlistview and pass it to kanbanboard class.
        private void Projectlistview_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var proj = new Project();

            proj = (Project)Projectlistview.SelectedItem;
            string id = proj.ProjectId;
            var    gotokanbanboard = new Kanbanboard(id);

            gotokanbanboard.Show();
            this.Close();
        }
Example #4
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();
                }
            }
        }
        private void Btn_createtask_Click(object sender, RoutedEventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("Tasks.xml");
            XmlNode task  = doc.CreateElement("Task");
            int     count = 0;

            foreach (XmlNode xn in doc.SelectNodes("ArrayOfTask/Task"))
            {
                count = count + 1;
            }
            int Count = count + 1;

            try
            {
                //Projectid
                XmlNode ProjectId = doc.CreateElement("ProjectId");
                ProjectId.InnerText = taskprojectid;
                task.AppendChild(ProjectId);

                //TaskId

                tasid = Convert.ToString(Count);

                XmlNode TaskId = doc.CreateElement("TaskId");
                TaskId.InnerText = tasid;
                task.AppendChild(TaskId);
                //TaskTitle
                XmlNode TaskTitle = doc.CreateElement("TaskTitle");
                TaskTitle.InnerText = taskTitle.Text;
                task.AppendChild(TaskTitle);
                // project description
                XmlNode TaskDescription = doc.CreateElement("TaskDescription");
                TaskDescription.InnerText = taskDescription.Text;
                task.AppendChild(TaskDescription);
                // startDate
                XmlNode TaskPriority = doc.CreateElement("TaskPriority");
                TaskPriority.InnerText = taskPriority.SelectionBoxItem.ToString();
                task.AppendChild(TaskPriority);
                // end date
                XmlNode TaskNotes = doc.CreateElement("TaskNotes");
                TaskNotes.InnerText = taskNotes.Text;
                task.AppendChild(TaskNotes);
                //ToDoLimit
                XmlNode TaskStatus = doc.CreateElement("TaskStatus");
                TaskStatus.InnerText = taskStatus.SelectionBoxItem.ToString();
                task.AppendChild(TaskStatus);
                doc.DocumentElement.AppendChild(task);


                if (string.IsNullOrEmpty(taskTitle.Text) || string.IsNullOrEmpty(taskDescription.Text) || string.IsNullOrEmpty(taskNotes.Text))
                {
                    MessageBox.Show("Please enter all the values");
                }

                else
                {
                    XmlDocument xddoc = new XmlDocument();
                    xddoc.Load("Tester.xml");
                    XmlNode tasksdependency = xddoc.CreateElement("TasksDependency");
                    XmlNode taskid          = xddoc.CreateElement("TaskId");
                    XmlNode dependentaskid  = xddoc.CreateElement("DependentTaskID");
                    taskid.InnerText         = tasid;
                    dependentaskid.InnerText = relatedtasks.SelectedItem.ToString();
                    tasksdependency.AppendChild(taskid);
                    tasksdependency.AppendChild(dependentaskid);

                    successMsg.Visibility = Visibility.Visible;
                    xddoc.DocumentElement.AppendChild(tasksdependency);
                    xddoc.Save("Tester.xml");
                    doc.Save("Tasks.xml");

                    var gotokanbanboard = new Kanbanboard(id);
                    gotokanbanboard.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }