Example #1
0
        public static void EditBoats()
        {
            ShowUser.ShowUsers();

            Console.WriteLine("");
            Console.Write("Vilken medlem vill du ändra en båt hos: ");
            int userChoice = int.Parse(Console.ReadLine());

            string showBoatQuery = "CALL `displayBoat`" + "(" + userChoice + ");";

            SQLconnection.DeleteBoatSQL(showBoatQuery);

            Console.WriteLine("Vilken båt vill ändra..?");
            int userBoatChoice = int.Parse(Console.ReadLine());

            Console.WriteLine("Ange nya båtvärden..");

            Console.WriteLine("Ny båtlängd:");
            string newBoatLength = Console.ReadLine();

            Console.WriteLine("Ange en ny båttyp:");
            Console.WriteLine("1.Segelbåt 2.Motorseglare 3.Motorbåt 4.Kajak/Kanot 5.Övrigt");
            string newBoatype = Console.ReadLine();

            string editBoatQuery = "UPDATE boat SET boattypeID='" + newBoatype + "'" + ", boatlength='" + newBoatLength + "'" + " WHERE boatID='" + userBoatChoice + "'";

            SQLconnection.con(editBoatQuery);

            Console.Clear();
            Presentation.BoatIsEdited();
            Program.ContinueOnKeyPressed();
        }
Example #2
0
        public static void EditUserInfo()
        {
            Presentation.EditUsers();
            ShowUser.ShowUsers();

            Console.WriteLine("");
            Console.Write("Välj vem du vill editera: ");
            string userEdit = Console.ReadLine();

            Console.Write("Skriv in ett nytt förnamn: ");
            string fName = Console.ReadLine();

            Console.Write("Skriv in ett nytt efternamn: ");
            string lName = Console.ReadLine();

            Console.Write("Skriv in ett nytt  personnummer: ");
            string pNumber = Console.ReadLine();

            string editUserQuery = "UPDATE member SET firstname='" + fName + "'" + ", lastname='" + lName + "'" + ", socialsecuritynumber= '" + pNumber + "'" + " WHERE memberID='" + userEdit + "'";

            SQLconnection.addBoatconn(editUserQuery);

            Console.Clear();
            Presentation.MemberIsEdit();
            Program.ContinueOnKeyPressed();
        }
Example #3
0
        public static void addUser()
        {
            AddInformation addInformation = new AddInformation();

            string fname;
            string lname;
            int    pNumber;

            Presentation.Adduser();

            Console.Write("Skriv in förnamn: ");
            fname = Console.ReadLine();

            Console.Write("Skriv in efternamn: ");
            lname = Console.ReadLine();

            do
            {
                Console.Write("Skriv in personnummer: ");
            } while (!int.TryParse(Console.ReadLine(), out pNumber) || pNumber < 0);


            //string addUserQuery = "INSERT INTO member (firstname, lastname, socialsecuritynumber) VALUES(" + "'" + fname + "'" + "," + "'" + lname + "'" + "," + "'" + pNumber + "'" + ")";

            string addUserQuery = "INSERT INTO member (firstname, lastname, socialsecuritynumber) VALUES ( " + "'" + fname + "'" + "," + "'" + lname + "'" + "," + "'" + pNumber + "'" + ")";


            SQLconnection.con(addUserQuery);

            Console.Clear();
            Presentation.UserIsAdded();
            Program.ContinueOnKeyPressed();
            Program.Menu();
        }
Example #4
0
        public static void EditUserInfo()
        {
            AddInformation addInfo = new AddInformation();

            Presentation.EditUsers();

            ShowUser.ShowUsers();

            Console.WriteLine("Välj vem du vill editera: ");
            string userEdit = Console.ReadLine();

            Console.Write("Skriv in ett nytt förnamn: ");
            string fName = Console.ReadLine();

            Console.Write("Skriv in ett nytt efternamn: ");
            string lName = Console.ReadLine();

            Console.Write("Skriv in ett nytt  personnummer: ");
            string pNumber = Console.ReadLine();

            string editUserQuery = "UPDATE member SET firstname='" + fName + "'" + ", lastname='" + lName + "'" + ", socialsecuritynumber= '" + pNumber + "'" + " WHERE memberID='" + userEdit + "'";

            SQLconnection.addBoatconn(editUserQuery);

            Console.WriteLine("Medlemen är ändrad");
            Console.ReadLine();
        }
Example #5
0
        public static void ShowUsers()
        {
            Presentation.ListMembers();
            string displayAllUsers = "CALL `miniMemList`();";

            SQLconnection.showCompressedList(displayAllUsers);
        }
Example #6
0
        public static void ShowCompleteUser()
        {
            Presentation.ListAllMembers();
            string callProcedure = "CALL `memberlist`();";

            SQLconnection.Procedure(callProcedure);
        }
Example #7
0
        public static void AddBoatToMember()
        {
            AddInformation addInfo = new AddInformation();

            Presentation.EditUsers();

            Console.WriteLine("Vill du lägga till båt? J/N");
            string userInput = Console.ReadLine();

            if (userInput == "J" || userInput == "j")
            {
                ShowUser.ShowUsers();

                Console.WriteLine("Hos vem?");
                int userChoice = int.Parse(Console.ReadLine());

                Console.WriteLine("Hur lång är båten ");
                string boatLength = Console.ReadLine();

                Console.WriteLine("Vad vill du lägga till för båt?");
                Console.WriteLine("1.Segelbåt 2.Motorseglare 3.Motorbåt 4.Kajak/Kanot 5.Övrigt");
                string boatType = Console.ReadLine();


                string addUserQuery = "INSERT INTO boat (memberID, boattypeID, boatlength) VALUES ( " + "'" + userChoice + "'" + "," + "'" + boatType + "'" + "," + "'" + boatLength + "'" + ")";

                SQLconnection.addBoatconn(addUserQuery);
                Console.WriteLine("Båten tillagd");
                Console.ReadLine();

                //Skriv in "WHERE USER = userChoice för att lägga till eller ersätta en båt.
            }
        }
Example #8
0
        public static void AddBoatToMember()
        {
            Presentation.AddBoat();

            Console.WriteLine("Vill du lägga till båt? J/N");
            string userInput = Console.ReadLine();

            if (userInput == "J" || userInput == "j")
            {
                Console.Clear();
                ShowUser.ShowUsers();

                Console.WriteLine("");
                Console.Write("Hos vem: ");
                int userChoice = int.Parse(Console.ReadLine());

                Console.Write("Hur lång är båten: ");
                string boatLength = Console.ReadLine();

                Console.WriteLine("Vad vill du lägga till för båt?");
                Console.WriteLine("1.Segelbåt 2.Motorseglare 3.Motorbåt 4.Kajak/Kanot 5.Övrigt");
                string boatType = Console.ReadLine();

                string addUserQuery = "INSERT INTO boat (memberID, boattypeID, boatlength) VALUES ( " + "'" + userChoice + "'" + "," + "'" + boatType + "'" + "," + "'" + boatLength + "'" + ")";

                SQLconnection.addBoatconn(addUserQuery);
                Console.Clear();
                Presentation.BoatIsAdded();
                Console.ReadLine();
            }
        }
Example #9
0
        public void Menu()
        {
            SQLconnection conn = new SQLconnection();
            bool          exit = false;

            do
            {
                switch (GetMenuChoice())
                {
                case 0: { return; }

                case 1: { AddUser(); exit = true; break; }

                case 2: { AddBoatToUser(); break; }

                case 3: { ShowUsers(); ContinueOnKeyPressed(); break; }

                case 4: { ShowCompleteUser(); break; }

                case 5: { EditUsers(); break; }

                case 6: { EditBoats(); break; }

                case 7: { DeleteUsers(); break; }

                case 8: { DeleteBoats(); break; }
                }
            } while (!exit);
        }
Example #10
0
        public static void ShowCompleteUser()
        {
            AddInformation addInfo       = new AddInformation();
            string         callProcedure = "CALL `memberlist`();";

            SQLconnection.Procedure(callProcedure);
        }
Example #11
0
        public static void ShowUsers()
        {
            string displayAllUsers = "CALL `miniMemList`();";

            SQLconnection.showCompressedList(displayAllUsers);
            Console.ReadLine();
        }
Example #12
0
        public static void DeleteUsers()
        {
            Presentation.DeletePresentation();

            ShowUser.ShowUsers();

            Console.WriteLine("Vilken användare vill du ta bort?: ");
            int deleteChoice = int.Parse(Console.ReadLine());

            string deleteMemberQuery = "CALL `deleteMember`" + "(" + deleteChoice + ");";

            SQLconnection.DeleteBoatSQL(deleteMemberQuery);

            Console.WriteLine("Nu är medlemmen borttagen");
        }
Example #13
0
        public static void DeleteUsers()
        {
            Presentation.DeletePresentation();
            ShowUser.ShowUsers();

            Console.WriteLine("");
            Console.Write("Vilken användare vill du ta bort?: ");
            int deleteChoice = int.Parse(Console.ReadLine());

            string deleteMemberQuery = "CALL `deleteMember`" + "(" + deleteChoice + ");";

            SQLconnection.DeleteBoatSQL(deleteMemberQuery);

            Console.Clear();
            Presentation.UserIsDeleted();
            Program.ContinueOnKeyPressed();
        }
Example #14
0
        public static void DeleteBoats()
        {
            ShowUser.ShowUsers();

            Console.WriteLine("Vilken medlem vill du ta bort en båt hos..?");
            int userChoice = int.Parse(Console.ReadLine());

            string showBoatQuery = "CALL `displayBoat`" + "(" + userChoice + ");";

            SQLconnection.DeleteBoatSQL(showBoatQuery);

            Console.WriteLine("Vilken båt vill du ta bort..?");
            int userBoatChoice = int.Parse(Console.ReadLine());

            string deleteBoatQuery = "CALL `deleteBoat`" + "(" + userBoatChoice + ");";

            SQLconnection.DeleteBoatSQL(deleteBoatQuery);

            Console.WriteLine("Nu är din båt borttagen din jävla sexiga hukk!");
        }
Example #15
0
        public static void Menu()
        {
            SQLconnection conn = new SQLconnection();
            bool exit = false;
            do
            {
                switch (GetMenuChoice())
                {
                    case 0: { return; }
                    case 1: { addUser(); exit = true; break; }
                    case 2: { AddBoatToUser(); break; }
                    case 3: { ShowUsers(); ContinueOnKeyPressed(); break; }
                    case 4: { ShowCompleteUser(); break; }
                    case 5: { EditUsers(); break; }
                    case 6: { EditBoats(); break; }
                    case 7: { DeleteUsers(); break; }
                    case 8: { DeleteBoats(); break; }

                }
            } while (!exit);
        }
Example #16
0
        public static void DeleteBoats()
        {
            ShowUser.ShowUsers();

            Console.WriteLine("Vilken medlem vill du ta bort en båt hos..?");
            int userChoice = int.Parse(Console.ReadLine());

            string showBoatQuery = "CALL `displayBoat`" + "(" + userChoice + ");";

            SQLconnection.DeleteBoatSQL(showBoatQuery);

            Console.WriteLine("Vilken båt vill du ta bort..?");
            int userBoatChoice = int.Parse(Console.ReadLine());

            string deleteBoatQuery = "CALL `deleteBoat`" + "(" + userBoatChoice + ");";

            SQLconnection.DeleteBoatSQL(deleteBoatQuery);

            Console.Clear();
            Presentation.BoatIsDeleted();
            Program.ContinueOnKeyPressed();
        }