public projectBundle(luisResultContainer._Entities entities) { string configFile = File.ReadAllText("Database/dbconfig.json"); config = JsonConvert.DeserializeObject(configFile); _sqlConnector = new sqlConnector(); _sqlConnector.OpenConnection(); List <Project> projects = new List <Project>(); string searchQuery = projectSelectionQueryBuilder(entities.contactJobTitle, entities.contactName, entities.organizationName, entities.projectUsages, entities.projectLocation, entities.projectCriteria, entities.projectDescription, entities.organizationOverview, entities.projectDate); List <List <String> > projectSearchResults = _sqlConnector.select(searchQuery); //Create a Project object for each project found and populate it with its values for (int i = 0; i < projectSearchResults.Count; i++) { projects.Add(new Project(fields, projectSearchResults[i].ToArray())); } this.projects = projects.ToArray(); _sqlConnector.CloseConnection(); }
//When a project is first instantiated, it only stores information on ixnID, ixnEntry, projectTitle, //organisationName and industrySupervisor. This method does a full SQL selection query and populates fields and //values with all the information available for this Project public void toDetailedProject() { sqlConnector _sqlConnector = new sqlConnector(); _sqlConnector.OpenConnection(); values = _sqlConnector.select(searchQuery)[0].ToArray(); this.fields = new Dictionary <string, int>(); //Resets the field dictionary to empty List <String> fields = new List <string>(); // int ixnTableSize = _sqlConnector.select(fieldGetterQueryIXNTable).Count; for (int i = 0; i < fieldGetterQueryWholeTable.Length; i++) { fields.AddRange(transpose(_sqlConnector.select(fieldGetterQueryWholeTable[i]))); } //Re add all values to the fields dictionary for (int i = 0; i < fields.Count; i++) { try { this.fields.Add(fields[i], i); } catch (Exception) { this.fields.Add("f." + fields[i], i); } } hasNda = (getValue("ndaRequired") == "True"); isAcademic = getValue("academicID") != ""; hasContract = getValue("requiresContract") == "True"; }
//When a project is first instantiated, it only stores information on ixnID, ixnEntry, projectTitle, //organisationName and industrySupervisor. This method does a full SQL selection query and populates fields and //values with all the information available for this Project public void toDetailedProject() { sqlConnector _sqlConnector = new sqlConnector(); _sqlConnector.OpenConnection(); values = _sqlConnector.select(searchQuery)[0].ToArray(); this.fields = new Dictionary <string, int>(); //Resets the field dictionary to empty List <String> fields = new List <string>(); //Add all the fields into a single list for (int i = 0; i < fieldGetterQueryWholeTable.Length; i++) { fields.AddRange(transpose(_sqlConnector.select(fieldGetterQueryWholeTable[i]))); } //Re add all values with their fields to the fields dictionary for (int i = 0; i < fields.Count; i++) { try { this.fields.Add(fields[i], i); } catch (Exception) { this.fields.Add("f." + fields[i], i); //If a key collision occurs (shouldn't be possible) append f. to it } } hasNda = (getValue("ndaRequired") == "True"); isAcademic = getValue("academicID") != ""; hasContract = getValue("requiresContract") == "True"; }
public projectBundle(luisResultContainer._Entities entities) { _sqlConnector = new sqlConnector(); _sqlConnector.OpenConnection(); List <Project> projects = new List <Project>(); string searchQuery = projectSelectionQueryBuilder(entities.contactJobTitle, entities.contactName, entities.organizationName, entities.projectUsages, entities.projectLocation, entities.projectCriteria, entities.projectDescription, entities.organizationOverview); List <List <String> > projectSearchResults = _sqlConnector.select(searchQuery); for (int i = 0; i < projectSearchResults.Count; i++) { projects.Add(new Project(fields, projectSearchResults[i].ToArray())); } this.projects = projects.ToArray(); _sqlConnector.CloseConnection(); }