private string proxyAccount(string content, string[] arr, Func<string, string> msgRet, string authId) { if (!online(authId)) { return msgRet("请登录"); } Regex g = new Regex("开代理\\s\\d{11}\\s\\w{2,5}\\s\\d"); if (g.IsMatch(content)) { using (busyManDataContext busy = new busyManDataContext(conStr)) { var f = busy.HCTLoginUser.FirstOrDefault(p => p.Account > 888800001 && p.UserState == 1); f.Name = arr[2]; f.Phone = arr[1]; f.UserState = int.Parse(arr[3]); busy.SubmitChanges(); return msgRet( string.Format("{0} {1} {2} {3}", f.Name, f.Phone, f.Account, f.Password)); } } else { return msgRet("格式:开代理 电话 姓名 0:使用1:测试"); } }
private string searchAccount(string[] arr, Func<string, string> msgRet, string authId) { if (!online(authId)) { return msgRet("请登录"); } string aaa = arr[1]; Regex accountReg = new Regex("100\\d{3}"); Regex phoneReg = new Regex("1\\d{10}"); Regex nameReg = new Regex("[u4e00-u9fa5]+"); Regex valueReg = new Regex("\\d+"); using (busyManDataContext context = new busyManDataContext(conStr)) { if (arr.Length != 2) { return msgRet("查帐号 店铺号/手机号/店铺名/客户姓名"); } StringBuilder sblog = new StringBuilder(); context.Log = new StringWriter(sblog); bool notaccount = !accountReg.IsMatch(aaa); bool notphone = !phoneReg.IsMatch(aaa); bool isvalue = valueReg.IsMatch(aaa); bool notname = isvalue; var s = (from p in context.HCTShop where (notaccount || p.Number.ToString() == aaa) && (notphone || p.ShopkeeperPhone == aaa) && (notname || SqlMethods.Like(p.ShopName, "%" + aaa + "%")) orderby p.Number select p).Take(10).ToList(); if (s.Count == 0) return msgRet("没有信息"); StringBuilder sb = new StringBuilder("账号 姓名 电话 城市 区域 商场 楼层 店铺名\r\n"); foreach (var v in s) { sb.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7}\r\n", v.Number, v.ShopkeeperName, v.ShopkeeperPhone, v.AddrCity, v.AddrDistrict, v.AddrMarket, v.AddrFloor, v.ShopName); } context.Log.Flush(); //StringBuilder sb = new StringBuilder(); // HCTShop v = context.HCTShop.SingleOrDefault(p => p.Number.ToString() == aaa); // sb.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7}\r\n", v.Number, // v.ShopkeeperName, v.ShopkeeperPhone, v.AddrCity, v.AddrDistrict, // v.AddrMarket, v.AddrFloor, v.ShopName); WriteLog("[SQL] ", sblog.ToString()); return msgRet(sb.ToString()); } }
private string modifyAccountInfo(string[] arr, Func<string, string> msgRet, string authId) { if (!online(authId)) { return msgRet("请登录"); } if (arr.Length != 9) { return msgRet("账号 姓名 电话 城市 区域 商场 楼层 店铺名"); } int id = int.Parse(arr[1]); string name = arr[2]; string phone = arr[3]; string city = arr[4]; string dis = arr[5]; string market = arr[6]; string floor = arr[7]; string shopName = arr[8]; using (busyManDataContext context = new busyManDataContext(conStr)) { var shop = context.HCTShop.SingleOrDefault(p => p.Number == id); var account = context.HCTLoginUser.SingleOrDefault(p => p.Account == id); if (shop != null && account != null) { shop.ShopkeeperName = name; shop.ShopkeeperPhone = phone; shop.AddrCity = city; shop.AddrMarket = market; shop.AddrDistrict = dis; shop.AddrFloor = floor; shop.ShopName = shopName; shop.CompanyName = shopName; WriteLog("modifyAccountInfoBAK", string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", shop.Number, shop.ShopkeeperName, shop.ShopkeeperPhone, shop.AddrCity, shop.AddrDistrict, shop.AddrMarket, shop.AddrFloor, shop.ShopName)); var cmp = context.HCTCompany.SingleOrDefault( p => p.CompanyNumber == shop.CompanyNumber); cmp.CompanyName = shopName; cmp.CompanyPhone = phone; account.Name = name; account.Phone = phone; account.UserState = 0; account.Address = city + dis + market + floor; context.SubmitChanges(); WriteLog("modifyAccountInfo", string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8])); return msgRet(string.Format("{0} {1} {2}", shop.Number, shop.ShopName, account.Password)); } else { return msgRet("店铺信息错误"); } } }