private void disp(CarDetialInfo c) { var carlist = new CarTypeInfoDb().GetCarinfoList("0"); title.Text = c.ProTitle; Literal1.Text = c.baojia.ToString("#0.00"); huanjia.Text = "(还价不多)"; sellnumber.Text = c.SellerNumber; ProNum.Text = c.ProNum?.Replace(c.SellerNumber, "") ?? ""; shangpaiym.Text = c.ShangPaiYear + "年" + c.ShangPaiMonth + "月"; var ct = carlist.FirstOrDefault(x => x.CarTypeKey == c.CarType); cartype.Text = ct.DisplayName; country.Text = c.country; CarColor.Text = c.CarColor; PaiLiang.Text = c.PaiLiang; BianShuQi.Text = c.BianShuQi; LiCheng.Text = c.LiCheng.ToString("0.00"); PaiFangBiaoZhun.Text = c.PaiFangBiaoZhun; RanYou.Text = c.RanYou; cdate.Text = c.CreateTime.ToShortDateString(); yangqing.Text = c.Remark.Replace("\\n", ""); SellerName.Text = c.SellerName; tel.Text = c.SellerPhone; Address.Text = c.CarSellAddress; }
public void ProcessRequest(HttpContext context) { int TotalRecord; int TotalPage; JObject o; var ls = GetDbData(context.Request, out TotalRecord, out TotalPage); var carlist = new CarTypeInfoDb().GetCarinfoList("0"); StringBuilder sb = new StringBuilder(); JArray ar = new JArray(); foreach (var v in ls) { o = new JObject(); var car = carlist.FirstOrDefault(x => x.CarTypeKey == v.CarType); o["ProTitle"] = v.ProTitle; //data.act.ToString(); o["SellerName"] = v.SellerName; //data.act.ToString(); o["Id"] = v.Id; o["Carname"] = car == null?"":car.DisplayName; o["ShangPaiTime"] = v.ShangPaiTime; o["CarColor"] = v.CarColor; o["baojia"] = v.baojia; o["BianShuQi"] = v.BianShuQi; o["CreateTime"] = v.CreateTime.ToShortDateString(); o["ProNum"] = v.ProNum; o["SellerNumber"] = v.SellerNumber; var str = v.Images.Split(';'); o["pic1"] = str.Length > 0?str[0]:""; o["pic2"] = str.Length > 1 ? str[1] : ""; o["pic3"] = str.Length > 2 ? str[2] : ""; o["r"] = TotalRecord.ToString(); o["p"] = TotalPage.ToString(); ar.Add(o); } context.Response.ContentType = "text/plain"; context.Response.Write(ar.ToString()); }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); year = DateTime.Now.Year; var str = Request["ac"]; carsort = Request["carsort"] ?? ""; p_no = Request["p_no"] ?? ""; p_brand = Request["p_brand"] ?? ""; p_subbrand = Request["p_subbrand"] ?? ""; startprice = Request["startprice"] ?? ""; endprice = Request["endprice"] ?? ""; startage = Request["startage"] ?? ""; endage = Request["endage"] ?? ""; p_transmission = Request["p_transmission"] ?? ""; keywords = Request["keywords"] ?? ""; var binfo = new BandInfoDb(); mlist = binfo.GetBandInfoByParentNum("0"); if (p_brand != "") { clist = binfo.GetBandInfoByParentNum(p_brand); } var carinfo = new CarTypeInfoDb(); tlist = carinfo.GetCarinfoList("0"); blist = carinfo.GetCarinfoList("1"); sb.Append("ac="); if (!string.IsNullOrEmpty(str)) { sb.Append(str); } //str = Request["keywords"]; ////str= HttpUtility.UrlDecode(str,Encoding.Default); //string tmp1 = System.Web.HttpUtility.UrlDecode(str, Encoding.GetEncoding("gb2312")); //sb.Append("&keywords="); //if (!string.IsNullOrEmpty(str)) // sb.Append(str); //winfo = sb.ToString(); Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); }
private void addCar(prolog item) { string detial = item.proName.TrimStart('[').TrimEnd(']').Replace("\"", ""); var prolist = detial.Split(','); var spri = prolist[2].Substring(prolist[2].IndexOf(":") + 1).Replace("年", "-").Replace("月", ""); var Cartype = prolist[3].Substring(prolist[3].IndexOf(":") + 1); var typeitem = new CarTypeInfoDb().GetCarinfo(new CarTypeInfo { DisplayName = Cartype }); var p_sort = typeitem.CarTypeKey; //Request.Form["p_sort"]; var title = prolist[23]; title = title.Substring(title.IndexOf(":") + 1); var bramdName = Regex.Match(title, brandReg, RegexOptions.IgnoreCase).Value; var brand = brandList.FirstOrDefault(c => c.BrandName == bramdName); var catxinghao = new BandInfoDb().GetBandInfoByParentNum(brand.BrandNum); string xhReg = ""; foreach (var xh in catxinghao) { xhReg += xh.BrandName + "|"; } xhReg = xhReg.TrimEnd('|'); var tempxinghao = Regex.Match(title, xhReg, RegexOptions.IgnoreCase).Value; var tempbrandtype = catxinghao.FirstOrDefault(c => c.DisplayName == tempxinghao); var temppic = ""; foreach (var propic in prolist) { if (propic.Contains(".jpg")) { temppic += propic.Trim(' ') + ";"; } } var p_price = Regex.Match(prolist[0], ":(?<x>.*?)万元", RegexOptions.IgnoreCase).Groups["x"].Value; var p_color = prolist[5].Substring(prolist[5].IndexOf(":") + 1); var p_kilometre = prolist[8].Substring(prolist[8].IndexOf(":") + 1).Replace("万", ""); var p_gas = prolist[6].Substring(prolist[6].IndexOf(":") + 1); var p_country = prolist[4].Substring(prolist[4].IndexOf(":") + 1); var p_transmission = prolist[7].Substring(prolist[7].IndexOf(":") + 1); var p_fuel = prolist[10].Substring(prolist[10].IndexOf(":") + 1); var p_emissionstandards = prolist[9].Substring(prolist[9].IndexOf(":") + 1); var p_details = Regex.Match(detial, "车况说明:(?<x>.*?)$", RegexOptions.IgnoreCase).Groups["x"].Value; var seller = prolist[12].Substring(prolist[12].IndexOf(":") + 1); var sellerphone = prolist[14].Substring(prolist[14].IndexOf(":") + 1); var selleradress = prolist[13].Substring(prolist[13].IndexOf(":") + 1); var proNum = prolist[1].Substring(prolist[1].IndexOf(":") + 1); CarDetialInfo pro = new CarDetialInfo(); pro.ProTitle = title; pro.CarType = p_sort; pro.BrandInfo = bramdName; pro.BrandType = tempxinghao; pro.ProNum = proNum; pro.OtherParam = ""; pro.ShangPaiTime = spri; //p_year + "-" + p_month; if (brand.BrandNum != null) { pro.BrandInfoKey = brand.BrandNum; } if (tempbrandtype != null) { pro.BrandTypeKey = tempbrandtype.BrandNum; } pro.ShangPaiMonth = int.Parse(spri.Split('-')[1]); pro.ShangPaiYear = int.Parse(spri.Split('-')[0]); pro.Images = temppic; pro.mianimg = "1"; pro.baojia = decimal.Parse(p_price); pro.CarColor = p_color; pro.LiCheng = decimal.Parse(p_kilometre); pro.PaiLiang = p_gas; pro.country = p_country; pro.BianShuQi = p_transmission; pro.RanYou = p_fuel; pro.Remark = p_details; pro.PaiFangBiaoZhun = p_emissionstandards; pro.SellerName = seller; pro.SellerPhone = sellerphone; pro.SellerName = proNum.Split(' ')[0]; pro.CarSellAddress = selleradress; new CarDetialInfoDb().AddCarinfo(pro); }
private void dataBind(int proid) { var proinfo = new CarDetialInfoDb().GetCarinfo(proid); Page.Title = "我的车源管理"; var list = new BandInfoDb().GetBandInfoByParentNum("0"); StringBuilder brands = new StringBuilder(); brands.Append("<option value=''>请选择品牌</option>"); string brandBind = ""; int yearBind = 0; int monthBind = 0; p_country = "<input type='radio' name='p_country' value='国产' checked='checked'>国产 <input type='radio' name='p_country' value='进口' >进口"; if (proinfo != null) { brandBind = proinfo.BrandInfo; yearBind = proinfo.ShangPaiYear; monthBind = proinfo.ShangPaiMonth; p_mainpic = proinfo.mianimg; p_color = proinfo.CarColor; p_name = proinfo.OtherParam; p_price = proinfo.baojia.ToString("0.00"); p_kilometre = proinfo.LiCheng; p_gas = proinfo.PaiLiang; p_details = proinfo.Remark.Replace("\n", ""); if (proinfo.country == "进口") { p_country = "<input type='radio' name='p_country' value='国产' >国产 <input type='radio' name='p_country' checked='checked' value='进口' >进口"; } var imgs = proinfo.Images.Split(';'); foreach (var img in imgs) { var imgid = Regex.Match(img, "/carimg/small/(?<x>\\d+).jpg", RegexOptions.IgnoreCase).Value; if (string.IsNullOrEmpty(imgid)) { imgid = "0"; } Imgli += string.Format("<li id='{0}'><img name='p_pics' src='{1}'><p><a href=\"javascript:delimg('{0}')\"> 删除</a></p></li>", imgid, img); } var secBrand = new BandInfoDb().GetBandInfoByParentNum(proinfo.BrandInfoKey); foreach (var item in secBrand) { if (proinfo.BrandTypeKey == item.BrandNum) { subbrand += string.Format("<option selected='selected' value='{0}'>{1}</option>", item.BrandNum, item.DisplayName); } else { subbrand += string.Format("<option value='{0}'>{1}</option>", item.BrandNum, item.DisplayName); } } } string[] pfbz = { "国一", "国二", "国三", "国三+OBD", "国四", "国五" }; foreach (var item in pfbz) { if (proinfo != null && proinfo.PaiFangBiaoZhun == item) { p_emissionstandards += string.Format("<option selected='selected' value='{0}'>{0}</option>", item); } else { p_emissionstandards += string.Format("<option value='{0}'>{0}</option>", item); } } string[] p_fuellist = { "汽油", "柴油", "混动", "电动" }; foreach (var item in p_fuellist) { if (proinfo != null && proinfo.RanYou == item) { p_fuel += string.Format("<option selected='selected' value='{0}'>{0}</option>", item); } else { p_fuel += string.Format("<option value='{0}'>{0}</option>", item); } } var typelist = new CarTypeInfoDb().GetAllCarType(); foreach (var item in typelist) { if (item.ParentCarTypeKey == "0") { if (proinfo != null && proinfo.BrandTypeKey == item.CarTypeKey) { p_sort += string.Format("<option selected='selected' value='{0}'>{1}</option>", item.CarTypeKey, item.DisplayName); } else { p_sort += string.Format("<option value='{0}'>{1}</option>", item.CarTypeKey, item.DisplayName); } } if (item.ParentCarTypeKey == "1") { if (proinfo != null && proinfo.BianShuQi == item.DisplayName) { p_transmission += string.Format("<input type='radio' name='p_transmission' checked='checked' value='{0}'>{0}", item.DisplayName); } else { p_transmission += string.Format("<input type='radio' name='p_transmission' value='{0}'>{0}", item.DisplayName); } } // } foreach (var item in list) { if (item.BrandName == brandBind) { brands.AppendFormat("<option selected='selected' value='{0}'>{1}</option>", item.BrandNum, item.DisplayName); } else { brands.AppendFormat("<option value='{0}'>{1}</option>", item.BrandNum, item.DisplayName); } } Brandinfo = brands.ToString(); StringBuilder Buyyear = new StringBuilder(); int currYear = DateTime.Now.Year; Buyyear.Append("<option value=''>请选择年份</option>"); for (int i = 0; i < 20; i++) { if (yearBind == (currYear - i)) { Buyyear.AppendFormat("<option selected='selected' value='{0}'>{0}</option>", currYear - i); } else { Buyyear.AppendFormat("<option value='{0}'>{0}</option>", currYear - i); } } BuyCarYear = Buyyear.ToString(); StringBuilder BuyMonth = new StringBuilder(); BuyMonth.Append("<option value=''>请选择月份</option>"); for (int i = 1; i < 13; i++) { if (monthBind == i) { BuyMonth.AppendFormat("<option selected='selected' value='{0}'>{0}</option>", i.ToString("00")); } else { BuyMonth.AppendFormat("<option value='{0}'>{0}</option>", i.ToString("00")); } } BuyCarMonth = BuyMonth.ToString(); var carType = new CarTypeInfoDb().GetAllCarType(); }
public void Init() { Dictionary <string, string> dic; // 品牌 dic = new Dictionary <string, string> { { "不限", "0" }, { "大众", "15" }, { "别克", "34" }, { "雪佛兰", "501" }, { "福特", "53" }, { "丰田", "64" }, { "比亚迪", "105" }, { "奔驰", "99" }, { "现代", "47" }, { "宝马", "5" }, { "吉利", "153" }, { "荣威", "216" }, { "斯柯达", "217" }, { "奥迪", "1" }, { "众泰", "327" }, { "本田", "78" }, { "尼桑", "85" }, { "起亚", "131" }, { "标致", "144" } }; Carwhere.Add("a", dic); //车 系 dic = new Dictionary <string, string> { { "不限", "0" }, { "凯越", "36" }, { "福克斯", "55" }, { "科鲁兹", "761" }, { "朗逸", "675" }, { "荣威", "216" }, { "明锐", "218" }, { "英朗xt", "875" }, { "君威", "38" }, { "POLO", "20" }, { "宝马3系", "19717" }, { "君越", "37" }, { "睿翼", "768" }, { "标致307", "145" }, { "别克GL8", "527" }, { "速腾", "16" }, { "世嘉", "130" }, { "宝马520", "7" }, { "天籁", "93" }, { "蒙迪欧", "54" } }; Carwhere.Add("b", dic); //价 格 dic = new Dictionary <string, string> { { "不限", "0" }, { "3万以下", "1" }, { "3-5万", "2" }, { " 5-7万", "3" }, { "7-9万", "4" }, { "9-12万", "5" }, { "12-16万", "6" }, { "16-20万", "7" }, { "20万以上", "8" } }; Carwhere.Add("c", dic); // 车龄 dic = new Dictionary <string, string> { { "不限", "0" }, { "1年以内", "1" }, { "3年内", "3" }, { "5年内", "5" }, { "5年以上", "6" } }; Carwhere.Add("d", dic); //车型 var chexing = new Dictionary <string, string>(); chexing.Add("不限", "0"); var ls = new CarTypeInfoDb().GetCarinfoList("0"); foreach (var v in ls) { chexing.Add(v.DisplayName, v.CarTypeKey); } Carwhere.Add("e", chexing); var bsx = new Dictionary <string, string>(); //变速箱 bsx.Add("不限", "0"); ls = new CarTypeInfoDb().GetCarinfoList("1"); foreach (var v in ls) { bsx.Add(v.DisplayName, v.CarTypeKey); } Carwhere.Add("f", bsx); //行驶里程 dic = new Dictionary <string, string> { { "不限", "0" }, { " 1万公里内 ", "1" }, { " 3万公里内 ", "3" }, { "5万公里内 ", "5" }, { "5万公里上 ", "6" } }; Carwhere.Add("g", dic); //排量 dic = new Dictionary <string, string> { { "不限", "0" }, { "1.0L以下", "1" }, { "1.0-1.6L", "2" }, { "1.6-2.0L", "3" }, { "2.0-3.0L ", "4" }, { "3.0L以上", "5" } }; Carwhere.Add("h", dic); //排放标准 dic = new Dictionary <string, string> { { "不限", "0" }, { "国二及以上", "1" }, { "国三及以上", "2" }, { "国四及以上", "3" }, { "国五", "4" } }; Carwhere.Add("i", dic); //燃油类型 dic = new Dictionary <string, string> { { "不限", "0" }, { "汽油", "1" }, { "柴油", "2" }, { "电动", "3" }, { "油电混合", "4" }, { "其他", "5" } }; Carwhere.Add("j", dic); //颜色 dic = new Dictionary <string, string> { { "不限", "0" }, { "黑色", "03" }, { "白色", "04" }, { "银灰色", "10" }, { "深灰色", "15" }, { "红色", "09" }, { "橙色", "11" }, { "绿色", "02" }, { "蓝色", "05" }, { "咖啡色", "06" }, { "紫色", "07" }, { "香槟色", "08" }, { "多彩色", "12" }, { "黄色", "13" }, { "其它", "14" } }; Carwhere.Add("k", dic); //车牌所在地 dic = new Dictionary <string, string> { { "不限", "0" }, { "本地", "1" }, { "外地", "2" } }; Carwhere.Add("l", dic); dic = new Dictionary <string, string> { { "-1", "价格{0}元起" } }; Carwhere.Add("n", dic); dic = new Dictionary <string, string> { { "-1", "价格{0}元止" } }; Carwhere.Add("m", dic); dic = new Dictionary <string, string> { { "-1", "编号{0}" } }; Carwhere.Add("q", dic); }