/// <summary>
        ///  查询实体
        /// </summary>
        /// <param name="id">ModelId </param>
        /// <returns>ModelSysUser</returns>
        public ModelSysUser SysUserDetail(out string resultMsg, string uname)
        {
            resultMsg = string.Empty;
            var model = new ModelSysUser();
            try
            {
                //存储过程名称
                string sql = "SELECT * FROM [PowerSystem].[dbo].[sys_user] WHERE uname  = @uname ";

                //参数添加
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "uname", ParameterValue = uname, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });

                //查询执行
                using (IDataReader dr = DBHelper.ExecuteReader(sql, false, parm))
                {
                    IList<ModelSysUser> list = GetModel(dr);
                    model = list.First();
                }
            }
            catch (Exception ex)
            {
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return model;
        }
        /// <summary>
        /// 页面初始化函数
        /// </summary>
        /// <param name="requestContext">上下文</param>
        protected override void Initialize(RequestContext requestContext)
        {
            if (requestContext.HttpContext.Session["UserInfo"] == null)
            {
                UrlHelper url = new UrlHelper(requestContext);
                var urlPath = url.Action("LoginOut", "Login");
                requestContext.HttpContext.Response.Redirect(urlPath);
            }

            CurrentUser = (ModelSysUser)requestContext.HttpContext.Session["UserInfo"];

            base.Initialize(requestContext);
        }
        /// <summary>
        /// Model 赋值 IDataReader
        /// </summary>
        private IList<ModelSysUser> GetModel(IDataReader dr)
        {
            var modelList = new List<ModelSysUser>();

            while (dr.Read())
            {
                var model = new ModelSysUser();
                model.Id = dr["id"] == DBNull.Value ? 0 : Convert.ToInt32(dr["id"]);
                model.Userid = dr["userid"] == DBNull.Value ? string.Empty : dr["userid"].ToString();
                model.Uname = dr["uname"] == DBNull.Value ? string.Empty : dr["uname"].ToString();
                model.OrderAsc = dr["order_asc"] == DBNull.Value ? 0 : Convert.ToInt32(dr["order_asc"]);
                model.Upassword = dr["upassword"] == DBNull.Value ? string.Empty : dr["upassword"].ToString();
                model.Fullname = dr["fullname"] == DBNull.Value ? string.Empty : dr["fullname"].ToString();
                model.Ismanage = dr["ismanage"] == DBNull.Value ? false : Convert.ToBoolean(dr["ismanage"]);
                model.Ustate = dr["ustate"] == DBNull.Value ? 0 : Convert.ToInt32(dr["ustate"]);
                model.Email = dr["email"] == DBNull.Value ? string.Empty : dr["email"].ToString();
                modelList.Add(model);
            }
            return modelList;
        }
        public ActionResult Index(FormCollection fc, ModelSysUser model)
        {
            IFacadeSysUser fakSysUser = new FacadeSysUser();
            var userId = string.Empty;
            var userFullName = string.Empty;
            var resultMsg = string.Empty;
            string identity = fakSysUser.VerifyUser(model.Uname, model.Upassword, Guid.NewGuid().ToString(), out userId, out userFullName, out resultMsg); // Guid.NewGuid().ToString()
            if (!string.IsNullOrWhiteSpace(identity) && string.IsNullOrWhiteSpace(resultMsg))
            {
                model.Userid = userId;
                model.Fullname = userFullName;
                Session["UserInfo"] = model;
                Response.Redirect(Url.Action("Index","Home"));
            }
            else
            {
                resultMsg = "登录失败,请重新登录,如多次登录失败请联系管理员处理!";
                this.ShowMessage(resultMsg, isSuccess: false, width: 350);
            }

            ModelState.Clear();
            return View(model);
        }