public void DeleteBuilder(string builderId) { var queries = new List <string>(3); try { // 1. Delete query from BuilderToProject var linkDaoImpl = new BuilderProjectLinkDAOImpl(); var queryFromLink = linkDaoImpl.GetDeleteBuilderQuery(builderId); queries.Add(queryFromLink); // 2. Delete query from ProjectDetails var projectDaoImpl = new ProjectDAOImpl(); var queryFromProject = projectDaoImpl.GetDeleteBuilderQuery(builderId); queries.Add(queryFromProject); // 3. Delete from BuilderDetails var query = GetDeleteBuilderQueryForDb(builderId); queries.Add(query); var daoHandler = new DAOServiceHandler(); daoHandler.ExecuteQueryForDb(queries); } catch (Exception e) { throw new Exception("Exception occurred while deleting builder from database.", e); } }
public IEnumerable <Builder> GetBuildersList() { try { var query = GetBuilderListQueryForDb(); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(GetBuilders(ds)); } catch (Exception e) { throw new Exception("Exception occurred while getting list of builders from database.", e); } }
public IEnumerable <Project> GetBuilderProjects(string userName) { try { var query = GetBuilderProjectQuery(userName); var daohandler = new DAOServiceHandler(); var ds = daohandler.ExecuteQueryForDb(query); return(ProjectDAOImpl.GetProjects(ds)); } catch (Exception e) { throw new Exception("Exception occurred while getting projects information for the builder.", e); } }
public Builder ManageBuilder(string builderQueryParam, string builderId) { try { var query = GetBuilderQueryForDb(builderQueryParam, builderId); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(GetBuilders(ds).ElementAt(0)); } catch (Exception e) { throw new Exception("Exception occurred while getting builder information from database.", e); } }
public bool IsUserNamePresent(string userName) { try { var query = IsUserNamePresentQuery(userName); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(ds.Tables[0]?.Rows.Count > 0); } catch (Exception e) { throw new Exception("Exception occurred while checking if username already exists in database or not.", e); } }
public ProjectBuilderInfo GetBuilderinfo(string projectId) { try { var query = GetProjectBuilderQueryForDb(projectId); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(GetProjectBuilder(ds)); } catch (Exception e) { throw new Exception("Exception occurred while getting project builder info from project id for the given project.", e); } }
public Project ManageProject(string projectId) { try { var query = GetProjectQueryForDb(projectId); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(GetProjects(ds).ElementAt(0)); } catch (Exception e) { throw new Exception("Exception occurred while getting project info from project id in database.", e); } }
public bool IsProjectNameForBuilderPresent(string builderId, string projectName) { try { var query = IsProjectNameForBuilderPresentQuery(builderId, projectName); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); return(ds.Tables[0]?.Rows.Count > 0); } catch (Exception e) { throw new Exception("Exception occurred while checking if project name already exists for the given builder or not.", e); } }
public static string GetBuilderIdFromBuilderName(string builderLoginName) { try { var query = GetIdFromLoginNameQuery(builderLoginName.Trim()); var daoHandler = new DAOServiceHandler(); var ds = daoHandler.ExecuteQueryForDb(query); var builder = GetBuilders(ds).ElementAt(0); return(builder.BuilderId.Trim()); } catch (Exception e) { throw new Exception("Exception occurred while getting builder Id from builder name.", e); } }
public void UpdateBuilder(string oldBuilderId, Builder builder) { try { var queries = new List <string>(1); var updateBuilderTableQuery = GetUpdateUserInBuilderTableQuery(oldBuilderId, builder); queries.Add(updateBuilderTableQuery); var daoHandler = new DAOServiceHandler(); daoHandler.ExecuteQueryForDb(queries); } catch (Exception e) { throw new Exception("Exception occurred while updating builder information in database.", e); } }
public void UpdateProjectToDb(string oldProjId, Project project) { try { var queries = new List <string>(1); var updateProjectTableQuery = GetUpdateProjectInprojectTableQuery(oldProjId, project); queries.Add(updateProjectTableQuery); var daoHandler = new DAOServiceHandler(); daoHandler.ExecuteQueryForDb(queries); } catch (Exception e) { throw new Exception("Exception occurred while updating project information in database.", e); } }
public void AddProjectToDb(string builderId, object linkId, Project project) { try { var queries = new List <string>(2); // 1. Save to Project table query var projSaveQuery = GetProjectSaveQuery(project); queries.Add(projSaveQuery); // 2. Save to BuilderProjectLink Table query var linkSaveQuery = GetLinkSaveQuery(linkId, builderId, project.ProjectId); queries.Add(linkSaveQuery); // 3. Save to DB var daoHandler = new DAOServiceHandler(); daoHandler.ExecuteQueryForDb(queries); } catch (Exception e) { throw new Exception("Exception occurred while adding project in database.", e); } }