// GET: Card public ActionResult Index() { if (null == base.CurrentUserInfo) { Redirect("/Home/Index"); return(null); } CardSecretEntityExt modelExt = new CardSecretEntityExt(); if (null != Session["key"]) { modelExt = Session["key"] as CardSecretEntityExt; ViewBag.Data = modelExt; Session.Remove("key"); } else if (null != Session["special"]) { modelExt = Session["special"] as CardSecretEntityExt; ViewBag.Data = modelExt; Session.Remove("special"); } else { var userCode = base.CurrentUserInfo.CurrentUser; IList <CardSecretEntity> cardSecretEntity = CardSecretBll.GetInstance().GetGetCardSecretListByUser(userCode); IList <ActTypeEntity> actTypeEntity = ActTypeBll.GetInstance().GetActTypeList(); modelExt.ActTypeEntity = actTypeEntity; modelExt.CardSecretEntity = cardSecretEntity; ViewBag.Data = modelExt; } return(View(modelExt)); }
public ActionResult Desktop() { var act = ActTypeBll.GetInstance().GetActTypeList(); CardQueryExt ext = new CardQueryExt(); ext.ActType = act; ext.VPack = new List <XHB.Card.Entity.VPack>(); return(View(ext)); }
/// <summary> /// 授权查询 /// </summary> /// <returns></returns> public CardQueryExt GetPackList() { var act = ActTypeBll.GetInstance().GetActTypeList(); CardQueryExt ext = new CardQueryExt(); ext.ActType = act; ext.VPack = new List <XHB.Card.Entity.VPack>(); return(ext); }
public ActionResult Delete(FormCollection form) { if (form.Count <= 0) { return(View()); } long id = long.Parse(form["id"]); long ret = ActTypeBll.GetInstance().DeleteLogical(id); return(Redirect("/CardType/Index")); }
/// <summary> /// 获取当前用户可用/不可用的卡密 /// </summary> /// <param name="userCode"></param> /// <param name="used"></param> /// <returns></returns> public CardSecretEntityExt GetUsedCardList(string userCode, bool used = true) { CardSecretEntityExt queryExt = new CardSecretEntityExt(); IList <CardSecretEntity> card = CardSecretBll.GetInstance().GetUsedCard(userCode, used); var act = ActTypeBll.GetInstance().GetActTypeList(); queryExt.ActTypeEntity = act; queryExt.CardSecretEntity = card; return(queryExt); }
public ActionResult CreateAct(FormCollection form) { ActTypeEntity entity = new ActTypeEntity { TypeCode = form["TypeCode"], TypeName = form["TypeName"], Description = form["Description"], IsActive = form["IsActive"].Equals("1")? true :false, CreateTime = DateTime.Now, UpdateTime = DateTime.Now }; var ret = ActTypeBll.GetInstance().Insert(entity); return(Redirect("/CardType/Index")); }
public ActionResult Query(FormCollection form) { if (form.Count == 0) { return(Redirect("/Card/Desktop")); } //string[] flag = { "cx", "kt", "cs", "xf" }; //int flag = int.Parse(form["radio"]); //switch (flag) //{ // case 0: // break; // case 1: // break; // case 2: // break; // case 3: // break; // default: // break; //} APIClient client = new APIClient(); CardQueryExt queryExt = new CardQueryExt(); string ret = client.Query(form["machine"].Trim()); JObject o = JObject.Parse(ret); string json = ((JValue)o.SelectToken("Result")).Value.ToString(); DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <VPack>)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(json)); object ob = serializer.ReadObject(stream); List <VPack> pack = (List <VPack>)ob; var act = ActTypeBll.GetInstance().GetActTypeList(); queryExt.VPack = pack; queryExt.ActType = act; return(View("~/Views/Home/Desktop.cshtml", queryExt)); }
public ActionResult Used(bool use) { if (null == base.CurrentUserInfo) { Redirect("/Home/Index"); return(null); } var userCode = base.CurrentUserInfo.CurrentUser; IList <CardSecretEntity> cardSecretEntity = CardSecretBll.GetInstance().GetUsedCard(userCode, use); IList <ActTypeEntity> actTypeEntity = ActTypeBll.GetInstance().GetActTypeList(); CardSecretEntityExt modelExt = new CardSecretEntityExt(); modelExt.ActTypeEntity = actTypeEntity; modelExt.CardSecretEntity = cardSecretEntity; //return View(modelExt); Session.Add("key", modelExt); return(Redirect("/Card/Index")); }
public ActionResult GetUsedCard(bool used) { long uid = Session["_UserId"] == null ? 0 : long.Parse(Session["_UserId"].ToString()); if (uid <= 0) { return(Redirect("/Card/Index")); } var user = UsersBll.GetInstance().GetAdminSingle(uid); CardSaleSystem.ServiceReference.CardClient client = new CardClient(); client.DoWork(); IList <CardSecretEntity> card = CardSecretBll.GetInstance().GetUsedCard(user.UserCode, used); var act = ActTypeBll.GetInstance().GetActTypeList(); CardSecretEntityExt queryExt = new CardSecretEntityExt(); queryExt.CardSecretEntity = card; queryExt.ActTypeEntity = act; ViewBag.Data = queryExt; ModelState.Clear(); return(PartialView("/Views/Card/Partial/_PartialCardView.cshtml")); }
public ActionResult GetSpecialCard(FormCollection form) { if (form.Count == 0 || form["querycard"].ToString().Length == 0) { return(Redirect("/Card/Index")); } long uid = Session["_UserId"] == null ? 0 : long.Parse(Session["_UserId"].ToString()); if (uid <= 0) { return(Redirect("/Card/Index")); } var user = UsersBll.GetInstance().GetAdminSingle(uid); string cardNo = form["querycard"]; IList <CardSecretEntity> card = CardSecretBll.GetInstance().GetSpecialCard(user.UserCode, cardNo); var act = ActTypeBll.GetInstance().GetActTypeList(); CardSecretEntityExt queryExt = new CardSecretEntityExt(); queryExt.CardSecretEntity = card; queryExt.ActTypeEntity = act; Session.Add("special", queryExt); return(Redirect("/Card/Index")); }