Beispiel #1
0
        public int UpdateTask(int TaskId, bool taskStatus)
        {
            int Retval = -1;
            ProductDBEntities tstDb    = new ProductDBEntities();
            ProjectTaskInfo   tempProd = new ProjectTaskInfo();;



            TblTask result = tstDb.TblTasks.SingleOrDefault(b => b.Task_ID == TaskId);

            if (result != null)
            {
                result.Status             = taskStatus;
                tstDb.Entry(result).State = EntityState.Modified;
                Retval = tstDb.SaveChanges();
            }
            return(Retval);
        }
Beispiel #2
0
        public int AddTask(int ParentId, int ProjectId, string Task, DateTime StartDate, DateTime EndDate, int Priority, bool status, int UserID)
        {
            int Retval = -1;

            try
            {
                TblTask usrTask = new TblTask();
                usrTask.Parent_ID  = ParentId;
                usrTask.Project_ID = ProjectId;
                usrTask.Task       = Task;
                usrTask.StartDate  = StartDate;
                usrTask.EndDate    = EndDate;
                usrTask.Priority   = Priority;
                usrTask.Status     = status;

                var context = new ProductDBEntities();
                context.TblTasks.Add(usrTask);
                context.Entry(usrTask).State = EntityState.Added;
                Retval = context.SaveChanges();
                int newTaskId = -1;
                newTaskId = context.TblTasks.Max(p => p.Task_ID);

                UserInfo detailmyuser = GetAllUsersById(UserID);
                int      ret          = UpdateUser(UserID, detailmyuser.FirstName, detailmyuser.LastName, ProjectId, detailmyuser.Employee_ID, newTaskId);


                //context.SaveChanges();

                return(ret);
                ///
            }
            catch (DbEntityValidationException EX)
            {
                foreach (DbEntityValidationResult entityErr in
                         EX.EntityValidationErrors)
                {
                    foreach (DbValidationError error in entityErr.ValidationErrors)
                    {
                        Console.WriteLine("Error: {0}", error.ErrorMessage);
                    }
                }
            }
            return(Retval);
        }
Beispiel #3
0
        public int UpdateTaskDetails(int TaskId, int ParentId, int ProjectId, string Task, DateTime StartDate, DateTime EndDate, int Priority, bool status)
        {
            int Retval = -1;
            ProductDBEntities tstDb    = new ProductDBEntities();
            ProjectTaskInfo   tempProd = new ProjectTaskInfo();;



            TblTask result = tstDb.TblTasks.SingleOrDefault(b => b.Task_ID == TaskId);

            if (result != null)
            {
                result.Parent_ID          = ParentId;
                result.Project_ID         = ProjectId;
                result.Task               = Task;
                result.StartDate          = StartDate;
                result.EndDate            = EndDate;
                result.Priority           = Priority;
                result.Status             = status;
                tstDb.Entry(result).State = EntityState.Modified;
                Retval = tstDb.SaveChanges();
            }
            return(Retval);
        }