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(); } }
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(); } }
public void UpdateProject(tbl_Projects tblProjects) { try { IGenericDataRepository <tbl_Projects> repository = new GenericDataRepository <tbl_Projects>(); repository.Update(tblProjects); } catch (Exception) { throw; } }
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; } }
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; } }
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); } }
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; } }
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>"); } }
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; } }
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; } }