public static void InputSellerInfo(Seller s, out bool b1, out bool b2) { Console.WriteLine("请再次输入用户名!"); s.Name = Console.ReadLine(); b1 = AccountManagement.FindAccountByName(s, s.Name); Console.WriteLine("请输入密码!"); s.Pwd = Console.ReadLine(); b2 = AccountManagement.FindAccountById(s, s.Pwd); }
public static void InputCustomerInfo(Customer c, out bool b1, out bool b2) { Console.WriteLine("请再次输入用户名!"); c.Name = Console.ReadLine(); b1 = AccountManagement.FindAccountByName(c, c.Name); Console.WriteLine("请输入密码!"); c.Pwd = Console.ReadLine(); b2 = AccountManagement.FindAccountById(c, c.Pwd); }
public static void Open(object o)//注册账户 { if (o is Seller) { Seller s = (Seller)o; Console.WriteLine("请输入用户名,20个字符以内"); s.Name = Console.ReadLine(); bool b = AccountManagement.FindAccountByName(s, s.Name); if (b) { Console.WriteLine("用户名已存在,请重新输入!"); s.Name = Console.ReadLine(); b = AccountManagement.FindAccountByName(s, s.Name); } else { Console.WriteLine("用户名合法!"); } Console.WriteLine("请输入密码,20个字符以内"); string s1 = Console.ReadLine(); Console.WriteLine("请再输入一次密码!"); string s2 = Console.ReadLine(); if (s1 != s2) { Console.WriteLine("两次密码不一致,请重新输入!"); s2 = Console.ReadLine(); } else { s.Pwd = s2; } Console.WriteLine("请输入初始账户金额!"); s.Balance = Convert.ToDouble(Console.ReadLine()); bool b1 = AddAccount(s); } else if (o is Customer) { Customer c = (Customer)o; Console.WriteLine("请输入用户名,20个字符以内"); c.Name = Console.ReadLine(); bool b = AccountManagement.FindAccountByName(c, c.Name); if (b) { Console.WriteLine("用户名已存在,请重新输入!"); c.Name = Console.ReadLine(); b = AccountManagement.FindAccountByName(c, c.Name); } else { Console.WriteLine("用户名合法!"); } Console.WriteLine("请输入密码,20个字符以内"); string s1 = Console.ReadLine(); Console.WriteLine("请再输入一次密码!"); string s2 = Console.ReadLine(); if (s1 != s2) { Console.WriteLine("两次密码不一致,请重新输入!"); s2 = Console.ReadLine(); } else { c.Pwd = s2; } Console.WriteLine("请输入初始账户金额!"); c.Balance = Convert.ToDouble(Console.ReadLine()); bool b1 = AddAccount(c); } }