public void Save(BanKaList BanKaList) { BanKaList baseBanKaList = Entity.BanKaList.FirstOrDefault(n => n.Id == BanKaList.Id); baseBanKaList = Request.ConvertRequestToModel <BanKaList>(baseBanKaList, BanKaList); Entity.SaveChanges(); BaseRedirect(); }
public void Add(BanKaList BanKaList) { BanKaList = Request.ConvertRequestToModel <BanKaList>(BanKaList, BanKaList); BanKaList.AddTime = DateTime.Now; BanKaList.Click = 0; Entity.BanKaList.AddObject(BanKaList); Entity.SaveChanges(); BaseRedirect(); }
public void ChangeStatus(BanKaList BanKaList, string InfoList, string Clomn, string Value) { if (string.IsNullOrEmpty(InfoList)) { InfoList = BanKaList.Id.ToString(); } int Ret = Entity.ChangeEntity <BanKaList>(InfoList, Clomn, Value); Entity.SaveChanges(); Response.Write(Ret); }
public void Delete(BanKaList BanKaList, string InfoList, int?IsDel) { if (string.IsNullOrEmpty(InfoList)) { InfoList = BanKaList.Id.ToString(); } int Ret = Entity.MoveToDeleteEntity <BanKaList>(InfoList, IsDel, AdminUser.UserName); Entity.SaveChanges(); Response.Write(Ret); }
public object Info(BanKaList BanKaList) { Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == BanKaList.Token); if (baseUsers == null)//用户令牌不存在 { ViewBag.ErrorMsg = "用户登录信息有误"; return(View("Error")); } if (baseUsers.State != 1)//用户被锁定 { ViewBag.ErrorMsg = "您的帐户被限制登录"; return(View("Error")); } if (baseUsers.CardStae != 2)//未实名认证 { ViewBag.ErrorMsg = "您未实名认证,无法访问"; return(View("Error")); } if (baseUsers.MiBao != 1)//未设置支付密码 { ViewBag.ErrorMsg = "您未设置支付密码,无法访问"; return(View("Error")); } BanKaList = Entity.BanKaList.FirstOrNew(n => n.Id == BanKaList.Id); BanKaOrder BanKaOrder = Entity.BanKaOrder.FirstOrDefault(n => n.OrderState == 2 && n.PayState == 1 && n.UId == baseUsers.Id && n.BKTId == BanKaList.BKTId); if (BanKaOrder == null) { ViewBag.ErrorMsg = "您未购买本服务,请购买后再使用!"; return(View("Error")); } BanKaList.Click++; Entity.SaveChanges(); string url = BanKaList.Url; if (url.IsNullOrEmpty()) { ViewBag.ErrorMsg = "链接有误,请稍后访问!"; return(View("Error")); } Response.Redirect(url); return(false); }
public ActionResult Edit(BanKaList BanKaList) { ViewBag.BanKaTypeList = Entity.BanKaType.Where(n => n.State == 1).OrderBy(n => n.Sort).ToList(); if (BanKaList.Id != 0) { BanKaList = Entity.BanKaList.FirstOrDefault(n => n.Id == BanKaList.Id); } if (BanKaList == null) { ViewBag.ErrorMsg = "数据不存在"; return(View("Error")); } ViewBag.BanKaList = BanKaList; if (Request.UrlReferrer != null) { Session["Url"] = Request.UrlReferrer.ToString(); } return(View()); }
public ActionResult Index(BanKaList BanKaList, EFPagingInfo <BanKaList> p, int IsFirst = 0) { if (IsFirst == 0) { PageOfItems <BanKaList> BanKaListList1 = new PageOfItems <BanKaList>(new List <BanKaList>(), 0, 10, 0, new Hashtable()); ViewBag.BanKaListList = BanKaListList1; ViewBag.BanKaList = BanKaList; ViewBag.BanKaTypeList = Entity.BanKaType.Where(n => n.State == 1).OrderBy(n => n.Sort).ToList(); ViewBag.Add = this.checkPower("Add"); ViewBag.Delete = this.checkPower("Delete"); ViewBag.Save = this.checkPower("Save"); return(View()); } if (!BanKaList.BKTId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.BKTId == BanKaList.BKTId); } if (!BanKaList.Title.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Title.Contains(BanKaList.Title)); } if (!BanKaList.State.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.State == (BanKaList.State == 99 ? 0 : BanKaList.State)); } p.OrderByList.Add("Sort", "ASC"); IPageOfItems <BanKaList> BanKaListList = Entity.Selects <BanKaList>(p); ViewBag.BanKaListList = BanKaListList; ViewBag.BanKaList = BanKaList; ViewBag.BanKaTypeList = Entity.BanKaType.Where(n => n.State == 1).OrderBy(n => n.Sort).ToList(); ViewBag.Add = this.checkPower("Add"); ViewBag.Delete = this.checkPower("Delete"); ViewBag.Save = this.checkPower("Save"); return(View()); }
public void Post() { string Data = DataObj.GetData(); if (Data.IsNullOrEmpty()) { DataObj.OutError("1000"); return; } JObject json = new JObject(); try { json = (JObject)JsonConvert.DeserializeObject(Data); } catch (Exception Ex) { Log.Write("[BanKaList]:", "【Data】" + Data, Ex); } if (json == null) { DataObj.OutError("1000"); return; } BanKaList BanKaList = new BanKaList(); BanKaList = JsonToObject.ConvertJsonToModel(BanKaList, json); Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == BanKaList.Token); if (baseUsers == null)//用户令牌不存在 { DataObj.OutError("2004"); return; } if (baseUsers.State != 1)//用户被锁定 { DataObj.OutError("2003"); return; } if (baseUsers.CardStae != 2)//未实名认证 { DataObj.OutError("2006"); return; } if (baseUsers.MiBao != 1)//未设置支付密码 { DataObj.OutError("2008"); return; } BanKaType BanKaType = Entity.BanKaType.FirstOrDefault(n => n.Id == BanKaList.BKTId && n.State == 1); if (BanKaType == null) { DataObj.OutError("1001"); return; } BanKaOrder BanKaOrder = Entity.BanKaOrder.FirstOrDefault(n => n.OrderState == 2 && n.PayState == 1 && n.UId == baseUsers.Id && n.BKTId == BanKaType.Id); if (BanKaOrder == null) { DataObj.OutError("6052"); return; } IList <BanKaList> BanKaListList = Entity.BanKaList.Where(n => n.State == 1 && n.BKTId == BanKaType.Id).OrderBy(n => n.Sort).ToList(); foreach (var p in BanKaListList) { p.Pic = Utils.ImageUrl("BanKaList", p.Pic, SysImgPath); } DataObj.Data = BanKaListList.EntityToJson(); DataObj.Code = "0000"; DataObj.OutString(); }