Пример #1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            ProjectTaskDB.SaveChanges();
            Grid parentGrid = (Grid)this.Parent;

            parentGrid.Children.Clear();
            parentGrid.Visibility = System.Windows.Visibility.Collapsed;
        }
Пример #2
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ProjectTaskDB.CancelAllChanges();

                Grid parentGrid = (Grid)this.Parent;
                parentGrid.Children.Clear();
                parentGrid.Visibility = System.Windows.Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public async Task <bool> AddTaskToColumn(ProjectTask task, int columnId)
        {
            //var task = await _databaseContext.Tasks.FindAsync(taskId);
            var taskDb = new ProjectTaskDB()
            {
                Title         = task.Title,
                AssignedUsers = new List <UserDB>(),
                Deadline      = task.Deadline
            };
            var column = await _databaseContext.Columns.FindAsync(columnId);

            taskDb.Column = column;
            await _databaseContext.Tasks.AddAsync(taskDb);

            await _databaseContext.SaveChangesAsync();

            return(true);
        }
Пример #4
0
        public async Task <int> AddTask(ProjectTask task)
        {
            var taskDb = new ProjectTaskDB()
            {
                Title         = task.Title,
                AssignedUsers = new List <UserDB>(),
                Column        = new ColumnDB()
                {
                    Id = task.Column.Id
                },
                Deadline = task.Deadline,
                Comments = new List <CommentDB>()
            };
            await _databaseContext.Tasks.AddAsync(taskDb);

            await _databaseContext.SaveChangesAsync();

            return(taskDb.Id);
        }
Пример #5
0
        private void btnDeleteTask_Click(object sender)
        {
            if (project_taskViewSource.View != null)
            {
                project_taskViewSource.View.Filter = null;
                List <project_task> _project_task = treeProject.ItemsSource.Cast <project_task>().ToList();

                ProjectTaskDB.NumberOfRecords = 0;
                foreach (project_task task in _project_task.Where(x => x.IsSelected == true))
                {
                    if (task.status == Status.Project.Pending)
                    {
                        using (db db = new db())
                        {
                            if (task.id_project_task != 0)
                            {
                                db.project_task.Remove(db.project_task.Where(x => x.id_project_task == task.id_project_task).FirstOrDefault());
                                db.SaveChanges();
                            }
                            else
                            {
                                ProjectTaskDB.Entry(task).State = EntityState.Detached;
                            }
                        }

                        ProjectTaskDB.NumberOfRecords += 1;
                    }
                    else
                    {
                        //ProjectTaskDB.SaveChanges();
                        toolBar_btnAnull_Click(sender);
                    }
                }
                ProjectTaskDB = new entity.ProjectTaskDB();
                ProjectTaskDB.projects.Where(a => a.is_active == true && a.id_company == CurrentSession.Id_Company).Load();//.Include(x => x.project_task).Load();
                projectViewSource.Source           = ProjectTaskDB.projects.Local;
                project_taskViewSource.View.Filter = null;
                project_taskViewSource.View.Refresh();
                filter_task();

                //treeProject.UpdateLayout();
            }
        }