MeetingDetails.aspx.cs
资源名称:OA_at.rar [点击查看]
上传用户:tree100901
上传日期:2007-06-03
资源大小:2295k
文件大小:6k
源码类别:
OA系统
开发平台:
C#
- using System;
- 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>
- /// MeetingDetails 的摘要说明。
- /// </summary>
- public class MeetingDetails : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label Title;
- protected System.Web.UI.WebControls.Label Caller;
- protected System.Web.UI.WebControls.Label MeetingMeetingDate;
- protected System.Web.UI.WebControls.Label Address;
- protected System.Web.UI.WebControls.Label Sender;
- protected System.Web.UI.WebControls.Label Attends;
- protected System.Web.UI.WebControls.Label MeetingDate;
- protected System.Web.UI.HtmlControls.HtmlInputButton Button1;
- protected System.Data.SqlClient.SqlConnection MyConnection;
- public string AID;
- private void Page_Load(object sender, System.EventArgs e)
- {
- MyConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);
- if(Request.Params["MeetingID"]!=null)
- {
- int MID = Int32.Parse(Request.Params["MeetingID"]);
- string PID = "";
- string CID = "";
- string STATE = "";
- SqlCommand MyCommand00 = new SqlCommand("PersonID",MyConnection);
- MyCommand00.CommandType = CommandType.StoredProcedure;
- MyCommand00.Parameters.Add(new SqlParameter("@Name", SqlDbType.NVarChar, 50));
- MyCommand00.Parameters["@Name"].Value = User.Identity.Name;
- MyConnection.Open();
- SqlDataReader myReader00 = MyCommand00.ExecuteReader();
- try
- {
- while(myReader00.Read())
- {
- AID = myReader00.GetInt32(0).ToString();
- }
- myReader00.Close();
- }
- finally
- {
- }
- SqlCommand MyCommand = new SqlCommand("MeetingContents",MyConnection);
- MyCommand.CommandType = CommandType.StoredProcedure;
- MyCommand.Parameters.Add(new SqlParameter("@MeetingID", SqlDbType.Int, 4));
- MyCommand.Parameters["@MeetingID"].Value = Int32.Parse(Request.Params["MeetingID"]);
- SqlDataReader myReader = MyCommand.ExecuteReader();
- myReader.Read();
- PID = myReader["PersonID"].ToString();
- Title.Text = myReader["Title"].ToString();
- MeetingDate.Text = DateTime.Parse(myReader["MeetingDate"].ToString()).ToString("yy-MM-dd HH:mm");
- Attends.Text = myReader["Attends"].ToString();
- Address.Text = myReader["Address"].ToString();
- CID = myReader["Caller"].ToString().Replace("(","").Replace(")","");
- STATE= myReader["State"].ToString();
- if(myReader["State"].ToString()=="0")
- STATE="("+AID+")";
- else
- {
- if(myReader["State"].ToString().IndexOf("("+AID+")",0)==-1)
- STATE=myReader["State"].ToString()+",("+AID+")";
- else
- STATE=myReader["State"].ToString();
- }
- myReader.Close();
- SqlCommand MyCommand0 = new SqlCommand("PersonName",MyConnection);
- MyCommand0.CommandType = CommandType.StoredProcedure;
- MyCommand0.Parameters.Add(new SqlParameter("@PersonID", SqlDbType.Int, 4));
- MyCommand0.Parameters["@PersonID"].Value = Int32.Parse(PID);
- SqlDataReader myReader0 = MyCommand0.ExecuteReader();
- myReader0.Read();
- Sender.Text = myReader0["Name"].ToString();
- myReader0.Close();
- SqlCommand MyCommand1 = new SqlCommand("PersonName",MyConnection);
- MyCommand1.CommandType = CommandType.StoredProcedure;
- MyCommand1.Parameters.Add(new SqlParameter("@PersonID", SqlDbType.Int, 4));
- MyCommand1.Parameters["@PersonID"].Value = Int32.Parse(CID);
- SqlDataReader myReader1 = MyCommand1.ExecuteReader();
- myReader1.Read();
- Caller.Text = myReader1["Name"].ToString();
- myReader1.Close();
- SqlCommand MyCommand2= new SqlCommand("UpdateMeetingState", MyConnection);
- MyCommand2.CommandType = CommandType.StoredProcedure;
- MyCommand2.Parameters.Add(new SqlParameter("@MeetingID", SqlDbType.Int, 4));
- MyCommand2.Parameters["@MeetingID"].Value = MID;
- MyCommand2.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar,500));
- MyCommand2.Parameters["@State"].Value = STATE;
- MyCommand2.ExecuteNonQuery();
- MyConnection.Close();
- }
- // 在此处放置用户代码以初始化页面
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Button1.ServerClick += new System.EventHandler(this.Button1_ServerClick);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void Button1_ServerClick(object sender, System.EventArgs e)
- {
- MyConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);
- DateTime now= DateTime.Now;
- SqlCommand MyCommand=new SqlCommand("InsertSchedule",MyConnection);
- MyCommand.CommandType = CommandType.StoredProcedure;
- MyCommand.Parameters.Add(new SqlParameter("@Contents",SqlDbType.NVarChar, 200));
- MyCommand.Parameters["@Contents"].Value = "(会议)"+Title.Text;
- MyCommand.Parameters.Add(new SqlParameter("@PersonID",SqlDbType.Int, 4));
- MyCommand.Parameters["@PersonID"].Value = Int32.Parse(AID);
- MyCommand.Parameters.Add(new SqlParameter("@PlanTime",SqlDbType.DateTime, 8));
- MyCommand.Parameters["@PlanTime"].Value = DateTime.Parse(MeetingDate.Text);
- MyCommand.Parameters.Add(new SqlParameter("@State",SqlDbType.NVarChar, 500));
- MyCommand.Parameters["@State"].Value = "0";
- if(MyConnection.State.ToString()=="Closed")
- MyConnection.Open();
- MyCommand.ExecuteNonQuery();
- MyConnection.Close();
- RegisterStartupScript("alert","<script>alert('已加入日程计划!');window.close();</script>");
- }
- }
- }