Ejemplo n.º 1
0
        /// <summary>
        /// 加载公司的功能菜单信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string LoadCompanyFunMenu(HttpContext context)
        {
            StringBuilder sbContent    = new StringBuilder();
            string        strRoleId    = CommonMethod.FinalString(context.Request.QueryString["Roleid"]);
            string        strProjectId = CommonMethod.FinalString(context.Request.QueryString["ProjectId"]);
            string        strWhere     = string.Format(" AND PROJECTID={0} AND COMPANYID={1} ", strProjectId, CompanyId);

            DataTable dtCompanyFunMenu = CompanyFunBusiness.GetCompanyFunList(strWhere);

            DataRow[] drowCurFun = dtCompanyFunMenu.Select(" CFPARENTID=0 ", "CFSORTNUM DESC");

            string strChecked = string.Empty;

            for (int i = 0; i < drowCurFun.Length; i++)
            {
                if (strRoleId.Length > 0)//修改时判断是否选中
                {
                    strChecked = CompanyFunBusiness.IsRoleExistFun(strRoleId, drowCurFun[i]["CFID"].ToString()) ? "checked='checked'" : "";
                }
                sbContent.Append("<table class=\"table\" style=\"float:left; width:33%; margin-left:3px;\">");
                sbContent.AppendFormat("<tr><td class='rhead' style=\"text-align:left;background-image: url('../../Resource/images/searchthead.gif');\" ><input type='checkbox' onclick='CheckAll({1});' name='{0}' id='{1}' value='{1}' {3} />{2}</td></tr>",
                                       "fun", drowCurFun[i]["CFID"], drowCurFun[i]["CFANOTHERNAME"], strChecked);

                //下面的子菜单
                GetCompanyChildFun(dtCompanyFunMenu, System.Convert.ToInt32(drowCurFun[i]["FMID"]), sbContent, strRoleId, drowCurFun[i]["CFID"].ToString());

                sbContent.Append("</table>");
                if ((i + 1) % 3 == 0)
                {
                    sbContent.Append("</br>");
                }
            }
            return(sbContent.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 公司子功能获取
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="parentId"></param>
        /// <returns></returns>

        private void GetCompanyChildFun(DataTable dt, int parentId, StringBuilder sbContent, string strRoleId, string strRootId)
        {
            string strPre     = "&nbsp;&nbsp;";
            string strChecked = string.Empty;

            DataRow[] rows = dt.Select(" CFPARENTID=" + parentId, " CFSORTNUM DESC  ");

            if (rows != null && rows.Length > 0)
            {
                for (int i = 0; i < rows.Length; i++)
                {
                    if (strRoleId.Length > 0)//修改时判断是否选中
                    {
                        strChecked = CompanyFunBusiness.IsRoleExistFun(strRoleId, rows[i]["CFID"].ToString()) ? "checked='checked'" : "";
                    }

                    sbContent.AppendFormat("<tr><td >" + strPre + "<input type='checkbox' class='{4}' name='{0}' id='{1}' value='{1}' {3} />{2}</td></tr>",
                                           "fun", rows[i]["CFID"], rows[i]["CFANOTHERNAME"], strChecked, strRootId);

                    GetCompanyChildFun(dt, System.Convert.ToInt32(rows[i]["FMID"]), sbContent, strRoleId, strRootId);
                }
            }
        }