Beispiel #1
0
        public void Zhuce()
        {
            Console.WriteLine("*************欢迎注册*************");
            Console.WriteLine("请输入姓名:");
            string strname = Console.ReadLine();

            Console.WriteLine("请输入学号/工号(作为密码登陆使用)");
            string strno = Console.ReadLine();

            Console.WriteLine("您的身份是:\n请输入(学生/老师)");
            string strid = Console.ReadLine();

            if (strid == "学生" || strid == "老师")
            {
                Library.userlist.Add(new Person(strno, strname, strid));
            }
            else
            {
                Console.WriteLine("您的身份输入有误");
            }
            Console.WriteLine("**************注册成功************");
            Borrower bor = new Borrower();
        }
Beispiel #2
0
        public void BookBorrow1()
        {
            while (true)
            {
                Console.WriteLine("请输入要选择的操作:\t1.借阅历史查询\t2.借阅书籍\t3.返回");
                string e = Console.ReadLine();
                switch (e)
                {
                case "1":
                    Console.WriteLine("*************************************************");
                    Console.WriteLine("目前已借图书  {0}  本", Record.booklist2.Count);
                    Console.WriteLine("借阅者姓名:\t借阅者学号/工号:\t书籍编号:\t书籍名称:\t借阅时间:");
                    foreach (Record bk in Record.booklist2)
                    {
                        Console.Write("{0}\t\t{1}\t\t{2}\t\t{3}\t\t{4}", bk.Strname, bk.Strno, bk.Strbookno, bk.Strbookname, bk.Strtime);
                        Console.WriteLine();
                    }
                    Console.WriteLine("*************************************************");
                    break;

                case "2":
                    Console.WriteLine("您的身份是“老师”,剩余借阅书籍为{0} 本", (15 - Record.booklist2.Count));
                    Console.WriteLine("请输入要借阅的图书名称:");
                    string str = Console.ReadLine();
                    var    p   = BookKu.booklist.Where(s => s.BookName == str).FirstOrDefault();
                    if (p != null)
                    {
                        String k1 = p.BookNo;
                        string k2 = p.BookName;
                        string k3 = Convert.ToString(DateTime.Now);
                        Console.WriteLine("请输入您的学号/工号");
                        string p2 = Console.ReadLine();
                        var    q  = PersonKu.borrowerlist.Where(s => s.PersonNo == p2).FirstOrDefault();
                        if (q != null)
                        {
                            string p1 = q.PersonName;
                            Record.booklist1.Add(new Record(p1, p2, k1, k2, k3));
                            u = u - 1;
                            if (Record.booklist2.Count < 15)
                            {
                                Console.WriteLine("已成功借阅图书《" + p.BookName + "》\n目前图书馆书籍总量为" + u + " \n借阅时间为:" + k3);
                            }
                            else
                            {
                                int z = Record.booklist2.Count - 1;
                                Record.booklist2.RemoveAt(z);
                                Console.WriteLine("借阅失败!!!借阅书籍已达上限");
                            }
                        }

                        Console.WriteLine("***************************************************");
                    }
                    else
                    {
                        Console.WriteLine("很遗憾!图书馆没有该书籍:" + str);
                    }

                    break;

                case "3":
                    Borrower bor = new Borrower();
                    break;

                default:
                    Console.WriteLine("您的输入有误!!!");
                    break;
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("****************欢迎登陆图书馆管理系统******************");
            Library.GetInstance();
            while (true)
            {
                Console.WriteLine("请对您的身份进行选择:\t1.管理员\t2.借阅者");
                string k = Console.ReadLine();
                switch (k)
                {
                case "1":
                    #region (管理员)
                    Console.WriteLine("您好,图书馆管理员!\n");
                    #region (登陆)
                    while (true)
                    {
                        Y : Console.WriteLine("请输入您的姓名:");
                        string name = Console.ReadLine();
                        Console.WriteLine("请输入您的工号");
                        string no = Console.ReadLine();
                        Manager.Login(name, no);
                        switch (Manager.x)
                        {
                        case "不正确":
                            Console.WriteLine("工号不正确,登陆失败");
                            goto Y;

                        case "没注册":
                            Console.WriteLine("该名称还没有进行注册!!!请登陆其他账号");
                            goto Y;

                        case "正确":
                            Console.WriteLine("欢迎登陆****************  管理员:{0}  ****************", name);
                            break;

                        default:
                            Console.WriteLine("输入有误");
                            break;
                        }
                        break;
                    }
                    #endregion
                    bool ll = true;
                    while (ll)
                    {
                        Console.WriteLine("请选择要进行的操作:\n1.查询\n2.采购\n3.销毁\n4.丢失\n5.借书管理\n6.历史记录查询\n7.退出");
                        Console.WriteLine();
                        string a = Console.ReadLine();
                        switch (a)
                        {
                        case "1":
                            #region (查询)
                            Console.WriteLine("*************************************************");
                            Console.WriteLine("现有图书共  {0}  本", Library.booklist.Count);
                            Console.WriteLine("书籍编号:\t书籍名称:\t书籍类别:\t书籍状态:");
                            foreach (Book bk in Library.booklist)
                            {
                                Console.Write("{0}\t\t{1}\t\t{2}\t\t{3}", bk.BookOnlyno, bk.BookName, bk.BookType, bk.BookStatus);
                                Console.WriteLine();
                            }
                            Console.WriteLine("*************************************************");
                            Manager.BookSeek();
                            continue;

                            #endregion
                        case "2":
                            #region (采购)
                            X : Console.WriteLine("请为采购的书籍编号:");
                            string l4 = Console.ReadLine();
                            var    p  = Library.booklist.Where(s => s.BookOnlyno == l4).FirstOrDefault();
                            if (p != null)
                            {
                                Console.WriteLine("该编号已存在,请更换编号录入:");
                                goto X;
                            }
                            Console.WriteLine("请输入采购的书籍名称:");
                            string l2 = Console.ReadLine();
                            Console.WriteLine("请输入采购的书籍分类:");
                            string l3 = Console.ReadLine();
                            Console.WriteLine("请输入采购的书籍型号:");
                            string l1 = Console.ReadLine();
                            string l5 = "正常";
                            Manager.BookBuy(l1, l2, l3, l4, l5);
                            Console.WriteLine("**********已成功购买图书:《{0}》,并已成功录入系统**********", l2);
                            continue;

                            #endregion
                        case "3":
                            #region (销毁)
                            Console.WriteLine("请输入要销毁的图书编号:");
                            string bkonlyno = Console.ReadLine();
                            Manager.BookXiaoHui(bkonlyno);
                            switch (Manager.x)
                            {
                            case "销毁":
                                Console.WriteLine("已销毁");
                                break;

                            case "借出":
                                Console.WriteLine("书籍被借出或已丢失");
                                break;

                            case "没书":
                                Console.WriteLine("图书馆没有书籍:" + bkonlyno);
                                break;

                            default:
                                Console.WriteLine("输入有误");
                                break;
                            }

                            continue;

                            #endregion
                        case "4":
                            #region (丢失)
                            Console.WriteLine("请输入已丢失的图书编号:");
                            string bkonlyno1 = Console.ReadLine();
                            Manager.BookLose(bkonlyno1);
                            switch (Manager.x)
                            {
                            case "已丢失":
                                Console.WriteLine("已标记为丢失");
                                break;

                            case "已借出":
                                Console.WriteLine("书籍被借出或已销毁");
                                break;

                            case "没书":
                                Console.WriteLine("图书馆没有书籍:" + bkonlyno1);
                                break;

                            default:
                                Console.WriteLine("输入有误");
                                break;
                            }
                            continue;

                            #endregion
                        case "5":
                            #region (借书管理)
                            Console.WriteLine("请输入借书人学号:");
                            string borrowerno = Console.ReadLine();
                            Console.WriteLine("请输入要借的书籍编号:");
                            string bookno = Console.ReadLine();
                            Manager.BookBorrow(bookno, borrowerno);
                            switch (Manager.x)
                            {
                            case "借书成功":
                                Console.WriteLine("借书成功");
                                break;

                            default:
                                Console.WriteLine("借书失败");
                                break;
                            }
                            continue;

                            #endregion
                        case "6":
                            #region (历史记录查询)
                            string g = "";
                            Console.WriteLine("选择查询模式:\n1.全部查询\n2.管理员操作\n3.借阅者操作");
                            g = Console.ReadLine();
                            switch (g)
                            {
                            case "1":
                            {
                                Console.WriteLine("*************************************************");
                                Console.WriteLine("操作者身份:\t操作者编号:\t书籍编号:\t书籍名称:\t操作:\t借阅时间:");
                                foreach (Record bk in Library.recordlist)
                                {
                                    Console.Write("{0}\t\t{1}\t\t{2}\t\t{3}\t\t{4}\t{5}", bk.Strhandlerid, bk.Strhandlerno, bk.Strbookno, bk.Strbookname, bk.Strhandlername, bk.Strtime);
                                    Console.WriteLine();
                                }
                                Console.WriteLine("*************************************************");

                                continue;
                            }

                            case "2":
                                orglist = Library.recordlist.Where(s => s.Strhandlerid == "管理员").ToList();
                                foreach (Record rd in orglist)
                                {
                                    Console.WriteLine("操作者身份:\t操作者编号:\t书籍编号:\t书籍名称:\t操作:\t借阅时间:");
                                    Console.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3}\t\t{4}\t{5}", rd.Strhandlerid, rd.Strhandlerno, rd.Strbookno, rd.Strbookname, rd.Strhandlername, rd.Strtime);
                                }
                                continue;

                            case "3":

                                orglist = Library.recordlist.Where(s => s.Strhandlerid == "老师" || s.Strhandlerid == "学生").ToList();
                                foreach (Record rd in orglist)
                                {
                                    Console.WriteLine("操作者身份:\t操作者编号:\t书籍编号:\t书籍名称:\t操作:\t借阅时间:");
                                    Console.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3}\t\t{4}\t{5}", rd.Strhandlerid, rd.Strhandlerno, rd.Strbookno, rd.Strbookname, rd.Strhandlername, rd.Strtime);
                                }
                                continue;
                            }
                            break;

                            #endregion
                        case "7":
                            ll = false;
                            break;

                        default:
                            Console.WriteLine("您的输入有误!!!请重新输入:");
                            break;
                        }
                        break;
                    }
                    continue;

                    #endregion
                case "2":
                    #region (借阅者)

                    Borrower bor = new Borrower();
                    break;

                default:
                    Console.WriteLine("您的输入有误!!!重新输入:");
                    break;
                    #endregion
                }
                continue;
            }
        }