public static void MakeEmptyLines(int NumberOfEmptyLines) { for (int Counter = 0; Counter < NumberOfEmptyLines; Counter++) { ToolsOutput.PrintStringOnSeperateLine(""); } }
public static bool OpenDatabaseConnection() { try { // Build connection string Builder = new SqlConnectionStringBuilder(); Builder.DataSource = "PCM15715"; // update me Builder.InitialCatalog = "h1pd080119"; Builder.IntegratedSecurity = true; Connection = new SqlConnection(Builder.ConnectionString); // Connect to SQL ToolsOutput.PrintStringOnSeperateLine("Connecting to SQL Server ... "); Connection.Open(); ToolsOutput.PrintStringOnSeperateLine("Done."); Connection.Close(); return(true); } catch (SqlException e) { ToolsOutput.PrintStringOnSeperateLine(e.ToString()); return(false); } }
public static void WatchStudentList(SQLAndDatabaseInfo SQLTable) { int Counter; string OutputString; Connection.Open(); ToolsOutput.PrintStringOnSeperateLine(SQLTable.SQLCommandString); ToolsOutput.PrintStringOnSeperateLine(""); using (SqlCommand Command = new SqlCommand(SQLTable.SQLCommandString, Connection)) { OutputString = ""; for (Counter = 0; Counter < SQLTable.DatabseInfoList.Count; Counter++) { if (true == SQLTable.DatabseInfoList[Counter].ShowField) { OutputString += SQLTable.DatabseInfoList[Counter].FieldName + '\t'; } } ToolsOutput.PrintStringOnSeperateLine(OutputString); ToolsOutput.PrintStringOnSeperateLine(""); using (SqlDataReader Reader = Command.ExecuteReader()) { while (Reader.Read()) { OutputString = ""; for (Counter = 0; Counter < StudentListInfo.Count; Counter++) { if (true == StudentListSQL.DatabseInfoList[Counter].ShowField) { OutputString += SQLTable.DatabseInfoList[Counter].ConvertReceivedDatabaseValueFunc(Reader, SQLTable.DatabseInfoList[Counter].FieldColumnNumber) + '\t'; } } ToolsOutput.PrintStringOnSeperateLine(OutputString); } } } Connection.Close(); ToolsInput.WaitForUser(); }
public static int MakeMenu(string[] StringListHere) { int KeypressedValue = 0; char KeypressedValueChar = '0'; char[] ValidCharArray = new char[StringListHere.Length]; for (int Counter = 0; Counter < StringListHere.Length; Counter++) { char[] _chars = (Counter + 1).ToString().ToCharArray(); ValidCharArray[Counter] = _chars[0]; } ToolsScreen.ClearScreen(); foreach (string Item in StringListHere) { ToolsOutput.PrintStringOnSeperateLine(Item); } KeypressedValueChar = ToolsInput.GetKeyPress("Indtast dit valg (1 - " + StringListHere.Length + ") : ", ValidCharArray, false); KeypressedValue = KeypressedValueChar.ParseInt32(); return(KeypressedValue); }