private static void RemoveWord(DateBase Glossary) { Console.Clear(); Console.WriteLine("***Word search***"); Console.Write("\n\nWord: "); string wordRM = Convert.ToString(Console.ReadLine()); if (!ConsoleRepresentation.IsTrueInput(wordRM, 30)) { Console.WriteLine("Wrong input"); ConsoleRepresentation.BackToMenuMessage(); return; } Console.WriteLine("Press 1 to delete it?"); if (ConsoleRepresentation.ReadChoise(0, 1) == 1) { //removes word and information about it marking from glossary Glossary.stroredProcedures.DeleteWord(wordRM); } }
static void Main(string[] args) { //glossary datebase stored in GlossaryX\bin\Debug in file Glossary.mdf //setting connection properties //change Data Source = to your local sqlexpress server address string connectString = "Data Source=DESKTOP-C1JFPHG\\SQLEXPRESS01;AttachDbFilename=" + Environment.CurrentDirectory + "\\Glossary.mdf;Initial Catalog=GlossaryXX;Integrated Security=True;Connect Timeout=10"; //connecting stored datebase to local sqlexpress server DateBase Glossary = new DateBase(connectString); Console.WriteLine("******\nWelcome to GlossaryX 1.0\n******"); start: Console.WindowHeight = Console.LargestWindowHeight; Console.WindowWidth = Console.LargestWindowWidth; Console.WriteLine("Please, choose action:"); Console.WriteLine("1.Show all Meanings from base."); Console.WriteLine("2.Add a word into glossary"); Console.WriteLine("3.Find Meanings by category/markers/word/date"); Console.WriteLine("4.Remove/find word in glossary"); Console.WriteLine("5.Statistics by glossary"); Console.WriteLine("6.Delete all Meanings from glossary"); Console.WriteLine("7.Exit"); switch (ConsoleRepresentation.ReadChoise(1, 7)) { case 0: Console.Clear(); Console.WriteLine("Wrong choise input!"); ConsoleRepresentation.BackToMenuMessage(); goto start; case 1: ShowMeanings(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 2: AddMeanings(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 3: SearchMeanings(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 4: RemoveWord(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 5: ShowStatistic(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 6: RemoveGlossary(Glossary); ConsoleRepresentation.BackToMenuMessage(); goto start; case 7: Console.WriteLine("Press enter to quit."); Console.ReadLine(); break; } }