protected void ReadData() { IDB = new InfoDb(); try { string DataContent = System.IO.File.ReadAllText(config.GetSection("Data").GetSection("Path").Value); IDB = Newtonsoft.Json.JsonConvert.DeserializeObject <InfoDb>(DataContent); IDB.Loaded(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { string mname = ConfigurationManager.AppSettings["manager"]; if (mname == null) { mname = ""; } var strs = mname.Split(';').ToList(); if (Session["userid"] == null) { Response.Redirect("Login.aspx"); return; } string sname = Session["ShopNum"] as string; if (strs.IndexOf(sname) >= 0) { ismanager = true; } if (Request.QueryString["del"] != null) { int proid; string delid = Request.QueryString["del"]; if (int.TryParse(delid, out proid)) { if (Session["ShopNum"] != null) { string shopnum = Session["ShopNum"].ToString(); new InfoDb().Delinfo(shopnum, proid); Response.Redirect("UserInfoList.aspx"); } } return; } if (Request.QueryString["act"] != null && Request.QueryString["id"] != null && ismanager) { var id = Request.QueryString["id"]; var act = Request.QueryString["act"]; var s = act == "0" ? "1" : "0"; var r = new InfoDb().ExecSql($"update info set start={s} where id={id}"); } DataBing(); }
protected void Page_Load(object sender, EventArgs e) { var order = "id"; int TotalRecord; int TotalPage; int TotalRecord1; int TotalPage1; var orderby = 1; isnlogin = Session["userid"] == null?true:false; (this.Master as NewMain).Setmenu(0); Vindexdata vdata = new Vindexdata(); vdata.swhere = new SearchWhere(""); vdata.bandinfo = new BandInfoDb().GetBandInfoByParentNum("0"); vdata.cartype = new CarTypeInfoDb().GetCarinfoList("0"); vdata.Cardetialinfo = new CarDetialInfoDb().Exec("", 1, 24, order, orderby, out TotalRecord1, out TotalPage1).ToList();// mdb.Queryable<CarDetialInfo>().OrderBy(x => x.Id, OrderByType.desc).Take(18).ToList(); vdata.jiaochelist = new CarDetialInfoDb().Exec(" where CarType = '4'", 1, 8, order, orderby, out TotalRecord, out TotalPage).ToList(); vdata.Suvlist = new CarDetialInfoDb().Exec(" where CarType = '29'", 1, 8, order, orderby, out TotalRecord, out TotalPage).ToList(); vdata.Paochelist = new CarDetialInfoDb().Exec(" where CarType = '28'", 1, 8, order, orderby, out TotalRecord, out TotalPage).ToList(); vdata.piclist = new InfoDb().getAllInfo(4, 0); var infodb = new InfoDb(); List <Info> topinfolist = infodb.getAllInfo(3, 2); int ii = topinfolist == null ? 0:topinfolist.Count; var ls = infodb.getAllInfo(10 - ii, 1); // vdata.infolist = new List <Info>(); if (topinfolist != null) { vdata.infolist.AddRange(topinfolist); } if (ls != null) { vdata.infolist.AddRange(ls); } Model = vdata; // Model.clearlianxi((this.Master as NewMain).isnlogin); }
protected void Page_Load(object sender, EventArgs e) { var usname = ""; string where = ""; (this.Master as NewMain).Setmenu(3); int userid = 0; if (Session["userid"] != null) { userid = (int)Session["userid"]; } if (Session["ShopNum"] != null) { islogin = true; where = " where type!=2 and type!=5 and start>0"; usname = Session["ShopNum"] as string; } else { where = " where (type=3 or type=4 ) and start>0"; } string tempid = Request.QueryString["page"]; dispid = Request.QueryString["id"]; if (dispid == null) { dispid = ""; } if (!string.IsNullOrEmpty(tempid)) { int.TryParse(tempid, out page); if (page == 0) { page = 1; } } var infodb = new InfoDb(); //////post if (Request.Form["title"] != null) { Info info = new Info(); info.title = Request.Form["title"]; info.context = Request.Form["context"]; info.contact = Request.Form["contact"]; var type = Request.Form["type"]; int t; int.TryParse(type, out t); info.type = t; info.username = Request.Form["username"]; info.start = 0; if (!(string.IsNullOrEmpty(info.title) && string.IsNullOrEmpty(info.context))) { infodb.Addinfo(info); } } List <Info> topinfolist = infodb.getAllInfo(10, 2); int ii = topinfolist == null ? 0 : topinfolist.Count; var ls = infodb.Exec(where, page, 25, "id", 1, out totalrecord, out totalpage); listinfo = new List <Info>(); if (topinfolist != null) { listinfo.AddRange(topinfolist); } if (ls != null) { listinfo.AddRange(ls); } }