예제 #1
0
        public static bool UpdateProjectDetail(ProjectDetail project)
        {
            bool status;

            using (var myContext = new ProjectManagementEntities())
            {
                try
                {
                    ProjectDetail projectItemInfo = myContext.ProjectDetails.Where(p => p.Id == project.Id).FirstOrDefault();
                    if (projectItemInfo != null)
                    {
                        projectItemInfo.Id          = project.Id;
                        projectItemInfo.ManagerId   = project.ManagerId;
                        projectItemInfo.Priority    = project.Priority;
                        projectItemInfo.ProjectDesc = project.ProjectDesc;
                        projectItemInfo.StartDate   = project.StartDate;
                        projectItemInfo.EndDate     = project.EndDate;
                        projectItemInfo.StatusId    = project.StatusId;
                        myContext.SaveChanges();
                    }

                    status = true;
                }
                catch (Exception)
                {
                    status = false;
                }
            }
            return(status);
        }
예제 #2
0
        public static bool InsertProjectDetail(ProjectDetail project)
        {
            bool status;

            project.StatusId = 1;
            using (var myContext = new ProjectManagementEntities())
            {
                try
                {
                    myContext.ProjectDetails.Add(project);
                    myContext.SaveChanges();
                    status = true;
                }
                catch (Exception ex)
                {
                    status = false;
                }
            }

            return(status);
        }
예제 #3
0
        public static bool DeleteProject(int id)
        {
            bool status;

            using (var myContext = new ProjectManagementEntities())
            {
                try
                {
                    ProjectDetail prodItem = myContext.ProjectDetails.Where(p => p.Id == id).FirstOrDefault();
                    if (prodItem != null)
                    {
                        myContext.ProjectDetails.Remove(prodItem);
                        myContext.SaveChanges();
                    }
                    status = true;
                }
                catch (Exception)
                {
                    status = false;
                }
            }
            return(status);
        }