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>");
}
}