public IEnumerable <Tasks> GetTask() { var listOfTasks = new List <Tasks>(); using (var TaskDBcontext = new TaskDBEntities()) { foreach (var task in TaskDBcontext.Tasks) { listOfTasks.Add(new Tasks() { Task_ID = task.Task_ID, TaskName = task.Task1, Start_Date = task.Start_Date, End_Date = task.End_Date, Priority = task.Priority, Parent_ID = task.Parent_ID, ParentTask = task.Parent_ID.HasValue ? GetParentInfo(task.Parent_ID.Value) : null, IsTaskEnded = task.IsTaskEnded, Project_ID = task.Project_ID, ProjectInfo = task.Project_ID.HasValue ? GetProjectInfo(task.Project_ID.Value) : null, }); } } return(listOfTasks); }
public Tasks GetTask(int id) { Tasks objTask = null; using (var TaskDBcontext = new TaskDBEntities()) { var task = TaskDBcontext.Tasks.FirstOrDefault(x => x.Task_ID == id); if (task != null) { objTask = new Tasks() { Task_ID = task.Task_ID, TaskName = task.Task1, Start_Date = task.Start_Date, End_Date = task.End_Date, Priority = task.Priority, Parent_ID = task.Parent_ID, ParentTask = task.Parent_ID.HasValue ? GetParentInfo(task.Parent_ID.Value) : null, IsTaskEnded = task.IsTaskEnded, Project_ID = task.Project_ID, ProjectInfo = task.Project_ID.HasValue ? GetProjectInfo(task.Project_ID.Value) : null, }; } } return(objTask); }
public IEnumerable <ParentTasks> GetTask() { var listOfTasks = new List <ParentTasks>(); var ParentTasklist = new TaskDBEntities().ParentTasks; var MainTasklist = new TaskDBEntities().Tasks; foreach (var task in ParentTasklist) { listOfTasks.Add(new ParentTasks() { Parent_ID = task.Parent_ID, Parent_Task = task.Parent_Task, ParentTaskType = enumParentTaskType.Parent.ToString() }); } ; foreach (var task in MainTasklist) { listOfTasks.Add(new ParentTasks() { Parent_ID = task.Task_ID, Parent_Task = task.Task1, ParentTaskType = enumParentTaskType.Main.ToString() }); } return(listOfTasks); }
public void AddTask(ParentTasks TasksModel) { var TaskDBcontext = new TaskDBEntities(); var task = new ParentTask(); task.Parent_ID = TasksModel.Parent_ID; task.Parent_Task = TasksModel.Parent_Task; TaskDBcontext.ParentTasks.Add(task); TaskDBcontext.SaveChanges(); }
public void Delete(int id) { var ObjDBcontext = new TaskDBEntities(); var user = ObjDBcontext.Users.FirstOrDefault(x => x.User_ID == id); if (user != null) { ObjDBcontext.Users.Remove(user); ObjDBcontext.SaveChanges(); } }
public void EndTask(int id) { var TaskDBcontext = new TaskDBEntities(); var task = TaskDBcontext.Tasks.FirstOrDefault(x => x.Task_ID == id); if (task != null) { task.IsTaskEnded = 1; TaskDBcontext.SaveChanges(); } }
public void DeleteTask(int id) { var TaskDBcontext = new TaskDBEntities(); var task = TaskDBcontext.ParentTasks.FirstOrDefault(x => x.Parent_ID == id); if (task != null) { TaskDBcontext.ParentTasks.Remove(task); TaskDBcontext.SaveChanges(); } }
public void Add(Users ObjModel) { var ObjDBcontext = new TaskDBEntities(); var Objuser = new User(); Objuser.First_Name = ObjModel.First_Name; Objuser.Last_Name = ObjModel.Last_Name; Objuser.Employee_ID = ObjModel.Employee_ID; ObjDBcontext.Users.Add(Objuser); ObjDBcontext.SaveChanges(); }
public void Delete(int id) { using (var ObjDBcontext = new TaskDBEntities()) { var model = ObjDBcontext.Projects.FirstOrDefault(x => x.Project_ID == id); if (model != null) { ObjDBcontext.Projects.Remove(model); ObjDBcontext.SaveChanges(); } } }
public void AddTask(ParentTasks model) { using (var TaskDBcontext = new TaskDBEntities()) { var task = new ParentTask(); task.Parent_ID = model.Parent_ID; task.Parent_Task = model.Parent_Task; task.Project_ID = model.Project_ID; TaskDBcontext.ParentTasks.Add(task); TaskDBcontext.SaveChanges(); } }
public void UpdateTask(int id, ParentTasks TasksModel) { var TaskDBcontext = new TaskDBEntities(); var task = TaskDBcontext.ParentTasks.FirstOrDefault(x => x.Parent_ID == id); if (task != null) { task.Parent_ID = TasksModel.Parent_ID; task.Parent_Task = TasksModel.Parent_Task; TaskDBcontext.SaveChanges(); } }
public void Update(int id, Users ObjModel) { var ObjDBcontext = new TaskDBEntities(); var user = ObjDBcontext.Users.FirstOrDefault(x => x.User_ID == id); if (user != null) { user.First_Name = ObjModel.First_Name; user.Last_Name = ObjModel.Last_Name; user.Employee_ID = ObjModel.Employee_ID; ObjDBcontext.SaveChanges(); } }
public IEnumerable <Tasks> GetTask() { var listOfTasks = new List <Tasks>(); var MainTaskList = new TaskDBEntities().Tasks; var ParentTaskList = new TaskDBEntities().ParentTasks; Tasks objTask = null; foreach (var task in MainTaskList) { objTask = new Tasks() { Task_ID = task.Task_ID, TaskName = task.Task1, Start_Date = task.Start_Date, End_Date = task.End_Date, Priority = task.Priority, ParentTaskType = task.ParentTaskType, Parent_ID = task.Parent_ID, IsTaskEnded = task.IsTaskEnded }; if (task.ParentTaskType == enumParentTaskType.Parent.ToString()) { var pTask = ParentTaskList.FirstOrDefault(e => e.Parent_ID == task.Parent_ID); if (pTask != null) { objTask.ParentTask = new ParentTasks() { Parent_ID = pTask.Parent_ID, Parent_Task = pTask.Parent_Task }; } } else if (task.ParentTaskType == enumParentTaskType.Main.ToString()) { var MainTask = MainTaskList.FirstOrDefault(e => e.Task_ID == task.Parent_ID); if (MainTask != null) { objTask.ParentTask = new ParentTasks() { Parent_ID = MainTask.Task_ID, Parent_Task = MainTask.Task1 }; } } listOfTasks.Add(objTask); } return(listOfTasks); }
public void Add(ProjectInfo model) { using (var ObjDBcontext = new TaskDBEntities()) { var ObjModel = new Project(); ObjModel.Project1 = model.Project1; ObjModel.Start_Date = model.Start_Date; ObjModel.End_Date = model.End_Date; ObjModel.End_Date = model.End_Date; ObjModel.Priority = model.Priority; ObjModel.User_ID = model.User_ID; ObjDBcontext.Projects.Add(ObjModel); ObjDBcontext.SaveChanges(); } }
public ParentTasks GetTask(int id) { ParentTasks Tasks = null; var task = new TaskDBEntities().ParentTasks.FirstOrDefault(x => x.Parent_ID == id); if (task != null) { Tasks = new ParentTasks() { Parent_ID = task.Parent_ID, Parent_Task = task.Parent_Task }; } return(Tasks); }
public Tasks GetTask(int id) { Tasks objTask = null; var task = new TaskDBEntities().Tasks.FirstOrDefault(x => x.Task_ID == id); if (task != null) { objTask = new Tasks() { Task_ID = task.Task_ID, TaskName = task.Task1, Start_Date = task.Start_Date, End_Date = task.End_Date, Priority = task.Priority, Parent_ID = task.Parent_ID, ParentTaskType = task.ParentTaskType, IsTaskEnded = task.IsTaskEnded }; if (task.ParentTaskType == enumParentTaskType.Parent.ToString()) { var pTask = new TaskDBEntities().ParentTasks.FirstOrDefault(e => e.Parent_ID == task.Parent_ID); if (pTask != null) { objTask.ParentTask = new ParentTasks() { Parent_ID = pTask.Parent_ID, Parent_Task = pTask.Parent_Task, ParentTaskType = enumParentTaskType.Parent.ToString() }; } } else if (task.ParentTaskType == enumParentTaskType.Main.ToString()) { var MainTask = new TaskDBEntities().Tasks.FirstOrDefault(e => e.Task_ID == task.Parent_ID); if (MainTask != null) { objTask.ParentTask = new ParentTasks() { Parent_ID = MainTask.Task_ID, Parent_Task = MainTask.Task1, ParentTaskType = enumParentTaskType.Main.ToString() }; } } } return(objTask); }
public void AddTask(Tasks TasksModel) { var TaskDBcontext = new TaskDBEntities(); var task = new Task(); task.Task_ID = TasksModel.Task_ID; task.Task1 = TasksModel.TaskName; task.Start_Date = TasksModel.Start_Date; task.End_Date = TasksModel.End_Date; task.Priority = TasksModel.Priority; task.Parent_ID = TasksModel.Parent_ID; task.ParentTaskType = TasksModel.ParentTaskType; task.IsTaskEnded = TasksModel.IsTaskEnded; TaskDBcontext.Tasks.Add(task); TaskDBcontext.SaveChanges(); }
public void Update(int id, ProjectInfo model) { using (var ObjDBcontext = new TaskDBEntities()) { var ObjModel = ObjDBcontext.Projects.FirstOrDefault(x => x.Project_ID == id); if (ObjModel != null) { ObjModel.Project1 = model.Project1; ObjModel.Start_Date = model.Start_Date; ObjModel.End_Date = model.End_Date; ObjModel.End_Date = model.End_Date; ObjModel.Priority = model.Priority; ObjModel.User_ID = model.User_ID; ObjDBcontext.SaveChanges(); } } }
public void AddTask(Tasks model) { using (var TaskDBcontext = new TaskDBEntities()) { var task = new Task(); task.Task_ID = model.Task_ID; task.Task1 = model.TaskName; task.Start_Date = model.Start_Date; task.End_Date = model.End_Date; task.Priority = model.Priority; task.Parent_ID = model.Parent_ID; task.IsTaskEnded = model.IsTaskEnded; task.Project_ID = model.Project_ID; TaskDBcontext.Tasks.Add(task); TaskDBcontext.SaveChanges(); } }
public Users Get(int id) { Users objUsers = null; var user = new TaskDBEntities().Users.FirstOrDefault(x => x.User_ID == id); if (user != null) { objUsers = new Users() { User_ID = user.User_ID, First_Name = user.First_Name, Last_Name = user.Last_Name, Employee_ID = user.Employee_ID }; } return(objUsers); }
public void UpdateTask(int id, Tasks TasksModel) { var TaskDBcontext = new TaskDBEntities(); var task = TaskDBcontext.Tasks.FirstOrDefault(x => x.Task_ID == id); if (task != null) { task.Task_ID = TasksModel.Task_ID; task.Task1 = TasksModel.TaskName; task.Start_Date = TasksModel.Start_Date; task.End_Date = TasksModel.End_Date; task.Priority = TasksModel.Priority; task.Parent_ID = TasksModel.Parent_ID; task.ParentTaskType = TasksModel.ParentTaskType; task.IsTaskEnded = TasksModel.IsTaskEnded; TaskDBcontext.SaveChanges(); } }
private ParentTasks GetParentInfo(int ID) { var ObjModel = new ParentTasks(); using (var ObjDBcontext = new TaskDBEntities()) { var pTask = ObjDBcontext.ParentTasks.FirstOrDefault(e => e.Parent_ID == ID); if (pTask != null) { ObjModel = new ParentTasks() { Parent_ID = pTask.Parent_ID, Parent_Task = pTask.Parent_Task, Project_ID = pTask.Project_ID }; } } return(ObjModel); }
public IEnumerable <Users> Get() { var listOfusers = new List <Users>(); var Users = new TaskDBEntities().Users; foreach (var user in Users) { listOfusers.Add(new Users() { User_ID = user.User_ID, First_Name = user.First_Name, Last_Name = user.Last_Name, Employee_ID = user.Employee_ID }); } ; return(listOfusers); }
private Users getUserInfo(int?UserID) { var objuser = new Users(); using (var ObjDBcontext = new TaskDBEntities()) { var user = ObjDBcontext.Users.FirstOrDefault(x => x.User_ID == UserID); if (user != null) { objuser = new Users() { User_ID = user.User_ID, First_Name = user.First_Name, Last_Name = user.Last_Name, Employee_ID = user.Employee_ID }; } } return(objuser); }
private ProjectInfo GetProjectInfo(int ProjectID) { var ObjModel = new ProjectInfo(); using (var ObjDBcontext = new TaskDBEntities()) { var model = ObjDBcontext.Projects.FirstOrDefault(x => x.Project_ID == ProjectID); if (model != null) { ObjModel = new ProjectInfo() { Project_ID = model.Project_ID, Project1 = model.Project1, Start_Date = model.Start_Date, End_Date = model.End_Date, Priority = model.Priority, User_ID = model.User_ID }; } } return(ObjModel); }
public ProjectInfo Get(int id) { ProjectInfo ObjModel = null; using (var ObjDBcontext = new TaskDBEntities()) { var model = ObjDBcontext.Projects.FirstOrDefault(x => x.User_ID == id); if (model != null) { ObjModel = new ProjectInfo() { Project_ID = model.Project_ID, Project1 = model.Project1, Start_Date = model.Start_Date, End_Date = model.End_Date, Priority = model.Priority, User_ID = model.User_ID, UserInfo = model.User_ID.HasValue ? getUserInfo(model.User_ID) : null }; } } return(ObjModel); }
public IEnumerable <ProjectInfo> Get() { var ListInfo = new List <ProjectInfo>(); using (var ObjDBcontext = new TaskDBEntities()) { foreach (var model in ObjDBcontext.Projects) { ListInfo.Add(new ProjectInfo() { Project_ID = model.Project_ID, Project1 = model.Project1, Start_Date = model.Start_Date, End_Date = model.End_Date, Priority = model.Priority, User_ID = model.User_ID, UserInfo = model.User_ID.HasValue ? getUserInfo(model.User_ID) : null }); } } return(ListInfo); }