public static void AddDocument(String name, String text) { SqlDbConnection SQL = new SqlDbConnection(); SQL.Procedurename = "readFromTbl"; SQL.AddParameter("command", "addDoc"); SQL.AddParameter("name", name); SQL.AddParameter("text", text); SQL.ExecuteObject(); }
public static void AddWords(Dictionary <String, String> words, String docName) { SqlDbConnection SQL = new SqlDbConnection(); var dt = ConvertToDataTable(words, docName); SQL.Procedurename = "readFromTbl"; SQL.AddParameter("command", "addWordPos"); SQL.AddParameter("name", docName); SQL.AddDict("go", dt); }
public static string GetDoc(int id) { string result; SqlDbConnection SQL = new SqlDbConnection(); SQL.Procedurename = "readFromTbl"; SQL.AddParameter("command", "getDoc"); SQL.AddParameter("id", Convert.ToString(id)); SQL.ExecuteObject(); result = SQL.GetFieldByName(0, "textDoc"); return(result); }
public static Dictionary <int, List <List <int> > > GetDocuments(List <String> input) { // List.Count = 5 Dictionary <int, List <List <int> > > result = new Dictionary <int, List <List <int> > >(); SqlDbConnection SQL = new SqlDbConnection(); SQL.Procedurename = "readFromTbl"; SQL.AddParameter("command", "getDocuments"); SQL.AddParameter("firstWord", input[0]); SQL.AddParameter("secondWord", input[1]); SQL.AddParameter("thirdWord", input[2]); SQL.AddParameter("fourthWord", input[3]); SQL.AddParameter("fifthWord", input[4]); SQL.ExecuteObject(); for (int j = 0; j < SQL.ResultRowAmount; j++) { List <List <int> > PositionsLists = new List <List <int> >(); PositionsLists.Add(ParsePositions(SQL.GetFieldByName(j, "FirstList"))); PositionsLists.Add(ParsePositions(SQL.GetFieldByName(j, "SecondList"))); PositionsLists.Add(ParsePositions(SQL.GetFieldByName(j, "ThirdList"))); PositionsLists.Add(ParsePositions(SQL.GetFieldByName(j, "FourthList"))); PositionsLists.Add(ParsePositions(SQL.GetFieldByName(j, "FifthList"))); result.Add(Convert.ToInt32(SQL.GetFieldByName(j, "DocumentId")), PositionsLists); } return(result); }