• asp.net,简单权限。存取读XML


    public string strToExcel = "none";
    public string strConter = "none";
    public string updateuid = "";
    public string fileContents;
    
    public void XunHuan()
            {
    
                string Modify_Employ = Session["Login_Employ_No"];
                string filename = null;
                string curDir = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
                //运行文件的当前相对目录     '""
    
                curDir = curDir.Substring(curDir.IndexOf("E:"), curDir.LastIndexOf(".") - 8);
                filename = curDir + "/aul.xml";
                filename = filename.Replace(".", "/").Replace("aul/xml", "aul.xml").Replace("/WebRoot/bin/Status", "");
                //Response.Write(filename)
                XmlDocument doc = new XmlDocument();
                doc.Load(filename);
    
                XmlNode root = doc.DocumentElement;
                XmlNode shopId = root.SelectSingleNode("//base/shopId");
                fileContents = shopId.InnerText;
                //读取节点值
    
                //控制导出功能的显示隐藏
                if (fileContents.IndexOf(Modify_Employ) >= 0)
                {
                    strToExcel = "block";
                }
                string fileConter = "0002439,0004698,0000403,";
                //控制权限功能的显示隐藏
                if (fileConter.IndexOf(Modify_Employ) >= 0)
                {
                    strConter = "block";
                }
    
                string strtypeuid = Request.QueryString["hdtuid"];
                //获取隐藏域的操作类型 a添加  d是移除
                updateuid = Request.QueryString["txtuserid"];
                //要添加或删除的员工ID
                //如果参数是添加员工
                if (strtypeuid == "a")
                {
                    if (fileContents.IndexOf(updateuid) >= 0)
                    {
                        //Page.ClientScript.RegisterStartupScript(Page.GetType(), "message0", "<script language='javascript'>alert('该员工已有权限');</script>")
                    }
                    else
                    {
                        shopId.InnerText = fileContents + updateuid + ",";
                        //设置节点值
                        doc.Save(filename);
                        //保存XML
                        //My.Computer.FileSystem.WriteAllText("E:/Project/eip/WebRoot/eiptohtuserlist.txt", fileContents & updateuid & ",", False, System.Text.Encoding.Unicode) '把员工ID保存进文件
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message1", "<script language='javascript'>alert('添加成功');document.forms[0].submit();</script>");
                    }
                }
                //如果参数是移除员工
                if (strtypeuid == "d")
                {
                    fileContents = fileContents.Replace(updateuid + ",", "");
                    shopId.InnerText = fileContents;
                    //设置节点值
                    doc.Save(filename);
                    //保存XML
                    //My.Computer.FileSystem.WriteAllText("E:/Project/eip/WebRoot/eiptohtuserlist.txt", fileContents, False, System.Text.Encoding.Unicode) '把员工ID保存进文件
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message2", "<script language='javascript'>alert('移除成功');  self.opener.location.reload(); </script>");
                }
    
                
    
            }

  • 相关阅读:
    swift中数组和字典得使用,及循环得使用方法(xcode6版本上所写代码)
    ScrollView各属性,及代理方法汇总
    贝塞尔曲线
    iOS基础教程-collectionView的应用
    iOS中,使用block传值简单应用
    ES6~Promise的原理及使用一(copy自: https://www.cnblogs.com/lvdabao/p/jquery-deferred.html)
    react~setState的运行机制
    react ~4.组件table的使用及表格分页处理
    react ~3.动态无限层级顶部菜单和左边菜单设计制作
    react ~2.登陆页面验证码的获取传递与刷新
  • 原文地址:https://www.cnblogs.com/wybshyy/p/13783725.html
Copyright © 2020-2023  润新知