日期:2014-01-13  浏览次数:20466 次

 

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Xml;
using System.Text;

namespace WinnerOA.newrpt
{
 /// <summary>
 /// dayenter 的摘要说明。
 /// </summary>
 public class dayenter : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.Calendar Calendar1;
  protected System.Web.UI.WebControls.Button updateButton;
  protected System.Web.UI.WebControls.DataGrid dataTable;
  protected System.Web.UI.WebControls.Button addLineButton;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   if(this.InitReadDataPopedom())
   {
    if(!this.IsPostBack)
    {
     this.Calendar1.SelectedDate=DateTime.Today;
     
     
    }
    this.InitData();
   }
   else
   {
    this.Response.Clear();
    this.Response.Write("您没有权限!");
    this.Response.End();
    return;
   }
   if(this.InitWriteDataPopedom())
   {
     
    this.addLineButton.Visible=true;
    this.updateButton.Visible=true;
   }
   else
   {
    this.addLineButton.Visible=false;
    this.updateButton.Visible=false;
   }
   
  }
  
  private bool InitWriteDataPopedom()
  {
   ArrayList depts=new ArrayList();
   XmlDocument xmldocument=new XmlDocument();
   XmlNodeReader xmlreader=null;
   try
   {
    
    xmldocument.Load(Server.MapPath("..").ToString()+@"\popedom.xml");
    xmlreader=new XmlNodeReader(xmldocument.ChildNodes[1].ChildNodes[11]);
    while(xmlreader.Read())
    {
     if(xmlreader.NodeType.Equals(XmlNodeType.Element))
     {
      if(xmlreader.Name.ToString().Equals("write"))
      {
       while(xmlreader.Read())
       {
        if(!xmlreader.Name.Equals("user"))
        {
         break;
        }
        else
        {
         depts.Add (xmlreader.ReadString());
        }
       }
      }
     
     }
    }
   }
   catch(Exception err)
   {
    Response.Write(err.ToString());
 &nb