Пример #1
0
        /// <summary>
        /// Ajoute un enregistrement dans une liste d'un onglet sélectionner
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            // ajouter un projet
            if (TBC_Project.SelectedTab == TBP_ListProject)
            {
                project addProject = new project()
                {
                    identifier = getIdentifierProject()
                };

                EditProject editProject = new EditProject(addProject);
                editProject.StartPosition = FormStartPosition.CenterParent;
                if (editProject.ShowDialog() == DialogResult.OK)
                {
                    if (!String.IsNullOrWhiteSpace(addProject.name))
                    {
                        _ProjectManagement.ListProject.Add(addProject);
                        hasChanges = true;
                    }
                }
            }

            // ajouter un type de tâche
            else if (TBC_Project.SelectedTab == TBP_ListTypeTask)
            {
                taskType addTaskType = new taskType()
                {
                    identifier = getIdentifierTaskType()
                };

                EditTaskType editTaskType = new EditTaskType(addTaskType);
                editTaskType.StartPosition = FormStartPosition.CenterParent;
                if (editTaskType.ShowDialog() == DialogResult.OK)
                {
                    //TODO verif
                    _ProjectManagement.ListTaskType.Add(addTaskType);
                    hasChanges = true;
                }
            }

            //ajouter une tache
            else if (TBC_Project.SelectedTab == TBP_ListTask)
            {
                task addTask = new task()
                {
                    Identifier = getIdentifierTask()
                };

                EditTask editTask = new EditTask(_ProjectManagement.ListProject, _ProjectManagement.ListTaskType, addTask);
                editTask.StartPosition = FormStartPosition.CenterParent;
                if (editTask.ShowDialog() == DialogResult.OK)
                {
                    //TODO verif
                    _ProjectManagement.ListTask.Add(addTask);
                    hasChanges = true;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Modifie un enregistrement sélectionner dans une liste d'un onglet sélectionner
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIT_Open_Click(object sender, EventArgs e)
        {
            // ouvrir la liste des projets
            if (TBC_Project.SelectedTab == TBP_ListProject && DTG_Project.SelectedRows[0].DataBoundItem != null)
            {
                project selectedProject = DTG_Project.SelectedRows[0].DataBoundItem as project;


                EditProject editProject = new EditProject(selectedProject);
                editProject.StartPosition = FormStartPosition.CenterParent;
                if (editProject.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListProject.Remove(selectedProject);
                    _ProjectManagement.ListProject.Add(selectedProject);
                    hasChanges = true;
                }
            }

            // ouvrir la liste des types de tâches
            else if (TBC_Project.SelectedTab == TBP_ListTypeTask && DTG_ListeTaskType.SelectedRows[0].DataBoundItem != null)
            {
                taskType selectedTaskType = DTG_ListeTaskType.SelectedRows[0].DataBoundItem as taskType;

                EditTaskType editTaskType = new EditTaskType(selectedTaskType);
                editTaskType.StartPosition = FormStartPosition.CenterParent;
                if (editTaskType.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListTaskType.Remove(selectedTaskType);
                    _ProjectManagement.ListTaskType.Add(selectedTaskType);
                    hasChanges = true;
                }
            }

            // ouvrir la liste des tâches
            else if (TBC_Project.SelectedTab == TBP_ListTask && DTG_ListTask.SelectedRows[0].DataBoundItem != null)
            {
                task selectedTask = DTG_ListTask.SelectedRows[0].DataBoundItem as task;

                EditTask editTask = new EditTask(_ProjectManagement.ListProject, _ProjectManagement.ListTaskType, selectedTask);
                editTask.StartPosition = FormStartPosition.CenterParent;
                if (editTask.ShowDialog() == DialogResult.OK)
                {
                    _ProjectManagement.ListTask.Remove(selectedTask);
                    _ProjectManagement.ListTask.Add(selectedTask);
                    hasChanges = true;
                }
            }
        }