/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="pmidListFromXml"></param> override public bool FillQueryDataTables(string name, XmlNodeList pmidListFromXml) { if (name == "" && pmidListFromXml.Count == 0) { return(false); } try { // T_Protein and T_ProteinList DataRow rowProtein = null; if (ProteinFromUser != null) { if (!(Dictionary.TryGetValue(ProteinFromUser, out rowProtein))) { // not exist -> create new row of T_Protein and fill it. rowProtein = ProteinDataTable.NewRow(); rowProtein["ProteinID"] = ProteinID++; rowProtein["Protein"] = ProteinFromUser; // add the row into the T_Protein data table and the dictionary ProteinDataTable.Rows.Add(rowProtein); Dictionary.Add(ProteinFromUser, rowProtein); } // No matter protein exists in the dictionary, need to put in the list DataRow rowProteinList = ProteinListDataTable.NewRow(); rowProteinList["ProteinListID"] = ProteinListID; rowProteinList["QuerySessionID"] = QuerySessionID; rowProteinList["ProteinID"] = rowProtein["Protein"]; ProteinListDataTable.Rows.Add(rowProteinList); } // T_Organism DataRow rowOrganism = null; if ((OrganismFromUser != null) && (!(Dictionary.TryGetValue(OrganismFromUser, out rowOrganism)))) { // not exist -> create new row of T_Organism and fill it. rowOrganism = OrganismDataTable.NewRow(); rowOrganism["OrganismID"] = OrganismID++; rowOrganism["Organism"] = OrganismFromUser; // add the row into T_Organism data table and the dictionary OrganismDataTable.Rows.Add(rowOrganism); Dictionary.Add(OrganismFromUser, rowOrganism); } // T_Keyword DataRow rowKeyword = null; if ((KeywordFromUser != null) && (!(Dictionary.TryGetValue(KeywordFromUser, out rowKeyword)))) { // not exist -> create new row of T_Keyword and fill it rowKeyword = KeywordDataTable.NewRow(); rowKeyword["KeywordID"] = KeywordID++; rowKeyword["Keyword"] = KeywordFromUser; // add the row into T_Keyword data table and the dictionary. KeywordDataTable.Rows.Add(rowKeyword); Dictionary.Add(KeywordFromUser, rowKeyword); } // The rest of T_Query DataRow rowQuery = QueryDataTable.NewRow(); rowQuery["QueryID"] = QueryID++; rowQuery["Name"] = name; // name = protein + organism + keyword //rowQuery["QueryStartTime"]=; //rowQuery["QueryEndTime"]=; rowQuery["ProteinID"] = rowProtein["ProteinID"]; //.ToString(); rowQuery["OrganismID"] = rowOrganism["OrganismID"]; //.ToString(); rowQuery["Keyword"] = rowKeyword["KeywordID"]; //.ToString(); // keywordListID = QueryID because one query has one keywordList rowQuery["ResultCount"] = ArticleCount; // new count from the xml string // Add the row of T_Query into the T_Query datatable and the dictionary QueryDataTable.Rows.Add(rowQuery); Dictionary.Add(name, rowQuery); // T_QueryArticles foreach (XmlNode pmid in pmidListFromXml) { // create the row of QueryArticles and fill it. DataRow rowQueryArticles = QueryArticlesDataTable.NewRow(); rowQueryArticles["QueryArticleID"] = QueryArticleID++; rowQueryArticles["QueryID"] = rowQuery["QueryID"]; rowQueryArticles["PMID"] = pmid.InnerText; // add pmid into ldlist and the row into datatable IdList.Add(pmid.InnerText); QueryArticlesDataTable.Rows.Add(rowQueryArticles); } // T_QuerySession // create new row, fill information, and add the row into the QuerySession data table DataRow rowQuerySession = QuerySessionDataTable.NewRow(); rowQuerySession["QuerySessionID"] = QuerySessionID; rowQuerySession["QueryID"] = rowQuery["QueryID"]; rowQuerySession["ProteinListID"] = rowQuery["ProteinID"]; rowQuerySession["DateTime"] = DateTime.Now; QuerySessionDataTable.Rows.Add(rowQuerySession); } catch (Exception exception) { Console.WriteLine(exception.Message); } return(true); }
public Step3(IWebDriver webDriver) : base(webDriver) { this.webDriver = webDriver; PODriver.GotoURL(webDriver, PageName); proteinDataTable = new ProteinDataTable(ProteinSizerData); }