/// <summary> /// 说明:初始化调用构造函数后可能不可用的数据。 /// </summary> /// <param name="requestContext"></param> protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); SpeechInfoBLL bll = new SpeechInfoBLL(); citys = bll.GetCitys(); WorkContext.IsHttpAjax = WebHelper.IsAjax(); WorkContext.Url = WebHelper.GetUrl(); WorkContext.UrlReferrer = WebHelper.GetUrlReferrer(); WorkContext.IP = WebHelper.GetIP(); // WebHelper.GetIP(); if (string.IsNullOrWhiteSpace(WorkContext.IP) || WorkContext.IP == "127.0.0.1") { WorkContext.CityName = "重庆市"; } else { //测试地址搜索#region 测试地址搜索 IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; WorkContext.CityName = addre.Substring(IndexofA); } UsersEntity userInfo = new UsersEntity(); Guid uid = ShopUtils.GetUidCookie(); //获得保存在cookie中的密码 string encryptPwd = ShopUtils.GetCookiePassword(); UsersBLL userBll = new UsersBLL(); if (Session["User"] != null) { CurrentUser = Session["User"] as UsersEntity; userInfo = CurrentUser; } else { userInfo = userBll.GetPartUserByUidAndPwd(uid); // requestContext.HttpContext.Response.Write("<script>alert('登录超时!');window.location.reload();</script>"); } if (userInfo != null && !Guid.Empty.Equals(userInfo.Id)) { WorkContext.Uid = userInfo.Id; WorkContext.Password = userInfo.Password; WorkContext.UserEmail = userInfo.Email; WorkContext.NickName = string.IsNullOrWhiteSpace(userInfo.NickName) ? userInfo.Email : userInfo.NickName; } //从cookie中获取用户的基本信息 }
public ActionResult GetRecords() { var list = new List<Entity.SpeechInfoPart>(); SpeechInfoBLL bll = new SpeechInfoBLL(); StringBuilder sb = new StringBuilder(); var result = new TResult<List<SpeechInfoPart>>(); if (!Guid.Empty.Equals(WorkContext.Uid)) { result = bll.GetSpeechInfoListByFromId(WorkContext.Uid, null); if (result.IsSuccess && result.TData.Count > 0) { list = result.TData; } } return Json(result); }
public ActionResult DelSpeechInfo() { var result = new List<SpeechInfo>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; result = bll.GetSpeechList(); return View(result); }
public ActionResult SendContent(string id) { SpeechInfoBLL bill=new SpeechInfoBLL(); var tresult= bill.GetSpeechInfoEntityByID(new Guid(id), null); ViewBag.IsShowSend = bill.GetUser(id); return View(tresult); }
public ActionResult Save(SpeechInfoEntity model) { try { SpeechInfoBLL bll = new SpeechInfoBLL(); IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; var ct = addre.Substring(0,IndexofA); var sourceaddr = addre; var citys= bll.GetCitys(); if (citys.FirstOrDefault(s => s.CityName == ct) == null) { ct = "重庆市"; } model.SourceCity = sourceaddr; model.City = ct; model.FromUser = WorkContext.Uid; model.IsVip = Convert.ToByte(Guid.Empty.Equals(WorkContext.Uid) ? 0 : 1); model.SumbitTime = DateTime.Now; model.State = 1;//-1为删除状态,1表示正常 if (bll.Insert(model, null)) { return AjaxResult("ok", "发送成功!", false); } else { return AjaxResult("err", "发送失败!", false); } } catch (Exception ex) { return AjaxResult("err", "发送失败!" + ex.ToString(), false); throw; } }
public ContentResult DelOneSpeeInfo(string id) { if (Session["User"] != null) { var User = Session["User"] as UsersEntity; UsersBLL ubill = new UsersBLL(); if (User != null) { var quser = ubill.GetUserById(User.Id); if (quser.isadmin == true) { Guid itemid = new Guid(id); SpeechInfoBLL bll = new SpeechInfoBLL(); if (bll.Delete(itemid, User.Id)) { return Content("操作成功"); } } else { if (BuildFactory.AppylyStroeFactory().QueryDateTime(User.Id) != null) { var dateTime = BuildFactory.AppylyStroeFactory().QueryDateTime(User.Id).DelTime; DateTime dt1 = (DateTime)dateTime; DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt1; if (ts.Days == 0 && ts.Hours == 0) { return Content("对不起,你在一个小时内不能再删其他用户的数据"); } else { Guid itemid = new Guid(id); SpeechInfoBLL bll = new SpeechInfoBLL(); if (bll.Delete(itemid, User.Id)) { return Content("操作成功"); } } } else { Guid itemid = new Guid(id); SpeechInfoBLL bll = new SpeechInfoBLL(); if (bll.Delete(itemid, User.Id)) { return Content("操作成功"); } } } } } else { return Content("对不起,请先登陆了再删除"); } return Content(""); }
public ActionResult Index1(string Searchkey, string city) { var str = Searchkey; var result = new TResult<List<Entity.SpeechInfoEntity>>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; ViewBag.Sel = city; ViewBag.Key = Searchkey; result = bll.GetAllSpeechInfoList(str, city, null); return View("Index",result); }
public ActionResult Index() { //IPScaner objScan = new IPScaner(); //string ip = Request.UserHostAddress.ToString(); //objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); //objScan.IP = "58.19.17.114"; ////"113.200.29.90"; //string addre = "湖北省武汉市"; //int IndexofA = addre.IndexOf("省") + 1; //var ct = addre.Substring(0,IndexofA); //Response.Write("58.19.17.114====" + addre + "========" + ct); var str = string.Empty; var city = string.Empty; if (Request["key"] != null) { str = Request["key"]; } if (Request["c"] != null) { city = Request["c"]; } var result = new TResult<List<Entity.SpeechInfoEntity>>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; result = bll.GetAllSpeechInfoList(str, city, null); ; return View(result); }
/// <summary> /// 中间1. 发言 /// </summary> /// <returns></returns> public ActionResult GetSpeachList() { var result = new TResult<List<Entity.SpeechInfoEntity>>(); SpeechInfoBLL bll = new SpeechInfoBLL(); //result = bll.GetAllSpeechInfoList(null); return View(result); }
public ActionResult DelSpeechInfo(string key, string city) { var str = key; var result = new List<SpeechInfo>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; ViewBag.Sel = city; ViewBag.Key = key; result = bll.GetSpeechList(key,city); return View(result); }
public ActionResult Save(SpeechInfoEntity model) { try { var city = ""; //统计当前发言人的发言次数 //if (Session["User"] != null) //{ // UsersEntity user = Session["User"] as UsersEntity; // //获取当前这个人的这个小时发言的数量 string uid = string.Empty; if (Session["User"] != null) { UsersEntity user = Session["User"] as UsersEntity; uid = user.Id.ToString(); } else { uid = ShopUtils.GetBSPCookie("bsp"); if (string.IsNullOrEmpty(uid.ToString())) { uid = Guid.NewGuid().ToString(); ShopUtils.SetBSPCookie("bsp", uid); } } SpeechInfoBLL bll = new SpeechInfoBLL(); IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; var ct = addre.Substring(0,IndexofA); var sourceaddr = addre; var citys = bll.GetCitys(); if (citys.FirstOrDefault(s => s.CityName == ct) == null) { ct = "重庆市"; } SpeechInfoBLL bill = new SpeechInfoBLL(); if (!string.IsNullOrEmpty(uid)) { int num = bill.GetSpeechCount(new Guid(uid)); if (num >= 3) { return AjaxResult("err", "发送失败一小时内最多能发3条!", false); } } model.SourceCity = sourceaddr; model.FromUser = new Guid(uid); model.IsVip = Convert.ToByte(Guid.Empty.Equals(new Guid(uid)) ? 0 : 1); model.SumbitTime = DateTime.Now; model.State = 1; //-1为删除状态,1表示正常 model.City = ct; // SpeechInfoBLL bll = new SpeechInfoBLL(); if (bll.Insert(model, null)) { return AjaxResult("ok", "发送成功!", false); } else { return AjaxResult("ok", "发送失败!", false); } //} //return AjaxResult("err", "请登陆后发信息!", false); } catch (Exception ex) { //return AjaxResult("err", "发送失败!" + ex.ToString(), false); throw; } }
public ActionResult SelectShop() { ViewBag.count = BuildFactory.AppylyStroeFactory().QueryShop().Count; var str = string.Empty; var city = string.Empty; if (Request["key"] != null) { str = Request["key"]; } if (Request["c"] != null) { city = Request["c"]; } var result = new TResult<List<Entity.SpeechInfoEntity>>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; result = bll.GetAllSpeechInfoList(str, city, null); ; return View(result); }
public ActionResult MyShop1(int id) { double pageCount = (double)(BuildFactory.GoodsFactory().Count(id)) / 12;//每页10 pageCount = Math.Ceiling(pageCount); ViewBag.PageCout = pageCount;//一共多少页 ViewBag.Count = BuildFactory.GoodsFactory().Count(id); Session["stroeid"] = id; ViewBag.count = BuildFactory.AppylyStroeFactory().QueryShop().Count; var str = string.Empty; var city = string.Empty; if (Request["key"] != null) { str = Request["key"]; } if (Request["c"] != null) { city = Request["c"]; } var result = new TResult<List<Entity.SpeechInfoEntity>>(); SpeechInfoBLL bll = new SpeechInfoBLL(); ViewBag.Citys = citys; result = bll.GetAllSpeechInfoList(str, city, null); ; return View(result); }