Esempio n. 1
0
 public ActionResult EditInfo(Model.UserAdmin UserAdmin)
 {
     ViewData["deptSelectItems"] = GetdeptSelectItems();
     Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
     Business.Sys_Role      Sys_Role      = new Business.Sys_Role();
     UserAdmin.PassWord = Utility.ChangeText.md5(UserAdmin.PassWord);
     UserAdmin.RoleName = Sys_Role.GetRoleInfoByRoleCode(UserAdmin.RoleCode).RoleName;
     if (Sys_UserAdmin.UpdateUserAdmin(UserAdmin))
     {
         return(Content("1"));
     }
     return(Content("0"));
 }
Esempio n. 2
0
        public ActionResult SetRoleInfo(string deptSelectItems)
        {
            ViewData["SetRoleInfoId"]   = Request["SetRoleInfoId"];
            ViewData["deptSelectItems"] = GetdeptSelectItems();
            string RoleCode = Request["deptSelectItems"];

            Business.Sys_Role Sys_Role      = new Business.Sys_Role();
            Model.RoleInfo    RoleInfo      = Sys_Role.GetRoleInfoByRoleCode(RoleCode);
            string            SetRoleInfoId = Request["SetRoleInfoId"];

            Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
            if (Sys_UserAdmin.SetUserAdminRole(SetRoleInfoId, RoleInfo.RoleCode, RoleInfo.RoleName))
            {
            }
            Response.Write("<script>parent.layer.closeAll();</script>");
            return(View());
        }
Esempio n. 3
0
 public ActionResult GetCode()
 {
     try
     {
         string code = Request["code"];
         Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
         string          OpenId    = WxHelper.WxMain.Getopenid(code);
         Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByOpendId(OpenId);
         Session["OpenId"] = OpenId;
         if (UserAdmin != null && UserAdmin.RoleCode != "Tourist")
         {
             Session["UsersId"]  = UserAdmin.ID;
             Session["UserName"] = UserAdmin.UserName;
             Session["RealName"] = UserAdmin.RealName;
             Session["RoleCode"] = UserAdmin.RoleCode;
             if (Request["way"] == "Arrangement")
             {
                 string gzhurl = "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=" + System.Configuration.ConfigurationManager.AppSettings["WxAppId"] + "&scene=110#wechat_redirect";
                 Utility.PostData.GetData(gzhurl);
                 return(RedirectToAction("GetArrangementInfo", "MMain", new { ArrangementId = Request["id"] }));
             }
             else
             {
                 return(RedirectToAction("Index", "MMIndex"));
             }
         }
         else if (Request["way"] == "Arrangement")
         {
             string gzhurl = "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=" + System.Configuration.ConfigurationManager.AppSettings["WxAppId"] + "&scene=110#wechat_redirect";
             Utility.PostData.GetData(gzhurl);//自动关注公众号
             if (UserAdmin == null)
             {
                 System.Random     Random   = new System.Random();
                 int               Result   = Random.Next(0, 9999);
                 Business.Sys_Role Sys_Role = new Business.Sys_Role();
                 Model.RoleInfo    RoleInfo = Sys_Role.GetRoleInfoByRoleCode("Tourist");
                 //写入一条记录 标识为游客
                 Model.UserAdmin UserAdminTourist = new Model.UserAdmin();
                 UserAdminTourist.UserName = "******" + Result.ToString() + DateTime.Now.ToString("yyyy-MM-dd");
                 UserAdminTourist.PassWord = Utility.ChangeText.md5("123456");
                 UserAdminTourist.IsEnable = 0;
                 UserAdminTourist.OpenId   = OpenId;
                 UserAdminTourist.RoleCode = RoleInfo.RoleCode;
                 UserAdminTourist.RoleName = RoleInfo.RoleName;
                 UserAdminTourist.RealName = "游客未知";
                 Session["UsersId"]        = Sys_UserAdmin.InsertUserAdminGetId(UserAdminTourist);
                 Session["UserName"]       = UserAdminTourist.UserName;
                 Session["RealName"]       = UserAdminTourist.RealName;
                 Session["RoleCode"]       = UserAdminTourist.RoleCode;
                 return(RedirectToAction("GetArrangementInfo", "MMain", new { ArrangementId = Request["id"] }));
             }
             if (UserAdmin.RoleCode == "Tourist")
             {
                 Session["UsersId"]  = UserAdmin.ID;
                 Session["UserName"] = UserAdmin.UserName;
                 Session["RealName"] = UserAdmin.RealName;
                 Session["RoleCode"] = UserAdmin.RoleCode;
                 return(RedirectToAction("GetArrangementInfo", "MMain", new { ArrangementId = Request["id"] }));
             }
         }
         return(RedirectToAction("Index", "MLogin"));
     }
     catch (Exception ex)
     {
         Utility.Log.WriteTextLog("微信自动登陆异常", "", "", "", ex.ToString());
         return(null);
     }
 }