Exemplo n.º 1
0
        private string createList(string UserType)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder("");

            sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">");
            sb.Append("<thead>");
            sb.Append("<tr class=\"text-c\">");
            sb.Append("<th width='10%'>序号</th>");
            sb.Append("<th width='75%'>菜单名称</th>");
            sb.Append("<th width='15%'>是否权限</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            sb.Append("<tbody id='ItemBody'>");
            Business.Sys.BusinessUserRight bc = new project.Business.Sys.BusinessUserRight();
            foreach (Entity.Sys.EntityUserInfoRights it in bc.GetUserRightInfo(UserType, "Sys", user.Entity.AccID))
            {
                row++;
                sb.Append("<tr class=\"text-c\" id=\"" + it.InnerEntityOID + "\">");
                sb.Append("<td align='center'>" + row.ToString() + "</td>");
                sb.Append("<td style='text-align:left'>" + (it.Flag == 1 ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") + it.MenuName + "</td>");
                sb.Append("<td align='center'><input type='checkbox' name='chkmenu' id='chk" + it.InnerEntityOID + "'" + (it.Right ? "checked='checked'" : "") + " /></td>");
                sb.Append("</tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            return(sb.ToString());
        }
Exemplo n.º 2
0
        private string createList(string UserType)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder("");

            sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">");
            sb.Append("<thead>");
            sb.Append("<tr class=\"text-c\">");
            sb.Append("<th width='5%'>序号</th>");
            sb.Append("<th width='10%'>是否权限</th>");
            sb.Append("<th width='25%'>菜单名称</th>");
            sb.Append("<th width='60%'>权限</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            sb.Append("<tbody id='ItemBody'>");
            Business.Sys.BusinessUserRight bc = new project.Business.Sys.BusinessUserRight();
            foreach (Entity.Sys.EntityUserInfoRights it in bc.GetUserRightInfo(UserType, "Sys"))
            {
                row++;
                sb.Append("<tr class=\"text-c\">");
                sb.Append("<td align='center'>" + row.ToString() + "</td>");
                sb.Append("<td align='center'><input type='checkbox' name='chkmenu' id='" + it.InnerEntityOID + "'" + (it.Right ? "checked='checked'" : "") + " /></td>");
                sb.Append("<td style='text-align:left'>" + (it.Flag == 1 ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") + it.MenuName + "</td>");

                sb.Append("<td style='text-align:left'>");
                int col = -1;
                foreach (string right in it.RightCode.Split(';'))
                {
                    col++;
                    if (right == "")
                    {
                        continue;
                    }

                    if (it.HaveRightCode.IndexOf(right) >= 0)
                    {
                        sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' checked='checked' id='" + it.InnerEntityOID + right + "' name='" + it.InnerEntityOID + "' value='" + right + "' />&nbsp;<label for='" + it.InnerEntityOID + right + "'>" + it.RightName.Split(';')[col].ToString() + "</label>");
                    }
                    else
                    {
                        sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' id='" + it.InnerEntityOID + right + "' name='" + it.InnerEntityOID + "' value='" + right + "' />&nbsp;<label for='" + it.InnerEntityOID + right + "'>" + it.RightName.Split(';')[col].ToString() + "</label>");
                    }
                }
                sb.Append("<input type='hidden' id='parent" + it.InnerEntityOID + "' value='" + it.Parent + "'>");
                sb.Append("</td>");
                sb.Append("</tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            return(sb.ToString());
        }
Exemplo n.º 3
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string isok    = "1";
            string errrow  = "";
            string errinfo = "";

            try
            {
                errrow = "保存出现错误!";
                obj.ExecuteNonQuery("delete from Sys_UserRight where UserType='" + jp.getValue("UserType") + "'");

                int    col      = -1;
                string jsonText = jp.getValue("ID");
                string items    = jp.getValue("items");
                foreach (string str in jsonText.Split('@'))
                {
                    col++;
                    if (str == "")
                    {
                        continue;
                    }

                    Business.Sys.BusinessUserRight bc = new project.Business.Sys.BusinessUserRight();
                    bc.Entity.MenuID    = str;
                    bc.Entity.UserType  = jp.getValue("UserType");
                    bc.Entity.RightCode = items.Split('@')[col].ToString();
                    int row = bc.Save();
                    if (row < 1)
                    {
                        isok     = "2";
                        errinfo += errrow + ";";
                    }
                    else
                    {
                        errrow = "";
                    }
                }
            }
            catch { isok = "2"; errinfo = errrow; }

            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", isok));
            collection.Add(new JsonStringValue("errinfo", errinfo));

            return(collection.ToString());
        }