コード例 #1
0
        private void addBook_Click(object sender, EventArgs e)
        {
            AddBook addBookForm = new AddBook(categories, database);

            addBookForm.Show();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: agilan96/CRUD_CSHARP
        static void Main(string[] args)
        {
            Console.Write("\t\t\t\t\t\tWelcome To HigginBothams!!!\n" + "Login\n");
            Console.Write("Enter Username:\n");
            string username = Console.ReadLine();

            Console.Write("Enter password:\n");
            string password  = Console.ReadLine();
            int    noofbooks = 4;

            if ((username == "user1") && (password == "pass1"))
            {
                bool close = true;
                while (close)
                {
                    Console.WriteLine("\nList:\n" +
                                      "1)Display books\n" +
                                      "2)Buy book\n" +
                                      "3)Search book\n" +
                                      "4)Proceed To Cart\n" +
                                      "5)Add book\n" +
                                      "6)Delete book\n" +
                                      "7)Close\n\n");
                    Console.Write("Choose your option from List :");

                    int option = int.Parse(Console.ReadLine());

                    if (option == 1)
                    {
                        DisplayArchive.Displaylist();
                    }
                    else if (option == 2)
                    {
                        BuyBook.Buy();
                    }
                    else if (option == 3)
                    {
                        SearchBook.SearchBook1();
                    }
                    else if (option == 4)
                    {
                        DisplayBuyList.Displaylist1();
                        close = false;
                    }
                    else if (option == 5)
                    {
                        noofbooks = noofbooks + 1;
                        AddBook.GetBook(noofbooks);
                    }
                    else if (option == 6)
                    {
                        DeleteBook.RemoveBook();
                    }
                    else if (option == 7)
                    {
                        Console.WriteLine("Thank you");
                        close = false;
                        Console.Clear();
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("Invalid option\nRetry !!!");
                    }
                }
            }
            else
            {
                Console.WriteLine("Invalid username or password");
            }
            Console.ReadLine();
        }
コード例 #3
0
        /// <summary>
        /// 添加书本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddBook addbook = new AddBook();

            addbook.ShowDialog();
        }