private void addbrand(string pid) { string tempurl = string.Format("http://www.nb77.cn/index.php?mod=user&ajax=1&bid={0}", pid); string page = HtmlAnalysis.Gethtmlcode("http://www.nb77.cn/static/css/dealer/dealer_user.css"); // var str1 = "<option value='1' >A-奥迪</option><option value='19777' >A-奥驰</option><option value='19780' >A-奥玲</option><option value='957' >A-阿斯顿·马丁</option><option value='771' >B-奔驰Smart</option><option value='190' >B-保时捷</option><option value='469' >B-宾利</option><option value='144' >B-标致</option><option value='302' >B-宝骏</option><option value='462' >B-北汽</option><option value='105' >B-比亚迪</option><option value='99' >B-奔驰</option><option value='773' >B-奔腾</option><option value='78' >B-本田</option><option value='5' >B-宝马</option><option value='779' >B-宝马MINI</option><option value='34' >B-别克</option><option value='186' >C-长安</option><option value='258' >C-昌河</option><option value='254' >C-长丰</option><option value='116' >C-长城</option><option value='310' >D-大迪</option><option value='424' >D-道奇</option><option value='19782' >D-大运</option><option value='658' >D-大发</option><option value='669' >D-东南</option><option value='224' >D-东风</option><option value='192' >D-大宇</option><option value='15' >D-大众</option><option value='53' >F-福特</option><option value='64' >F-丰田</option><option value='360' >F-福迪</option><option value='484' >F-法拉利</option><option value='244' >F-福田</option><option value='160' >F-菲亚特</option><option value='769' >G-GMC</option><option value='329' >G-广汽</option><option value='170' >H-华普</option><option value='443' >H-汇众</option><option value='485' >H-悍马</option><option value='363' >H-海马</option><option value='147' >H-哈飞</option><option value='685' >H-华泰</option><option value='385' >H-黑豹</option><option value='645' >H-红旗</option><option value='691' >J-金龙</option><option value='153' >J-吉利</option><option value='19769' >J-解放</option><option value='289' >J-江淮</option><option value='194' >J-吉普</option><option value='535' >J-捷豹</option><option value='841' >J-吉利帝豪</option><option value='723' >J-吉利上海英伦</option><option value='654' >J-金杯</option><option value='233' >J-江铃</option><option value='393' >J-吉奥</option><option value='175' >J-吉利全球鹰</option><option value='774' >K-开瑞</option><option value='632' >K-凯迪拉克</option><option value='196' >K-克莱斯勒</option><option value='19778' >K-凯马</option><option value='547' >L-路虎</option><option value='543' >L-林肯</option><option value='554' >L-兰博基尼</option><option value='405' >L-力帆</option><option value='724' >L-铃木</option><option value='648' >L-陆风</option><option value='374' >L-莲花</option><option value='770' >L-劳斯莱斯</option><option value='213' >L-雷诺</option><option value='198' >L-雷克萨斯</option><option value='776' >M-迈巴赫</option><option value='572' >M-玛莎拉蒂</option><option value='355' >M-名爵</option><option value='57' >M-马自达</option><option value='85' >N-尼桑</option><option value='111' >N-南汽</option><option value='408' >N-纳智捷</option><option value='576' >O-讴歌</option><option value='580' >O-欧宝</option><option value='165' >Q-奇瑞</option><option value='131' >Q-起亚</option><option value='978' >Q-启辰</option><option value='216' >R-荣威</option><option value='863' >R-瑞麒</option><option value='206' >S-斯巴鲁</option><option value='203' >S-萨博</option><option value='19771' >S-时代</option><option value='217' >S-斯柯达</option><option value='19754' >S-上汽大通</option><option value='376' >S-曙光</option><option value='597' >S-双龙</option><option value='665' >S-双环</option><option value='138' >S-三菱</option><option value='19781' >T-唐骏</option><option value='19731' >T-特斯拉</option><option value='209' >W-沃尔沃</option><option value='615' >W-五十铃</option><option value='370' >W-威麟</option><option value='182' >W-五菱</option><option value='341' >W-万丰</option><option value='454' >X-夏利</option><option value='47' >X-现代</option><option value='123' >X-雪铁龙</option><option value='501' >X-雪佛兰</option><option value='389' >y-依维柯</option><option value='346' >y-一汽</option><option value='19773' >Y-跃进</option><option value='452' >y-永源</option><option value='19779' >Y-跃进</option><option value='607' >y-英菲尼迪</option><option value='325' >Z-中顺</option><option value='327' >Z-众泰</option><option value='19776' >Z-重汽</option><option value='331' >Z-中兴</option><option value='226' >Z-中华</option>"; List <BandInfo> bandlist = new List <BandInfo>(); var list = RegexServer.RegGroupCollection(page, "<option value=(?<x>\\d+)>(?<y>.*?)</option>"); if (list == null) { return; } for (int i = 0; i < list.Count; i++) { var key = list[i].Groups["x"].Value; var bname = list[i].Groups["y"].Value; BandInfo brand = new BandInfo { FirstChart = "", BrandName = bname, ParentBrandNum = "bid_" + pid, BrandNum = key, DisplayName = bname, CreateTime = DateTime.Now }; bandlist.Add(brand); } new BandInfoDb().AddBandInfo(bandlist); }
protected void Page_Load(object sender, EventArgs e) { string id = "0"; if (Session["userid"] != null) { id = Session["userid"].ToString(); } int idd = 0; int.TryParse(id, out idd); var sdb = new ShopInfoDb(); shop = sdb.getShopinfo(idd); if (shop == null) { shop = new ShopInfo(); } if (!Page.IsPostBack) { string username = "", opwd = "", pwd, pwd1; if (Request.RequestType.ToUpper() == "POST") { opwd = Request["oldpwd"]; pwd = Request["pwd"]; pwd1 = Request["pwd1"]; if (pwd != pwd1) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>输入密码错误!</td></tr>"; //"请刷新页面"; return; } if (!RegexServer.regIsMatch(pwd, "^[A-Za-z0-9]+${6,10}")) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>登录密码必须是6-10位</td></tr>"; //"请刷新页面"; return; } if (shop.ShopPwd == opwd) { shop.ShopPwd = pwd; sdb.UpdateData(shop); ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>密码个性成功</td></tr>"; //"请刷新页面"; } else { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请输入登录密码</td></tr>"; //"请刷新页面"; } } } }
private void addBrandType(AutoHomeBrand brand) { string url = string.Format("http://m.che168.com/carlist/FilterSeries.aspx?brandid={0}&prov=0&safe=0&v=20170302184056", brand.CountryCode.Replace("brandid=", "")); var page = HtmlAnalysis.Gethtmlcode(url); var brands = new List <AutoHomeBrand>(); var ulList = RegexServer.RegGroupCollection(page, "</ul>(?<x>.*?)</ul>"); var db = new BrandFullDb(); foreach (var ul in ulList) { var cartype = RegexServer.RegGroupsX <string>(ul.ToString(), "<h3>(?<x>.*?)</h3>").Trim(); var lilist = RegexServer.RegGroupCollection(ul.ToString(), "<li(?<x>.*?)</li>"); foreach (var li in lilist) { try { var content = li.ToString(); var pinyin = RegexServer.RegGroupsX <string>(content, "data-pinyin=\"(?<x>.*?)\""); AutoHomeBrand brandType = new AutoHomeBrand { Pid = brand.Id, Level = 2, Hot = 0, CarType = cartype, Letter = pinyin.Length > 0 ? pinyin.Substring(0, 1) : "", Pinyin = pinyin, Title = RegexServer.RegGroupsX <string>(content, "class=\"carseries\".*?>(?<x>.*?)</span>").Trim() }; brands.Add(brandType); } catch (Exception) { continue; } } } db.AddBandInfo(brands); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["companyName"] == null) { return; } string validCode = Request.Form["code"]; if (Session["validCode"] == null) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>验证码已过期,请刷新页面重试</td></tr>"; //"请刷新页面"; return; } if (Session["validCode"].ToString() != validCode) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>您输入的验证码有误,请重试</td></tr>"; //"请刷新页面"; return; } ShopInfo shop = new ShopInfo(); shop.IdCart = Request.Form["userCompany"]; if (string.IsNullOrEmpty(shop.IdCart)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请上传身份证</td></tr>"; //"请刷新页面"; return; } shop.PhoneNumber = Request.Form["phoneNum"]; if (string.IsNullOrEmpty(shop.PhoneNumber)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请输入手机号码</td></tr>"; //"请刷新页面"; return; } float phonenum = 0; if (shop.PhoneNumber.Length != 11 || !float.TryParse(shop.PhoneNumber, out phonenum)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>您输入的手机号码有误</td></tr>"; //"请刷新页面"; return; } shop.BusinessLicense = Request.Form["CompanyLisent"]; if (string.IsNullOrEmpty(shop.BusinessLicense)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请上传营业执照</td></tr>"; //"请刷新页面"; return; } shop.CompanyName = Request.Form["companyName"]; if (string.IsNullOrEmpty(shop.CompanyName)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请输入公司名称</td></tr>"; //"请刷新页面"; return; } shop.ShopNum = Request.Form["netNumber"]; if (string.IsNullOrEmpty(shop.ShopNum)) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请输入公司名称短号</td></tr>"; //"请刷新页面"; return; } shop.ShopPwd = Request.Form["pwd"]; if (!RegexServer.regIsMatch(shop.ShopPwd, "^[A-Za-z0-9]+${6,10}")) { ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>请输入登录密码</td></tr>"; //"请刷新页面"; return; } //^[A-Za-z0-9]+$ new ShopInfoDb().AddShopInfo(shop); ErrorMsg = "<tr><td width=\'80\' height=\'40\' align=\'right\'></td><td style=\'color:red;\'>您的数据已提交成功</td></tr>"; //"请刷新页面"; Response.Redirect("Login.aspx"); return; }