示例#1
0
        public ActionResult Dispatch()
        {
            string code = Request.QueryString["code"];

            try
            {
                wx_backdata <wx_oauth2token> oauth2token = wcc.GetOauth2AccessToken(code);

                WXUSerBind wxuser = entity.WXUSerBind.Where(p => p.OpenID == oauth2token.ResponseData.openid).FirstOrDefault();

                if (wxuser == null)
                {
                    return(new RedirectResult("/Home/UserBind?OpenID=" + oauth2token.ResponseData.openid));
                }
                else
                {
                    SysUser user = entity.SysUser.Where(p => p.UserId == wxuser.UserID).FirstOrDefault();

                    if (user == null)
                    {
                        ViewBag.Content = "用户不存在!";
                        return(View("Error"));
                    }

                    return(new RedirectResult("/Home/Index?UserID=" + user.UserId + "&UserName="******"&IsCustomer=No"));

                    //WXSaleAfterMain main = entity.WXSaleAfterMain.Where(p => p.UserID == user.UserId && p.IsFinish != "是").FirstOrDefault();

                    //if (main != null && !string.IsNullOrEmpty(main.MoID) && main.IsXJR != "是")
                    //{
                    //    //MO mo = entity.MO.Where(p => p.MOId == main.MoID).FirstOrDefault();

                    //    Ter_Customer_Com_Records tccr = entity.Ter_Customer_Com_Records.Where(p => p.MOName == main.MoID).FirstOrDefault();

                    //    if(tccr != null && tccr.ProblemCompletion == "完成")
                    //    {
                    //        return new RedirectResult("/Home/QRCode?MainID=" + main.ID);
                    //    }
                    //    else
                    //    {
                    //        return new RedirectResult("/Home/WorkNote?MainID=" + main.ID);
                    //    }

                    //}
                    //else
                    //{
                    //    return new RedirectResult("/Home/Index?UserID=" + user.UserId + "&UserName="******"&IsCustomer=No");
                    //}
                }
            }
            catch (Exception e)
            {
                ViewBag.Content = e.ToString();
                return(View("Error"));
            }
        }
        /// <summary>
        /// 【通用】获取JSON指定类型返回值
        /// </summary>
        /// <typeparam name="T">指定非错误的返回类型</typeparam>
        /// <param name="JsonData">序列化前JSON字符</param>
        /// <returns>JSON序列化后数据</returns>
        public wx_backdata <T> GetJson <T>(string JsonData)
        {
            var result = new wx_backdata <T>();

            if (JsonData.IndexOf("errcode") != -1)
            {
                result.ResponseState = false;
                result.ErrorData     = JsonConvert.DeserializeObject <wx_apperror>(JsonData);
            }
            else
            {
                result.ResponseState = true;
                result.ResponseData  = JsonConvert.DeserializeObject <T>(JsonData);
            }
            return(result);
        }
示例#3
0
        public ActionResult WorkList()
        {
            string code = Request.QueryString["code"];


            wx_backdata <wx_oauth2token> oauth2token = wcc.GetOauth2AccessToken(code);

            WXUSerBind wxuser = entity.WXUSerBind.Where(p => p.OpenID == oauth2token.ResponseData.openid).FirstOrDefault();

            //WXUSerBind wxuser = entity.WXUSerBind.Where(p => p.ID == 3).FirstOrDefault();

            if (wxuser == null)
            {
                return(new RedirectResult("/Home/UserBind?OpenID=" + oauth2token.ResponseData.openid));
            }
            else
            {
                SysUser user = entity.SysUser.Where(p => p.UserId == wxuser.UserID).FirstOrDefault();

                if (user == null)
                {
                    ViewBag.Content = "用户不存在!";
                    return(View("Error"));
                }

                List <WXSaleAfterMain> mainList = new List <WXSaleAfterMain>();

                if (user.UserId == "SUR1000007HM")
                {
                    mainList = entity.WXSaleAfterMain.Where(p => p.IsFinish != "是").ToList();
                }
                else
                {
                    mainList = entity.WXSaleAfterMain.Where(p => p.UserID == user.UserId && p.IsFinish != "是").ToList();
                }

                ViewBag.MainList = mainList;
            }

            return(View());
        }