Esempio n. 1
0
        public ActionResult Category(string id)
        {
            ViewBag.isok  = "OK";
            ViewBag.Appid = WeChatConfig.GetKeyValue("appid");
            ViewBag.Uri   = WeChatConfig.GetKeyValue("shareurl");

            noncestr = CommonMethod.GetCode(16);

            string jsapi_ticket = Js_sdk_Signature.IsExistjsapi_ticket(token.IsExistAccess_Token());

            timestamp = DateTime.Now.Ticks.ToString().Substring(0, 10);;
            string url = Request.Url.ToString().Replace("#", "");

            JssdkSignature         = Js_sdk_Signature.GetjsSDK_Signature(noncestr, jsapi_ticket, timestamp, url);
            ViewBag.noncestr       = noncestr;
            ViewBag.jsapi_ticket   = jsapi_ticket;
            ViewBag.timestamp      = timestamp;
            ViewBag.JssdkSignature = JssdkSignature;
            ViewBag.PageFlag       = id;

            var sid = TypeParser.ToInt32(Request["sid"]);

            if (sid <= 0)
            {
                sid = 2;
            }
            ViewBag.SupplierID   = sid;
            ViewBag.SupplierName = supplierB.Get(s => s.SUPPLIER_ID == sid).SUPPLIER_NAME;
            ViewBag.ProductList  = VIEW_MST_PRD.ToListViewModel(prdB.GetListBy(p => p.CATE_ID == id && p.STATUS == true && p.ISCHECK == true, p => p.SEQ_NO));
            var model = VIEW_MST_CATEGORY.ToViewModel(categoryB.Get(c => c.CATE_CD == id));

            return(View(model));
        }
Esempio n. 2
0
 public ActionResult WelCome()
 {
     ViewBag.UserID       = OperateContext.Current.UsrId;
     ViewBag.UserName     = OperateContext.Current.UsrName;
     ViewBag.PrdList      = VIEW_MST_PRD.ToListViewModel(prd_MANAGER.GetListBy(s => true, s => s.SEQ_NO));
     ViewBag.CategoryList = VIEW_MST_CATEGORY.ToListViewModel(categroyB.GetListBy(s => s.SYNCOPERATION != "D"));
     return(View());
 }
Esempio n. 3
0
        public ActionResult Index()
        {
            ViewBag.PageFlag = "Index";
            if (string.IsNullOrEmpty(CommonMethod.getCookie("userid")) || string.IsNullOrEmpty(CommonMethod.getCookie("openid")))
            {
                //CommonMethod.delCookie("userid");
                //登陆
                string code = Request.QueryString["code"];//获取授权code
                if (!string.IsNullOrEmpty(code))
                {
                    string openIdUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + WeChatConfig.GetKeyValue("appid") + "&secret=" + WeChatConfig.GetKeyValue("appsecret") + "&code=" + code + "&grant_type=authorization_code";
                    string content   = Tools.GetPage(openIdUrl, "");
                    openid = Tools.GetJsonValue(content, "openid");//根据授权  获取当前人的openid
                    var model = weiUserM.GetModelWithOutTrace(u => u.openid == openid);
                    if (model != null)
                    {
                        CommonMethod.delCookie("openid");
                        CommonMethod.delCookie("userid");
                        CommonMethod.setCookie("openid", openid, 1);
                        CommonMethod.setCookie("userid", model.userNum, 1);
                    }
                }
                else
                {
                    string codeurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx242aa47391c159f6&redirect_uri=http://www.aoshacar.com/AoShaCar/Index&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
                    Response.Redirect(codeurl);
                }
                //end
            }
            ViewBag.PageFlag = "Index";
            var sid = TypeParser.ToInt32(Request["sid"]);

            if (sid <= 0)
            {
                sid = 2;
            }
            ViewBag.SupplierID   = sid;
            ViewBag.SupplierName = supplierB.Get(s => s.SUPPLIER_ID == sid).SUPPLIER_NAME;
            ViewBag.CategoryList = VIEW_MST_CATEGORY.ToListViewModel(categoryB.GetListBy(c => c.ACTIVE == true));
            ViewBag.ProductList  = VIEW_MST_PRD.ToListViewModel(prdB.GetListBy(p => p.ISCHECK == true && p.STATUS == true && p.ISHOT == true, p => p.SEQ_NO));

            return(View());
        }