private List <FunctionEntity> GetQueryData()
        {
            BCtrl_Function bll = new BCtrl_Function();

            FunctionSearchEntity entity = new FunctionSearchEntity();

            entity.Function_Name   = _StrFunctionName;
            entity.UseDBPagination = false;

            return(bll.QueryFunctionListByGroup(entity));
        }
        private void GetFunByUserID()
        {
            List <FunctionEntity> list = new BCtrl_Function().GetFunction(userId);

            foreach (FunctionEntity var in list)
            {
                userfun.Value += var.Function_ID;
                userfun.Value += ",";
            }
            if (userfun.Value != "")
            {
                userfun.Value = userfun.Value.Substring(0, userfun.Value.Length - 1);
            }
        }
        private DataTable GetQueryData(bool isDownload)
        {
            BCtrl_Function bll      = new BCtrl_Function();
            int            totalcnt = 0;

            FunctionSearchEntity entity = new FunctionSearchEntity();

            entity.Function_Name   = _StrFunctionName;
            entity.PageSize        = base.PageSize;
            entity.PageIndex       = base.PageIndex;
            entity.UseDBPagination = !isDownload;

            DataTable table = bll.QueryFunctionTable(entity, out totalcnt);

            base.TotalRecords = totalcnt;

            return(table);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 为超级管理员分配所有权限
        /// </summary>
        /// <returns></returns>
        private bool GetFunToAdmin(string userid)
        {
            bool b = true;

            List <FunctionEntity> list = new List <FunctionEntity>();
            //先查询所有权限
            DataTable dt = new BCtrl_Function().GetAllFunction();

            foreach (DataRow var in dt.Rows)
            {
                FunctionEntity fe = new FunctionEntity();
                fe.Function_ID = Convert.ToInt32(var["Function_ID"].ToString());
                list.Add(fe);
            }

            //再分配所有分类权限给用户
            b = new BCtrl_Function().EditUserFunRel(userid, list);

            return(b);
        }
Exemplo n.º 5
0
        public string DeleteFunction(HttpContext context)
        {
            string status     = "{\"status\":-1}";
            int    functionID = 0;

            if (int.TryParse(context.Request.Form["pid"], out functionID) && functionID > 0)
            {
                BCtrl_Function bll = new BCtrl_Function();

                if (bll.Delete(functionID))
                {
                    ClearCacheOrSession.ClearFunctionsCacheByCRUD();
                    status = "{\"status\":1}";
                }
                else
                {
                    status = "{\"status\":0}";
                }
            }

            return(status);
        }
Exemplo n.º 6
0
        public string IsUseableFunctionName(HttpContext context)
        {
            int    functionID  = 0;
            string funcionName = context.Request.Form["fname"];

            if (!string.IsNullOrEmpty(funcionName) && int.TryParse(context.Request.Form["pid"], out functionID))
            {
                BCtrl_Function bll       = new BCtrl_Function();
                bool           isUseable = bll.IsUseableFunctionName(functionID, funcionName);

                if (isUseable)
                {
                    return("true");
                }
                else
                {
                    return("false");
                }
            }
            else
            {
                return("false");
            }
        }
        private void InitFunctionList()
        {
            BCtrl_Function fbll = new BCtrl_Function();

            function_treeview.InnerHtml = fbll.GetFunctionTree();
        }
Exemplo n.º 8
0
        public string AdminLogins(HttpContext context)
        {
            string loginname = context.Request.Form["un"];
            string password  = context.Request.Form["pw"];
            string valid     = context.Request.Form["va"];
            string returnUrl = context.Request.Form["url"];

            if (string.IsNullOrEmpty(loginname) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(valid))
            {
                return("{\"state\":-9}");  //传递参数不完整
            }
            else
            {
                if (valid.Equals(DateTime.Now.Day.ToString()))
                {
                    BCtrl_SysUser sysUserBll = new BCtrl_SysUser();

                    #region 管理员登录验证
                    string userid = "";
                    password = MD5.Encode(WebKeys.AdminPwdRandom, password);
                    //尝试登录
                    //if (new PassportServiceProxy().TryLogin(loginname, password, "NewBookSystem", out  userid))
                    if (sysUserBll.TryLogin(loginname, password, out userid))
                    {
                        if (!string.IsNullOrEmpty(userid))
                        {
                            //查询用户所属角色能访问的频道
                            List <FunctionEntity> list = new BCtrl_Function().GetFunction(userid);
                            if (list.Count != 0)
                            {
                                AdminSessionEntity ue = new BCtrl_SysUser().QuerySysUserInfo(userid);
                                if (ue != null)
                                {
                                    ue.Sys_LoginName = loginname;
                                    ue.Sys_UserID    = userid;

                                    ue.Functions = list;
                                    context.Session[WebKeys.AdminSessionKey] = ue;

                                    return("{\"state\":1}");  //登录成功
                                }
                                else
                                {
                                    return("{\"state\":-7}");  //登录成功但在系统中为找到授权
                                }
                            }
                            else
                            {
                                return("{\"state\":-6}");  //登录成功但无使用功能权限
                            }
                        }
                        else
                        {
                            return("{\"state\":-1}");  //登录失败 用户名密码错误
                        }
                    }
                    else
                    {
                        return("{\"state\":-1}");  //登录失败 用户名密码错误
                    }
                    #endregion

                    #region 搭建时测试
                    //if (loginname == "zl" && password == "123456")
                    //{
                    //    AdminSessionEntity ue = new AdminSessionEntity();

                    //    ue.Sys_LoginName = loginname;
                    //    ue.Sys_UserID = "1";

                    //    context.Session[WebKeys.AdminSessionKey] = ue;
                    //    string result = "{\"state\":1, \"url\":\"" + returnUrl + "\"}";
                    //    return result;  //登录成功
                    //}
                    //else
                    //{
                    //    return "{\"state\":-1}";  //登录失败 用户名密码错误
                    //}
                    #endregion
                }
                else
                {
                    //验证码不正确
                    return("{\"state\":-8}");  //验证码不正确
                }
            }
        }