public override void OnActionExecuting(ActionExecutingContext filterContext) { var fromUserNameCookie = filterContext.RequestContext.HttpContext.Request.Cookies["FromUserName"]; if (fromUserNameCookie == null || string.IsNullOrEmpty(fromUserNameCookie.Value)) { filterContext.Result = new RedirectResult(WeChatConstat.AttentionUsUrl); } else { var userManager = new UserManager(); var uid = userManager.GetUid(Constants.CompanyId, fromUserNameCookie.Value); if (string.IsNullOrEmpty(uid)) { filterContext.Result = new RedirectResult(WeChatConstat.AttentionUsUrl); } } }
/// <summary> /// /// </summary> /// <param name="id">CompanyId</param> /// <param name="name">SourceAccountId</param> /// <returns></returns> public ActionResult My(string id, string name) { ActionResult result = null; try { var userManager = new UserManager(); var orderManager = new OrderManager(); string uid = ""; Guid companyGuid = Guid.Empty; if (Guid.TryParse(id, out companyGuid)) { uid = userManager.GetUid(companyGuid, name); if (!string.IsNullOrEmpty(uid)) { var list = orderManager.GetUserOrders(uid); result = View(list); } else { result = Redirect("/"); } } else { result = Redirect("/"); } ViewBag.CompanyId = id; ViewBag.SourceAccountId = name; ViewBag.Uid = uid; } catch (Exception ex) { Logger.Log(ex); result = Redirect("/"); } return result; }
public ActionResult Join() { ActionResult result = null; var model = new JoinActivityModel(); var userManager = new UserManager(); var orderManager = new OrderManager(); var crmMemberModel = new CrmMemberModel(); var uid = userManager.GetUid(Constants.CompanyId, Request.Cookies["FromUserName"].Value); ViewBag.Uid = uid; PrepayRecord prepayRecord = crmMemberModel.HasJoinedOnlineVipGroup(uid); if (prepayRecord != null) { ViewBag.VerifyCode = prepayRecord.SId; result = View("Pass"); } else { result = View(model); } return result; }