public static void UpdatePurMess(PurchaseMess pmess) { string sql; sql = string.Format("update purchasemess set purstate = '{0}' where o_id = {1} and g_id = {2}" , pmess.PurState, pmess.O_id, pmess.G_id); ExecuteSQL(sql); }
public static void InsertPurchaseMess(PurchaseMess purMess) { string sql; sql = string.Format("insert into PurchaseMess " + "values({0}, '{1}', {2}, {3}, {4}, {5}, {6}, '{7}')" , purMess.G_id, purMess.G_name, purMess.Price , purMess.Nums, purMess.Bu_id, purMess.Su_id , purMess.O_id, purMess.PurState); ExecuteSQL(sql); }
public static void OrderHandleView(PurchaseMess pmess) { int choice; choice = ChoiceGuide("1、发货 2、返回", 1, 2); switch (choice) { case 1: Seller seller = (Seller)Mostone.user; seller.Saves += pmess.Nums * pmess.Price; MySQLDemo.UpdateUser(seller); pmess.PurState = "1"; MySQLDemo.UpdatePurMess(pmess); break; case 2: return; } }
public static void OrderView() { int choice; int temp; string input; bool flag = false; PurchaseMess pmess = null; List <PurchaseMess> lp; lp = MySQLDemo.FindPurMessBySellerAndState((Seller)Mostone.user, "0"); while (true) { choice = ChoiceGuide("1、显示购买信息 2、查找购买信息 3、返回", 1, 3); switch (choice) { case 1: DisplayList(lp); break; case 2: while (true) { Console.Write("输入商品编号\n>>"); input = Console.ReadLine(); if (!StringRegular.RegularChecker(input, StringRegular.ALLNUM)) { Console.WriteLine("输入有误"); continue; } foreach (PurchaseMess p in lp) { if (int.Parse(input) == p.G_id) { flag = true; } } if (!flag) { Console.WriteLine("无此在售商品编号"); continue; } temp = int.Parse(input); break; } while (true) { Console.Write("输入指定信息的订单编号\n>>"); input = Console.ReadLine(); pmess = null; if (!StringRegular.RegularChecker(input, StringRegular.ALLNUM)) { Console.WriteLine("输入有误"); continue; } foreach (PurchaseMess p in lp) { if (temp == p.G_id && int.Parse(input) == p.O_id) { pmess = p; } } if (null == pmess) { Console.WriteLine("输入有误"); continue; } break; } OrderHandleView(pmess); lp = MySQLDemo.FindPurMessBySellerAndState((Seller)Mostone.user, "0"); break; case 3: return; } } }