Default.aspx.cs
资源名称:OA_at.rar [点击查看]
上传用户:tree100901
上传日期:2007-06-03
资源大小:2295k
文件大小:9k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.IO;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace OA
- {
- /// <summary>
- /// _Default1 的摘要说明。
- /// </summary>
- public class _Default1 : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label Label1;
- protected Microsoft.Web.UI.WebControls.TreeView TreeView1;
- protected System.Web.UI.HtmlControls.HtmlTable SystemManager;
- protected System.Web.UI.HtmlControls.HtmlTable Myshortcut;
- protected System.Web.UI.HtmlControls.HtmlTable Mylink;
- protected System.Data.SqlClient.SqlConnection MyConnection;
- private void Page_Load(object sender, System.EventArgs e)
- {
- CheckUser CHU = new CheckUser();
- CHU.UserName = User.Identity.Name;
- MyConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);
- string datafile = "menu/SystemManageMenu.xml" ;
- try
- {
- DataSet guestData = new DataSet();
- FileStream fin ;
- fin = new FileStream(Server.MapPath(datafile),FileMode.Open, FileAccess.Read,FileShare.ReadWrite) ;
- guestData.ReadXml(fin);
- fin.Close();
- DataTable ndt = guestData.Tables[0];
- for(int i=0;i<ndt.Rows.Count;i++)
- {
- HtmlTableRow r = new HtmlTableRow();
- HtmlTableCell c = new HtmlTableCell();
- c.BgColor = "White";
- c.Attributes["Height"] = "20";
- c.Attributes.Add("onmouseover", "this.style.backgroundImage='url(images//item_selected_bg.gif)'");
- c.Attributes.Add("onmouseout", "this.style.backgroundImage='url(none)'");
- c.Style["cursor"] = "hand";
- c.Controls.Add(new LiteralControl(""+ndt.Rows[i]["Label"]+""));
- if(CHU.Is_SystemManager() == false)
- c.Attributes.Add("onclick","alert('你没有查看此页面的权限!')");
- else
- c.Attributes.Add("onclick","window.open('"+ndt.Rows[i]["URL"]+"','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,revisable=no,left=100,top=0,width=600,height=250')");
- r.Cells.Add(c);
- SystemManager.Rows.Add(r);
- }
- }
- catch
- {
- }
- string shortcut = "menu/shortcut.xml" ;
- try
- {
- DataSet shortcutData = new DataSet();
- FileStream fin ;
- fin = new FileStream(Server.MapPath(shortcut),FileMode.Open, FileAccess.Read,FileShare.ReadWrite) ;
- shortcutData.ReadXml(fin);
- fin.Close();
- DataTable ndt = shortcutData.Tables[0];
- for(int i=0;i<ndt.Rows.Count;i++)
- {
- HtmlTableRow r = new HtmlTableRow();
- HtmlTableCell c = new HtmlTableCell();
- c.BgColor = "White";
- c.Attributes["Height"] = "20";
- c.Attributes.Add("onmouseover", "this.style.backgroundImage='url(images//item_selected_bg.gif)'");
- c.Attributes.Add("onmouseout", "this.style.backgroundImage='url(none)'");
- c.Style["cursor"] = "hand";
- c.Controls.Add(new LiteralControl(""+ndt.Rows[i]["Label"]+""));
- c.Attributes.Add("onclick","window.open('"+ndt.Rows[i]["URL"]+"','Doc','')");
- r.Cells.Add(c);
- Myshortcut.Rows.Add(r);
- }
- }
- catch
- {
- }
- string link = "menu/link.xml" ;
- try
- {
- DataSet linkData = new DataSet();
- FileStream fin ;
- fin = new FileStream(Server.MapPath(link),FileMode.Open, FileAccess.Read,FileShare.ReadWrite) ;
- linkData.ReadXml(fin);
- fin.Close();
- DataTable ndt = linkData.Tables[0];
- for(int i=0;i<ndt.Rows.Count;i++)
- {
- HtmlTableRow r = new HtmlTableRow();
- HtmlTableCell c = new HtmlTableCell();
- c.BgColor = "White";
- c.Attributes["Height"] = "20";
- c.Attributes.Add("onmouseover", "this.style.backgroundImage='url(images//item_selected_bg.gif)'");
- c.Attributes.Add("onmouseout", "this.style.backgroundImage='url(none)'");
- c.Style["cursor"] = "hand";
- c.Controls.Add(new LiteralControl(""+ndt.Rows[i]["Label"]+""));
- c.Attributes.Add("onclick","window.open('"+ndt.Rows[i]["URL"]+"','_blank','')");
- r.Cells.Add(c);
- Mylink.Rows.Add(r);
- }
- }
- catch
- {
- }
- DataSet ds = new DataSet();
- SqlDataAdapter MyCommand=new SqlDataAdapter("SystemSelect",MyConnection);
- MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
- if(MyConnection.State.ToString()=="Closed")
- MyConnection.Open();
- MyCommand.Fill(ds,"Root");
- DataTable dt = ds.Tables["Root"];
- DataRow dtr = dt.NewRow();
- dtr["SystemID"]="0";
- dtr["SystemName"]="文件管理员";
- dt.Rows.Add(dtr);
- SqlDataAdapter MyCommand3=new SqlDataAdapter("OrganizationSelect ",MyConnection);
- MyCommand3.SelectCommand.CommandType = CommandType.StoredProcedure;
- MyCommand3.Fill(ds,"tree2");
- SqlDataAdapter MyCommand1 = new SqlDataAdapter("PersonIDTree0",MyConnection);
- MyCommand1.SelectCommand.CommandType = CommandType.StoredProcedure;
- MyCommand1.SelectCommand.Parameters.Add(new SqlParameter("@JobID", SqlDbType.NVarChar, 50));
- MyCommand1.SelectCommand.Parameters["@JobID"].Value = "%";
- MyCommand1.Fill(ds,"tree3");
- SqlDataAdapter MyCommand2 = new SqlDataAdapter("PersonIDTree0",MyConnection);
- MyCommand2.SelectCommand.CommandType = CommandType.StoredProcedure;
- MyCommand2.SelectCommand.Parameters.Add(new SqlParameter("@JobID", SqlDbType.NVarChar, 50));
- MyCommand2.SelectCommand.Parameters["@JobID"].Value = "6";
- MyCommand2.Fill(ds,"tree");
- for(int i = 0; i<ds.Tables["Root"].Rows.Count; i++)
- {
- Microsoft.Web.UI.WebControls.TreeNode tree1 = new Microsoft.Web.UI.WebControls.TreeNode();
- tree1.ID = ds.Tables["Root"].Rows[i]["SystemID"].ToString();
- tree1.Text = ds.Tables["Root"].Rows[i]["SystemName"].ToString();
- TreeView1.Nodes.Add(tree1);
- for(int j = 0; j<ds.Tables["tree2"].Rows.Count; j++)
- {
- Microsoft.Web.UI.WebControls.TreeNode tree2;
- string str = ds.Tables["tree2"].Rows[j]["SystemID"].ToString();
- string [] str1 = str.Split( new char[]{','});
- foreach (string s in str1)
- {
- if(s == tree1.ID)
- {
- tree2 = new Microsoft.Web.UI.WebControls.TreeNode();
- tree2.ID = ds.Tables["tree2"].Rows[j]["OrganizationID"].ToString();
- tree2.Text = ds.Tables["tree2"].Rows[j]["OrganizationName"].ToString();
- tree1.Nodes.Add(tree2);
- for(int k = 0; k<ds.Tables["tree3"].Rows.Count; k++)
- {
- Microsoft.Web.UI.WebControls.TreeNode tree3;
- string str0 = ds.Tables["tree3"].Rows[k]["OrganizationID"].ToString();
- string [] str2 = str0.Split( new char[]{','});
- foreach (string t in str2)
- {
- if(t == tree2.ID)
- {
- tree3 = new Microsoft.Web.UI.WebControls.TreeNode();
- tree3.ID = ds.Tables["tree3"].Rows[k]["PersonID"].ToString();
- tree3.Text = "<input type='button' onclick=javascript:window.open('ShortcutNewMessage.aspx?Accepter="+ds.Tables["tree3"].Rows[k]["Name"].ToString()+"','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,revisable=no,left=100,top=0,width=600,height=500'); value="+ds.Tables["tree3"].Rows[k]["Name"].ToString()+" style='COLOR: background; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none'>";
- tree2.Nodes.Add(tree3);
- }
- }
- }
- }
- }
- }
- for(int l = 0; l<ds.Tables["tree"].Rows.Count; l++)
- {
- if(tree1.ID=="0")
- {
- Microsoft.Web.UI.WebControls.TreeNode tree2;
- tree2 = new Microsoft.Web.UI.WebControls.TreeNode();
- tree2.ID = ds.Tables["tree"].Rows[l]["PersonID"].ToString();
- tree2.Text = "<input type='button' onclick=javascript:window.open('ShortcutNewMessage.aspx?Accepter="+ds.Tables["tree"].Rows[l]["Name"].ToString()+"','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,revisable=no,left=100,top=0,width=600,height=500'); value="+ds.Tables["tree"].Rows[l]["Name"].ToString()+" style='COLOR: background; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none'>";
- tree1.Nodes.Add(tree2);
- }
- }
- } // 在此处放置用户代码以初始化页面
- SqlDataAdapter MyCommand11 = new SqlDataAdapter("NotificationPrompt",MyConnection);
- MyCommand11.SelectCommand.CommandType = CommandType.StoredProcedure;
- MyCommand11.Fill(ds,"NotificationPrompt");
- for(int i =0; i<ds.Tables["NotificationPrompt"].Rows.Count;i++)
- {
- if(ds.Tables["NotificationPrompt"].Rows[i]["Contents"].ToString()!="")
- Response.Write("<script>window.open('notification.aspx?NotificationID="+ds.Tables["NotificationPrompt"].Rows[i]["NotificationID"].ToString().Trim()+"','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,revisable=no,left=100,top=0,width=300,height=300')</script>");
- }
- MyConnection.Close();
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }