Exemplo n.º 1
0
        public bool AddTask(Task task)
        {
            using (FSDEntities db = new FSDEntities())
            {
                if (task.Start_Date != Convert.ToDateTime("01-01-0001 00:00:00"))
                {
                    Task taskManager = new Task();
                    taskManager.Task_Name  = task.Task_Name;
                    taskManager.Parent_Id  = task.Parent_Id;
                    taskManager.Priority   = task.Priority;
                    taskManager.Start_Date = task.Start_Date;
                    taskManager.End_Date   = task.End_Date;
                    taskManager.Staus      = true;
                    taskManager.Project_Id = task.Project_Id;

                    db.Tasks.Add(taskManager);
                    db.SaveChanges();
                }

                else
                {
                    Parent_Task parent = new Parent_Task();
                    parent.Parent_Task1 = task.Task_Name;
                    db.Parent_Task.Add(parent);
                    db.SaveChanges();
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool UpdateUser(User user)
        {
            try
            {
                using (FSDEntities db = new FSDEntities())
                {
                    var userData = (from p in db.Users
                                    where p.User_Id == user.User_Id
                                    select p).FirstOrDefault();
                    if (userData != null)
                    {
                        userData.First_Name  = user.First_Name;
                        userData.Last_Name   = user.Last_Name;
                        userData.Employee_id = user.Employee_id;

                        db.SaveChanges();
                        return(true);
                    }

                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public bool UpdateTask(Task task)
        {
            using (FSDEntities db = new FSDEntities())
            {
                db.Configuration.ProxyCreationEnabled = false;

                var taskManager = (from p in db.Tasks
                                   where p.Task_Id == task.Task_Id
                                   select p).FirstOrDefault();
                if (taskManager != null)
                {
                    taskManager.Task_Name  = task.Task_Name;
                    taskManager.Parent_Id  = task.Parent_Id;
                    taskManager.Priority   = task.Priority;
                    taskManager.Start_Date = task.Start_Date;
                    taskManager.End_Date   = task.End_Date;
                    taskManager.Staus      = true;
                    taskManager.Project_Id = task.Project_Id;
                    db.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 4
0
        public bool UpdateProject(Project project)
        {
            try
            {
                using (FSDEntities db = new FSDEntities())
                {
                    db.Configuration.ProxyCreationEnabled = false;

                    var projectData = (from p in db.Projects
                                       where p.Project_Id == project.Project_Id
                                       select p).FirstOrDefault();
                    if (projectData != null)
                    {
                        projectData.Project_Name = project.Project_Name;
                        projectData.Start_Date   = project.Start_Date;
                        projectData.End_Date     = project.End_Date;
                        projectData.Manager_Id   = project.Manager_Id;
                        projectData.Priority     = project.Priority;

                        db.SaveChanges();
                        return(true);
                    }

                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public bool AddUser(User user)
        {
            using (FSDEntities db = new FSDEntities())
            {
                User taskManager = new User();
                taskManager.Employee_id = user.Employee_id;
                taskManager.First_Name  = user.First_Name;
                taskManager.Last_Name   = user.Last_Name;

                db.Users.Add(taskManager);
                db.SaveChanges();
            }
            return(true);
        }
Exemplo n.º 6
0
        public bool AddProject(Project project)
        {
            using (FSDEntities db = new FSDEntities())
            {
                Project projectData = new Project();
                projectData.Project_Name = project.Project_Name;
                projectData.Start_Date   = project.Start_Date;
                projectData.End_Date     = project.End_Date;
                projectData.Manager_Id   = project.Manager_Id;
                projectData.Priority     = project.Priority;

                db.Projects.Add(projectData);
                db.SaveChanges();
            }
            return(true);
        }
Exemplo n.º 7
0
        public bool DeleteUser(int userId)
        {
            try
            {
                using (FSDEntities db = new FSDEntities())
                {
                    var userData = (from p in db.Users
                                    where p.User_Id == userId
                                    select p).FirstOrDefault();
                    db.Users.Remove(userData);
                    db.SaveChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 8
0
        public bool EndTask(int id)
        {
            using (FSDEntities db = new FSDEntities())
            {
                db.Configuration.ProxyCreationEnabled = false;

                var taskData = (from p in db.Tasks
                                where p.Task_Id == id
                                select p).FirstOrDefault();
                if (taskData != null)
                {
                    taskData.Staus    = false;
                    taskData.End_Date = System.DateTime.Now;
                    db.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 9
0
        public bool DeleteProject(int projectId)
        {
            try
            {
                using (FSDEntities db = new FSDEntities())
                {
                    db.Configuration.ProxyCreationEnabled = false;

                    var userData = (from p in db.Projects
                                    where p.Project_Id == projectId
                                    select p).FirstOrDefault();
                    db.Projects.Remove(userData);
                    db.SaveChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }