示例#1
0
        public void Delete_Project(int projectID)
        {
            using (Entity ent = new Entity())
            {
                tbl_Projects project = (from context in ent.tbl_Projects
                                        where context.Project_ID == projectID
                                        select context).SingleOrDefault();

                ent.tbl_Projects.Remove(project);
                ent.SaveChanges();
            }
        }
示例#2
0
 public void Update_Project(int projectID, string projectTitle, string projectDesc)
 {
     using (Entity ent = new Entity())
     {
         tbl_Projects project = (from context in ent.tbl_Projects
                                 where context.Project_ID == projectID
                                 select context).SingleOrDefault();
         project.Project_Title       = projectTitle;
         project.Project_Description = projectDesc;
         ent.SaveChanges();
     }
 }
示例#3
0
 public void UpdateProject(tbl_Projects tblProjects)
 {
     try
     {
         IGenericDataRepository <tbl_Projects> repository = new GenericDataRepository <tbl_Projects>();
         repository.Update(tblProjects);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
 public tbl_Projects FindProjectName(string projectName, int clientId, int regionId)
 {
     try
     {
         IGenericDataRepository <tbl_Projects> repository = new GenericDataRepository <tbl_Projects>();
         tbl_Projects Project = repository.GetSingle(c => c.ProjectName.ToUpper() == projectName.ToUpper() && c.ClientId == clientId && c.RegionId == regionId);
         return(Project);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#5
0
 public tbl_Projects FindProject(int?projectID)
 {
     try
     {
         IGenericDataRepository <tbl_Projects> repository = new GenericDataRepository <tbl_Projects>();
         tbl_Projects Project = repository.GetSingle(c => c.ProjectID == projectID);
         return(Project);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#6
0
 public tbl_Projects Add_Project(string projectTitle, string projectDesc)
 {
     using (Entity ent = new Entity())
     {
         tbl_Projects project = new tbl_Projects()
         {
             Project_Title       = projectTitle,
             Project_Description = projectDesc
         };
         ent.tbl_Projects.Add(project);
         ent.SaveChanges();
         return(project);
     }
 }
示例#7
0
 public void GetProjectNameForDuplicateCheck(int prjId, int clientId, string prjName)
 {
     try
     {
         tbl_Projects   tblProj    = new tbl_Projects();
         ProjectManager prjManager = new ProjectManager();
         tblProj  = prjManager.FindProject(prjId);
         clientId = tblProj.ClientId;
         prjName  = tblProj.ProjectName;
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#8
0
 protected void AddProject(object sender, EventArgs e)
 {
     try
     {
         string       projectTitle       = ((TextBox)grd_Projects.FooterRow.FindControl("txtProjectTitleAdd")).Text;
         string       projectDescription = ((TextBox)grd_Projects.FooterRow.FindControl("txtProjectDescriptionAdd")).Text;
         tbl_Projects newProject         = pc.Add_Project(projectTitle, projectDescription);
         pc.Add_Project_Image(newProject.Project_ID, "https://www.walmart.ca/assets/img/no-image-med_en.png");
         Get_Projects();
         Response.Write("<script>alert('Project Added');</script>");
     }
     catch (Exception)
     {
         Response.Write("<script>alert('ERROR!!!');</script>");
     }
 }
示例#9
0
        public bool DeleteProject(ProjectViewModel projectViewModel)
        {
            try
            {
                tbl_Projects tblProject = new tbl_Projects();

                tblProject.ProjectID   = projectViewModel.ProjectID;
                tblProject.EntityState = DA.DomainModel.EntityState.Deleted;

                ProjectManager projectManager = new ProjectManager();
                projectManager.DeleteProject(tblProject);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#10
0
        public void UpdateProject(ProjectViewModel projectViewModel)
        {
            try
            {
                tbl_Projects tblProject = new tbl_Projects();

                tblProject.ProjectID   = projectViewModel.ProjectID;
                tblProject.ProjectName = projectViewModel.ProjectName;
                tblProject.RegionId    = projectViewModel.RegionId;
                tblProject.ClientId    = projectViewModel.ClientID;
                tblProject.EntityState = DA.DomainModel.EntityState.Modified;

                ProjectManager projectManager = new ProjectManager();
                projectManager.UpdateProject(tblProject);
            }
            catch (Exception)
            {
                throw;
            }
        }