Beispiel #1
0
        public ActionResult Loginaction()
        {
            string login_username = Request.Form["login_username"].ToString().Trim();
            string login_password = DEncrypt.Encrypt(Request.Form["login_password"].ToString().Trim());

            Psd.H5Show.BLL.user_account userAccountBll = new Psd.H5Show.BLL.user_account();

            List <Psd.H5Show.Model.user_account> userAccountModelList =
                userAccountBll.GetModelList(
                    string.Format("STATE='1' and DELFLAG='0' and UserCode='{0}' and `Password` ='{1}'", login_username,
                                  login_password));

            if (userAccountModelList.Count > 0)
            {
                msgModel.Result = 1;
                msgModel.Msg    = "登录成功";
                HttpCookie cookie = new HttpCookie("PsdH5ShowUserCode");
                cookie.Value   = DEncrypt.Encrypt(userAccountModelList[0].UserCode);
                cookie.Expires = DateTime.Now.AddDays(1);
                HttpContext.Response.Cookies.Add(cookie);
            }
            else
            {
                msgModel.Result = 0;
                msgModel.Msg    = "账号或密码错误";
            }
            JsonResult Js = new JsonResult();

            Js.Data = msgModel;
            Js.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(Js);
        }
Beispiel #2
0
        /// <summary>
        /// 根据被加密过的UserCode返回用户信息实体
        /// </summary>
        /// <param name="EnUSERCODE">被加密过的UserCode</param>
        /// <returns></returns>
        public static Psd.H5Show.Model.user_account GetUserCodeToUseraccountModel(string EnUSERCODE)
        {
            string UserCode = DEncrypt.Decrypt(EnUSERCODE);
            object obj      = new Psd.H5Show.BLL.user_account().GetModelList(string.Format("USERCODE='{0}'", UserCode))[0];

            if (obj != null)
            {
                return(obj as Psd.H5Show.Model.user_account);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 判断是否有权限编辑此app
        /// </summary>
        /// <param name="userCode">The user code.</param>
        /// <param name="appId">The application id.</param>
        /// <returns>
        ///   <c>true</c> if [is member application] [the specified user code]; otherwise, <c>false</c>.
        /// </returns>
        public bool isMemberApp(string userCode, int appId)
        {
            bool    isauth  = false;
            DataSet dataSet =
                new Psd.H5Show.BLL.user_account().GetList("DELFLAG=0 and DELFLAG = 0 and USERCODE = '" + userCode + "'");

            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (new Psd.H5Show.BLL.appbase().GetList("appbase.DELFLAG=0  and  appbase.ID=" + appId + " and UID=" +
                                                         dataSet.Tables[0].Rows[0]["ID"]).Tables[0].Rows.Count > 0)
                {
                    isauth = true;
                }
            }

            return(isauth);
        }