コード例 #1
0
 public int AddUser(Models.User user)
 {
     using (dbContext)
     {
         dbContext.Users.Add(new ProjMgrDAC.User()
         {
             Last_Name   = user.LastName,
             First_Name  = user.FirstName,
             Employee_ID = user.EmployeeId
         });
         return(dbContext.SaveChanges());
     }
 }
コード例 #2
0
ファイル: ProjBc.cs プロジェクト: ITPrasun/sba_iiht
 public int AddProject(Models.Project project)
 {
     using (dbContext)
     {
         ProjMgrDAC.Project proj = new ProjMgrDAC.Project()
         {
             Project_Name = project.ProjectName,
             Start_Date   = project.ProjectStartDate,
             End_Date     = project.ProjectEndDate,
             Priority     = project.Priority
         };
         dbContext.Projects.Add(proj);
         dbContext.SaveChanges();
         var editDetails = (from editUser in dbContext.Users
                            where editUser.User_ID.ToString().Contains(project.User.UserId.ToString())
                            select editUser).First();
         if (editDetails != null)
         {
             editDetails.Project_ID = proj.Project_ID;
         }
         return(dbContext.SaveChanges());
     }
 }
コード例 #3
0
        public int InsertTask(Models.Task task)
        {
            using (dbContext)
            {
                if (task.Priority == 0)
                {
                    dbContext.ParentTasks.Add(new ProjMgrDAC.ParentTask()
                    {
                        Parent_Task_Name = task.TaskName
                    });
                }
                else
                {
                    ProjMgrDAC.Task taskDetail = new ProjMgrDAC.Task()
                    {
                        Task_Name  = task.TaskName,
                        Project_ID = task.ProjectID,
                        Start_Date = task.StartDate,
                        End_Date   = task.EndDate,
                        Parent_ID  = task.ParentID,
                        Priority   = task.Priority,
                        Status     = task.Status
                    };
                    dbContext.Tasks.Add(taskDetail);
                    dbContext.SaveChanges();

                    var editDetails = (from editUser in dbContext.Users
                                       where editUser.User_ID.ToString().Contains(task.User.UserId.ToString())
                                       select editUser).ToList();
                    if (editDetails != null && editDetails.Count > 0)
                    {
                        editDetails.First().Task_ID = taskDetail.Task_ID;
                    }
                }
                return(dbContext.SaveChanges());
            }
        }