Exemplo n.º 1
0
        public static string[] GetPageAuthorityFromDB(string ModuleID, UserInfoUtil UserInfo)
        {
            //获得用户权限
            DataTable data = CommonUtilDBHelper.GetPageAuthority(UserInfo.UserID, UserInfo.CompanyCD, ModuleID);

            if (data.Rows.Count > 0)
            {
                //获得该页面的可操作业务
                DataRow[] rows   = data.Select("ModuleID = '" + ModuleID + "'");
                int       iCount = rows.Length;
                if (iCount > 0)
                {
                    //实例化

                    string[] authority = new String[iCount];
                    //将权限添加到返回集中
                    for (int i = 0; i < rows.Length; i++)
                    {
                        string FunctionCD = (string)rows[i]["FunctionCD"];
                        authority[i] = FunctionCD;
                    }
                    return(authority);
                }
            }
            //返回可操作的业务集
            return(null);
        }
Exemplo n.º 2
0
        public static DataTable InitMenuData(string userID, string companyCD, string filterID)
        {
            //获取系统默认设置的菜单项
            DataTable dtMenu = CommonUtilDBHelper.GetMenuData(userID, companyCD, filterID);

            //添加企业文化菜单

            // InitCompCulture(dtMenu, companyCD);

            return(dtMenu);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 企业文化菜单设置
        /// </summary>
        /// <param name="dtMenu">菜单信息</param>
        /// <param name="companyCD">公司代码</param>
        private static void InitCompCulture(DataTable dtMenu, string companyCD)
        {
            //获取客户自己设置的企业文化菜单项
            DataTable dtCulture = CommonUtilDBHelper.GetCultureInfo(companyCD);

            //添加一列用于判断是否包含子分类
            dtCulture.Columns.Add(new DataColumn("HasSubMenu"));
            DataTable dtOrderCulture = new DataTable();

            dtOrderCulture = dtCulture.Clone();
            //客户自定义企业文化菜单存在的时候
            if (dtCulture != null && dtCulture.Rows.Count > 0)
            {
                //获取第一级分类信息
                DataRow[] drSuperType = dtCulture.Select("SupperTypeID =0");
                //遍历第一级部门
                for (int i = 0; i < drSuperType.Length; i++)
                {
                    DataRow drFirstType = (DataRow)drSuperType[i];
                    //获取部门ID
                    string typeID = drFirstType["ID"].ToString().Trim();
                    //重新设置子分类ID,以便实现和菜单生成的接口一致
                    drFirstType["ID"] = ConstUtil.MENU_PERSONAL_COMPANY_CULTURE + typeID;
                    //重新设置父分类ID,以便实现和菜单生成的接口一致
                    drFirstType["SupperTypeID"] = ConstUtil.MENU_PERSONAL_COMPANY_CULTURE;
                    //设定子分类
                    bool hasSubMenu = ReorderRow(dtOrderCulture, typeID, dtCulture, drFirstType["ID"].ToString().Trim());
                    //有子分类时
                    if (hasSubMenu)
                    {
                        drFirstType["HasSubMenu"] = "1";
                    }
                    else
                    {
                        drFirstType["HasSubMenu"] = "0";
                    }
                    //导入第一级分类
                    dtOrderCulture.ImportRow(drFirstType);
                }
            }
            else
            {
                return;
            }

            #region 将企业文化分类插入菜单项

            //客户自定义企业文化菜单存在的时候
            if (dtOrderCulture != null && dtOrderCulture.Rows.Count > 0)
            {
                //
                dtMenu.DefaultView.Sort = "ModuleID";
                //
                int compCulture = dtMenu.DefaultView.Find(ConstUtil.MENU_PERSONAL_COMPANY_CULTURE);

                //遍历所有的自定义企业文化
                for (int i = 0; i < dtOrderCulture.Rows.Count; i++)
                {
                    //新建一个菜单项
                    DataRow drCulture = dtMenu.NewRow();
                    //模块ID
                    drCulture["ModuleID"] = dtCulture.Rows[i]["ID"].ToString();
                    //分类名称设置为菜单名
                    drCulture["ModuleName"] = dtCulture.Rows[i]["TypeName"].ToString();
                    //模块类型 A-表示应用系统 S-表示子系统(六大模块) M-表示菜单 P-页面
                    //如果还有子分类时,则不表示菜单
                    if ("1".Equals(dtCulture.Rows[i]["HasSubMenu"].ToString()))
                    {
                        drCulture["ModuleType"] = "S";
                    }
                    else
                    {
                        drCulture["ModuleType"] = "M";
                    }
                    //上级模块ID
                    drCulture["ParentID"] = dtCulture.Rows[i]["SupperTypeID"].ToString();
                    //属性类型,主要用于对象更灵活的控制,目前值有:link和空值
                    drCulture["PropertyType"] = "link";
                    //属性值,当属性类型为“link”时,则属性值表示link 内容
                    drCulture["PropertyValue"] = "Pages/Office/AdminManager/Equipment_Add.aspx";
                    //添加企业文化到菜单数据集中
                    dtMenu.Rows.InsertAt(drCulture, compCulture + i + 1);
                }
            }

            #endregion
        }
Exemplo n.º 4
0
 public static ArrayList InitMenuDataSimple(string userID, string companyCD)
 {
     return(CommonUtilDBHelper.InitMenuDataSimple(userID, companyCD));
 }
Exemplo n.º 5
0
 public static DataTable GetCompanyModule(string CompanyCD)
 {
     return(CommonUtilDBHelper.GetCompanyModule(CompanyCD));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 获得页面上的操作按钮
 /// </summary>
 /// <param name="UserID">用户ID</param>
 /// <param name="CompanyCD">公司代码</param>
 /// <returns>返回用户可操作的页面业务集。</returns>
 public static DataTable InitPageAuthority(string UserID, string CompanyCD)
 {
     return(CommonUtilDBHelper.GetPageAuthority(UserID, CompanyCD));
 }