Esempio n. 1
0
        public ActionResult Detail(int?id)
        {
            try
            {
                var _entity = new Domain.SYS_MODULE()
                {
                    ISSHOW     = true,
                    MODULEPATH = "javascript:void(0)",
                    MODULETYPE = 1
                };

                //父模块
                string parentId = Request.QueryString["parentId"];
                if (!string.IsNullOrEmpty(parentId))
                {
                    _entity.PARENTID = int.Parse(parentId);
                }
                else
                {
                    _entity.PARENTID = 0;
                }
                //所属系统
                string sys = Request.QueryString["sys"];
                if (!string.IsNullOrEmpty(sys))
                {
                    _entity.FK_BELONGSYSTEM = sys;
                }
                //详情
                if (id != null && id > 0)
                {
                    _entity = ModuleManage.Get(p => p.ID == id);
                }
                //页面类型
                ViewData["ModuleType"] = Enum.GetNames(typeof(enumModuleType));
                //加载用户可操作的系统
                ViewData["Systemlist"] = SystemManage.LoadSystemInfo(CurrentUser.System_Id);

                ViewData["Modules"] = BindList(_entity.FK_BELONGSYSTEM);

                return(View(_entity));
            }
            catch (Exception e)
            {
                WriteLog(enumOperator.Select, "模块管理加载详情", e);
                throw;
            }
        }
        protected StringBuilder BindTreeView()
        {
            string        a   = PlatformID;
            StringBuilder str = new StringBuilder();

            str.Append(ParentID + "_Child|||");
            List <ModuleEO> modellist = new List <ModuleEO>();
            //得到模块权限和角色的列表
            List <RolemoduleEO> rmplist = new List <RolemoduleEO>();

            rmplist = (List <RolemoduleEO>)System.Web.HttpContext.Current.Session["RmpList"];

            //modellist = (List<ModuleEO>)mdManage.Get("Md_parentid='" + ParentID + "' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
            IList <MySqlParameter> parm     = new List <MySqlParameter>();
            StringBuilder          strWhere = new StringBuilder();

            strWhere.Append("  Md_parentid=@Md_parentid  AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
            parm.Add(new MySqlParameter("@Md_parentid", ParentID));
            modellist = (List <ModuleEO>)mdManage.Get(strWhere.ToString(), parm);

            foreach (ModuleEO model in modellist)
            {
                //是否有下级内容
                bool IsChild = true;
                IList <MySqlParameter> parmC     = new List <MySqlParameter>();
                StringBuilder          strWhereC = new StringBuilder();
                strWhereC.Append("  Md_parentid=@Md_parentid and Md_existsTreeView='1' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
                parmC.Add(new MySqlParameter("@Md_parentid", model.MdId));
                if (mdManage.Get(strWhereC.ToString(), parmC) != null)
                //if (mdManage.Get("Md_parentid='" + model.MdId + "'and Md_existsTreeView='1' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder") != null)
                {
                    IsChild = true;
                }
                else
                {
                    IsChild = false;
                }

                //最外层div格式
                if (IsChild)
                {
                    str.Append("<div id=" + model.MdId + " class=\"moduleChildYes\">");
                }
                else
                {
                    str.Append("<div id=" + model.MdId + " class=\"moduleChildNo\">");
                }
                //最外层div中,顶级模块表格式
                str.Append("<table class=\"ModuleTeble\">");
                str.Append("<tr>");
                str.Append("<td><div class=\"MapShow\" id=\"" + model.MdId + "_Map\"></div></td>");
                if (IsChild)
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "')\"/ ></td>");
                    }
                    if (PubFuncs.IsLanguageEng())
                    {
                        str.Append("<td><div class=\"ChildTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "')\" >" + model.MdText1.Trim() + "</a></td>");
                    }
                    else
                    {
                        str.Append("<td><div class=\"ChildTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "')\" >" + model.MdName.Trim() + "</a></td>");
                    }
                }
                else
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','" + model.MdId.Trim() + "_Child','1','" + RoleID + "')\"/ ></td>");
                    }
                    str.Append("<td><div class=\"ChildTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1','" + RoleID + "')\" >" + model.MdName.Trim() + "</a></div></td>");
                }
                str.Append("</div>");

                //加载权限列表
                List <PermissionstatalEO> plist = new List <PermissionstatalEO>();


                StringBuilder strWhereX = new StringBuilder();
                strWhereX.Append(" 1=1");
                IList <MySqlParameter> parmX = new List <MySqlParameter>();
                strWhereX.Append(" and APerTat.Pt_del<>1 and APerTat.Pf_id=@Pf_id and AMoudlePer.Md_id = @Md_id");
                parmX.Add(new MySqlParameter("@Pf_id", PlatformID));
                parmX.Add(new MySqlParameter("@Md_id", model.MdId));
                plist = (List <PermissionstatalEO>)ptManage.Gets(strWhereX.ToString(), parmX);
                //plist = (List<PermissionstatalEO>)ptManage.Gets(" APerTat.Pt_del<>1 and APerTat.Pf_id='" + PlatformID + "' and AMoudlePer.Md_id = '" + model.MdId + "'");
                //List<RolemoduleEO> mplist = new List<RolemoduleEO>();
                string        permissionsIdList = "";
                int           int_ls            = 0;
                StringBuilder strls             = new StringBuilder();
                foreach (PermissionstatalEO mpmodel in plist)
                {
                    int_ls++;

                    StringBuilder strWhereL = new StringBuilder();
                    strWhereL.Append(" 1=1");
                    IList <MySqlParameter> parmL = new List <MySqlParameter>();
                    strWhereL.Append(" and Rl_id=@Rl_id and  Md_id=@Md_id and Pt_id=@Pt_id");
                    parmL.Add(new MySqlParameter("@Rl_id", RoleID));
                    parmL.Add(new MySqlParameter("@Md_id", model.MdId));
                    parmL.Add(new MySqlParameter("@Pt_id", mpmodel.PtId));

                    if (rlmdManage.GetTable(strWhereL.ToString(), parmL).Rows.Count > 0)
                    //if (rlmdManage.GetTable("Rl_id='" + RoleID + "' and  Md_id='" + model.MdId + "' and Pt_id='" + mpmodel.PtId + "'").Rows.Count > 0)
                    {
                        strls.Append("<input type=\"checkbox\" id=\"" + model.MdId + "_" + mpmodel.PtId + "\" checked=\"checked\" value=\"" + ISPermName(mpmodel.PtId, plist) + "\" onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\" />");
                        strls.Append("<span onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\">" + ISPermName(mpmodel.PtId, plist) + "</span>");
                    }
                    else
                    {
                        strls.Append("<input type=\"checkbox\" id=\"" + model.MdId + "_" + mpmodel.PtId + "\" value=\"" + ISPermName(mpmodel.PtId, plist) + "\" onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\" />");
                        strls.Append("<span onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\">" + ISPermName(mpmodel.PtId, plist) + "</span>");
                    }
                    if (int_ls == 1)
                    {
                        permissionsIdList += mpmodel.PtId;
                    }
                    else
                    {
                        permissionsIdList += "|" + mpmodel.PtId;
                    }
                }
                if (int_ls != 0)
                {
                    str.Append("<td><div class=\"chackall\"><input type=\"checkbox\" id=\"" + model.MdId + "_all\" value=\"\" style=display:none onclick=\"Permsave('1','" + model.MdId + "','" + RoleID + "','','" + PlatformID + "')\"/><span>&nbsp;</span></div></td>");
                    str.Append("<td><div class=\"check\">");
                    str.Append(strls.ToString());
                    str.Append("</div><input type=\"hidden\" id=\"" + model.MdId + "_hidden\" value=\"" + permissionsIdList + "\">");
                    str.Append("</td>");
                }
                int_ls = 0;
                str.Append("</tr>");
                str.Append("</table>");

                //下级最外层Div格式
                if (IsChild)
                {
                    str.Append("<div id=\"" + model.MdId.Trim() + "_Child\"  class=\"moduleChild\" style=\"display:none;\"></div>");
                }
                str.Append("</div>");
            }
            return(str);
        }
Esempio n. 3
0
        protected void BindTreeView()
        {
            StringBuilder str = new StringBuilder();
            //得到模块权限和角色的列表

            List <ModuleEO> mdEoList = new List <ModuleEO>();
            //mdEoList = (List<ModuleEO>)mdManage.Get(" Pf_id = '" + this.ddlPf.SelectedValue + "' AND Md_parentid = '0' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
            //MySqlParameter[] arrparm = new MySqlParameter { };

            IList <MySqlParameter> parm     = new List <MySqlParameter>();
            StringBuilder          strWhere = new StringBuilder();

            strWhere.Append("    Pf_id = @ddlPf AND Md_parentid = '0' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
            parm.Add(new MySqlParameter("@ddlPf", this.ddlPf.SelectedValue));
            mdEoList = (List <ModuleEO>)mdManage.Get(strWhere.ToString(), parm);

            foreach (ModuleEO model in mdEoList)
            {
                //是否有下级内容
                bool IsChild = true;
                //if (mdManage.Get("Md_parentid=@MdId AND Md_deleteFlag<>1 ORDER BY Md_filedOrder", model.MdId) != null)
                IList <MySqlParameter> parmC     = new List <MySqlParameter>();
                StringBuilder          strWhereC = new StringBuilder();
                strWhereC.Append("   Md_parentid=@MdId AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
                parmC.Add(new MySqlParameter("@MdId", model.MdId));
                if (mdManage.Get(strWhereC.ToString(), parmC) != null)
                {
                    IsChild = true;
                }
                else
                {
                    IsChild = false;
                }

                //最外层div格式
                if (IsChild)
                {
                    str.Append("<div id=" + model.MdId + " class=\"TopParentDivYes\">");
                }
                else
                {
                    str.Append("<div id=" + model.MdId + " class=\"TopParentDivYes\">");
                }
                //最外层div中,顶级模块表格式
                str.Append("<table class=\"TopModuleTeble\">");
                str.Append("<tr>");
                str.Append("<td><div class=\"MapShow\" id=\"" + model.MdId + "_Map\"></div></td>");
                //是否有下级模块
                if (IsChild)
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\"/ ></td>");
                    }
                    if (IsLanguageEng())
                    {
                        str.Append("<td><div class=\"TopParentTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\" >" + model.MdText1 + "</a></div></td>");
                    }

                    else
                    {
                        str.Append("<td><div class=\"TopParentTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\" >" + model.MdName.Trim() + "</a></div></td>");
                    }
                }
                else
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\"/ ></td>");
                    }
                    if (IsLanguageEng())
                    {
                        str.Append("<td><div class=\"TopParentTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\" >" + model.MdText1 + "</a></div></td>");
                    }
                    str.Append("<td><div class=\"TopParentTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\" >" + model.MdName.Trim() + "</a></div></td>");
                }
                string useflag = model.MdUseFlag.Trim() == "0" ? Resources.Resource.On : Resources.Resource.Off;
                str.Append("<td><div class=\"useFlag\">" + useflag + "</div></td>");
                string ExitsTree = model.MdExistsTreeView.Trim() == "0" ? Resources.Resource.Display_in_the_tree_directory : Resources.Resource.Hide_in_the_tree_directory;
                str.Append("<td><div class=\"exitsTree\">" + ExitsTree + "</div></td>");
                str.Append("<td <div class=\"features\"><a href=\"ModuleEdit.aspx?State=AC&Action=0&ParentID=" + model.MdId + "&ParentName=" + model.MdName + "&MdText1=" + model.MdText1 + "\">" + Resources.Resource.Add_sub_module + "</a>|<a href=\"ModuleEdit.aspx?State=U&Action=1&ModuleID=" + model.MdId + "\">" + Resources.Resource.edit + "</a>|<a href=\"#\" onclick=\"Process('" + model.MdId + "')\">" + Resources.Resource.delete + "</a></div></td>");
                str.Append("</tr>");
                str.Append("</table>");
                if (IsChild)
                {
                    str.Append("<div id=\"" + model.MdId.Trim() + "_Child\" class=\"TopModuleChild\" style=\"display:none;\"></div>");
                }
                str.Append("</div>");
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                TreelistView.InnerHtml = str.ToString();
            }
            else
            {
                TreelistView.InnerHtml = Resources.Resource.No_data; //"暂无数据";
            }
        }
Esempio n. 4
0
        protected void BindTreeView()
        {
            StringBuilder   str       = new StringBuilder();
            List <ModuleEO> modellist = new List <ModuleEO>();
            //得到模块权限和角色的列表
            List <RolemoduleEO> rmplist = new List <RolemoduleEO>();

            rmplist = (List <RolemoduleEO>)Session["RmpList"];
            IList <MySqlParameter> parm     = new List <MySqlParameter>();
            StringBuilder          strWhere = new StringBuilder();

            strWhere.Append("  Pf_id = @Pf_id AND Md_parentid='0' AND Md_deleteFlag <>1 ORDER BY Md_filedOrder");
            parm.Add(new MySqlParameter("@Pf_id", PlatformID));

            //modellist = (List<ModuleEO>)mdManage.Get(" Pf_id = '" + PlatformID + "' AND Md_parentid='0' AND Md_deleteFlag <>1 ORDER BY Md_filedOrder");
            modellist = (List <ModuleEO>)mdManage.Get(strWhere.ToString(), parm);
            foreach (ModuleEO model in modellist)
            {
                //是否有下级内容
                bool IsChild = true;
                //if (mdManage.Get("Md_parentid='" + model.MdId + "' AND Md_deleteFlag <>1 ORDER BY Md_filedOrder") != null)
                IList <MySqlParameter> parmC     = new List <MySqlParameter>();
                StringBuilder          strWhereC = new StringBuilder();
                strWhereC.Append("  Md_parentid=@Md_parentid AND Md_deleteFlag <>1 ORDER BY Md_filedOrder");
                parmC.Add(new MySqlParameter("@Md_parentid", model.MdId));
                if (mdManage.Get(strWhereC.ToString(), parmC) != null)
                {
                    IsChild = true;
                }
                else
                {
                    IsChild = false;
                }

                //最外层div格式
                if (IsChild)
                {
                    str.Append("<div id=" + model.MdId + " class=\"TopParentDivYes\">");
                }
                else
                {
                    str.Append("<div id=" + model.MdId + " class=\"TopParentDivNo\">");
                }

                //最外层div中,顶级模块表格式
                str.Append("<table class=\"TopModuleTeble\">");
                str.Append("<tr>");
                str.Append("<td><div class=\"MapShow\" id=\"" + model.MdId + "_Map\"></div></td>");
                //是否有下级目录
                if (IsChild)
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "','" + PlatformID + "')\" /></td>");
                    }
                    if (IsLanguageEng())
                    {
                        str.Append("<td><div class=\"TopParentTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "','" + PlatformID + "')\" >" + model.MdText1.Trim() + "</a></div></td>");
                    }
                    else
                    {
                        str.Append("<td><div class=\"TopParentTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0','" + RoleID + "','" + PlatformID + "')\" >" + model.MdName.Trim() + "</a></div></td>");
                    }
                }
                else
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1','" + RoleID + "','" + PlatformID + "')\" ></td>");
                    }
                    if (IsLanguageEng())
                    {
                        str.Append("<td ><div class=\"TopParentTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1','" + RoleID + "','" + PlatformID + "')\" >" + model.MdText1.Trim() + "</a></div></td>");
                    }
                    else
                    {
                        str.Append("<td ><div class=\"TopParentTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1','" + RoleID + "','" + PlatformID + "')\" >" + model.MdName.Trim() + "</a></div></td>");
                    }
                }

                //加载权限列表
                List <PermissionstatalEO> plist     = new List <PermissionstatalEO>();
                StringBuilder             strWhereQ = new StringBuilder();
                strWhereQ.Append(" 1=1");
                IList <MySqlParameter> parmQ = new List <MySqlParameter>();
                strWhereQ.Append(" and APerTat.Pt_del<>1 and APerTat.Pf_id=@Pf_id and AMoudlePer.Md_id = @Md_id");
                parmQ.Add(new MySqlParameter("@Pf_id", PlatformID));
                parmQ.Add(new MySqlParameter("@Md_id", model.MdId));
                plist = (List <PermissionstatalEO>)ptManage.Gets(strWhereQ.ToString(), parmQ);
                //plist = (List<PermissionstatalEO>)ptManage.Gets(" APerTat.Pt_del<>1 and APerTat.Pf_id='" + PlatformID + "' and AMoudlePer.Md_id = '" + model.MdId + "'");
                string        permissionsIdList = "";
                int           int_ls            = 0;
                StringBuilder strls             = new StringBuilder();
                foreach (PermissionstatalEO mpmodel in plist)
                {
                    int_ls++;
                    //是否已选择了权限
                    if (ISPerm(model.MdId, mpmodel.PtId))
                    {
                        strls.Append("<input type=\"checkbox\" id=\"" + model.MdId + "_" + mpmodel.PtId + "\" checked=\"checked\" value=\"" + ISPermName(mpmodel.PtId, plist) + "\" onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\" />");
                        strls.Append("<span onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\">" + ISPermName(mpmodel.PtId, plist) + "</span>");
                    }
                    else
                    {
                        strls.Append("<input type=\"checkbox\" id=\"" + model.MdId + "_" + mpmodel.PtId + "\" value=\"" + ISPermName(mpmodel.PtId, plist) + "\" onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\" />");
                        strls.Append("<span onclick=\"Permsave('0','" + model.MdId + "','" + RoleID + "','" + mpmodel.PtId + "','" + PlatformID + "')\">" + ISPermName(mpmodel.PtId, plist) + "</span>");
                    }
                    if (int_ls == 1)
                    {
                        permissionsIdList += mpmodel.PtId;
                    }
                    else
                    {
                        permissionsIdList += "|" + mpmodel.PtId;
                    }
                }

                if (int_ls != 0)
                {
                    str.Append("<td><div class=\"checkall\"><input type=\"checkbox\" id=\"" + model.MdId + "_all\" value=\"\" style=display:none onclick=\"Permsave('1','" + model.MdId + "','" + RoleID + "','','" + PlatformID + "')\"/><span onclick=\"Permsave('1','" + model.MdId + "','" + RoleID + "','','" + PlatformID + "')\">&nbsp;</span></div></td>");
                    str.Append("<td><div class=\"chack\">");
                    str.Append(strls.ToString());
                    str.Append("</div><input type=\"hidden\" id=\"" + model.MdId + "_hidden\" value=\"" + permissionsIdList + "\">");
                    str.Append("</td>");
                }
                int_ls = 0;
                str.Append("</tr>");
                str.Append("</table>");

                //下级最外层Div格式
                if (IsChild)
                {
                    str.Append("<div id=\"" + model.MdId.Trim() + "_Child\"  class=\"TopModuleChild\" style=\"display:none;\"></div>");
                }
                str.Append("</div>");
            }

            if (!string.IsNullOrEmpty(str.ToString()))
            {
                PermissionsTree.InnerHtml = str.ToString();
            }
            else
            {
                PermissionsTree.InnerHtml = "暂无数据";
            }
        }
Esempio n. 5
0
        public ActionResult Save(SYS_MODULE entity)
        {
            bool isEdit = false;
            var  json   = new JsonHelper {
                Status = "n", Msg = "保存成功!"
            };

            try
            {
                if (entity != null)

                {
                    //验证
                    if (!Regex.IsMatch(entity.ALIAS, @"^[A-Za-z0-9]{1,20}$"))
                    {
                        json.Msg = "模块别名只能以字母数字组成,长度不能超过20个字符";
                        return(Json(json));
                    }

                    //级别加1,一级模块默认0
                    if (entity.PARENTID <= 0)
                    {
                        entity.LEVELS = 0;
                    }
                    else
                    {
                        entity.LEVELS = ModuleManage.Get(p => p.ID == entity.PARENTID).LEVELS + 1;
                    }

                    //添加
                    if (entity.ID <= 0)
                    {
                        entity.CREATEDATE = DateTime.Now;
                        entity.CREATEUSER = this.CurrentUser.Name;
                        entity.UPDATEDATE = DateTime.Now;
                        entity.UPDATEUSER = this.CurrentUser.Name;
                    }
                    //修改
                    else
                    {
                        entity.UPDATEDATE = DateTime.Now;
                        entity.UPDATEUSER = this.CurrentUser.Name;
                        isEdit            = true;
                    }

                    //模块别名同系统下不能重名
                    if (
                        ModuleManage.IsExist(
                            p =>
                            p.FK_BELONGSYSTEM == entity.FK_BELONGSYSTEM &&
                            p.ALIAS.ToLower() == entity.ALIAS.ToLower() && p.ID != entity.ID))
                    {
                        json.Msg = "同系统下模块别名不能重复";
                        return(Json(json));
                    }

                    //判断同一个模块下是否重名
                    if (
                        this.ModuleManage.IsExist(
                            p =>
                            p.PARENTID == entity.PARENTID && p.FK_BELONGSYSTEM == entity.FK_BELONGSYSTEM &&
                            p.NAME == entity.NAME && p.ID != entity.ID))
                    {
                        json.Msg = "模块" + entity.NAME + "已存在,不能重复添加";
                        return(Json(json));
                    }


                    if (this.ModuleManage.SaveOrUpdate(entity, isEdit))
                    {
                        json.Status = "y";
                    }
                    else
                    {
                        json.Msg = "保存失败!";
                    }

                    //变更下级模块的级别
                    if (isEdit)
                    {
                        this.ModuleManage.MoreModifyModule(entity.ID, Convert.ToInt32(entity.LEVELS));
                    }
                }
                else
                {
                    json.Msg = "未找到需要保存的模块!";
                }
            }
            catch (Exception ex)
            {
                json.Msg = "保存模块发生内部错误!";
                WriteLog(Common.Enums.enumOperator.None, "保存模块", ex);
            }

            return(Json(json));
        }
Esempio n. 6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            StringBuilder str = new StringBuilder();

            str.Append(ParentID + "_Child|||");

            //得到模块列表
            List <ModuleEO> mdEoList = new List <ModuleEO>();
            //mdEoList = (List<ModuleEO>)mdManage.Get("Md_parentid='" + ParentID + "' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");


            IList <MySqlParameter> parm     = new List <MySqlParameter>();
            StringBuilder          strWhere = new StringBuilder();

            strWhere.Append("  Md_parentid=@Md_parentid AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
            parm.Add(new MySqlParameter("@Md_parentid", ParentID));
            mdEoList = (List <ModuleEO>)mdManage.Get(strWhere.ToString(), parm);
            foreach (ModuleEO model in mdEoList)
            {
                //是否有下级内容
                bool IsChild = true;
                //if (mdManage.Get("Md_parentid='" + model.MdId + "' AND Md_deleteFlag<>1 ORDER BY Md_filedOrder") != null)

                IList <MySqlParameter> parmC     = new List <MySqlParameter>();
                StringBuilder          strWhereC = new StringBuilder();
                strWhereC.Append("  Md_parentid=@Md_parentid AND Md_deleteFlag<>1 ORDER BY Md_filedOrder");
                parmC.Add(new MySqlParameter("@Md_parentid", model.MdId));
                //mdEoList = (List<ModuleEO>)mdManage.Get(strWhereC.ToString(), parmC);
                if (mdManage.Get(strWhereC.ToString(), parmC) != null)
                {
                    IsChild = true;
                }
                else
                {
                    IsChild = false;
                }

                if (IsChild)
                {
                    str.Append("<div id=" + model.MdId + " class=\"moduleChildYes\">");
                }
                else
                {
                    str.Append("<div id=" + model.MdId + " class=\"moduleChildNo\">");
                }
                //表格式
                str.Append("<table class=\"ModuleTeble\">");
                str.Append("<tr>");
                str.Append("<td><div class=\"MapShow\" id=\"" + model.MdId + "_Map\"></div></td>");
                //是否有下级目录
                if (IsChild)
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\" /></td>");
                    }

                    if (IsLanguageEng())
                    {
                        str.Append("<td ><div class=\"ChildTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\" >" + model.MdText1 + "</a></div></td>");
                    }
                    else
                    {
                        str.Append("<td ><div class=\"ChildTitleYes\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','0')\" >" + model.MdName.Trim() + "</a></div></td>");
                    }
                }
                else
                {
                    if (model.MdImgUrl == "")
                    {
                        str.Append("<td></td>");
                    }
                    else
                    {
                        str.Append("<td><img src=\"" + model.MdImgUrl + "\" onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\"/ ></td>");
                    }

                    if (IsLanguageEng())
                    {
                        str.Append("<td><div class=\"ChildTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\" >" + model.MdText1 + "</div></a></td>");
                    }
                    else
                    {
                        str.Append("<td><div class=\"ChildTitleNo\"><a href=\"#\"  onclick=\"javascrpt:TreeViewSpread('" + model.MdId + "','1')\" >" + model.MdName.Trim() + "</div></a></td>");
                    }
                }


                string useflag = model.MdUseFlag.Trim() == "0" ? Resources.Resource.On : Resources.Resource.Off;
                str.Append("<td><div class=\"useFlag\">" + useflag + "</div></td>");
                string ExitsTree = model.MdExistsTreeView.Trim() == "0" ? Resources.Resource.Display_in_the_tree_directory : Resources.Resource.Hide_in_the_tree_directory;
                str.Append("<td><div class=\"exitsTree\">" + ExitsTree + "</div></td>");
                str.Append("<td <div class=\"features\"><a href=\"ModuleEdit.aspx?State=AC&Action=0&ParentID=" + model.MdId + "&ParentName=" + model.MdName + "\">" + Resources.Resource.Add_sub_module + "</a>|<a href=\"ModuleEdit.aspx?State=U&&Action=1&ModuleID=" + model.MdId + "\">" + Resources.Resource.edit + "</a>|<a href=\"#\" onclick=\"Process('" + model.MdId + "')\">" + Resources.Resource.delete + "</a></div></td>");
                str.Append("</tr>");
                str.Append("</table>");
                if (IsChild)
                {
                    str.Append("<div id=\"" + model.MdId.Trim() + "_Child\" class=\"moduleChild\" style=\"display:none;\"></div>");
                }
                str.Append("</div>");
            }
            context.Response.Write(str.ToString());
        }