⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unsendedreport.aspx.cs

📁 很不错的公文流转系统
💻 CS
字号:
/**************************************************************************************
作者:Created By zhouzheng. 
创建日期:2002-11-11
修改者:
修改日期:
修改部分:
类功能:发送工作汇报
****************************/
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 OI.DatabaseOper ;
using System.Diagnostics ;

namespace OI.Report
{
	/// <summary>
	/// unSendedReport 的摘要说明。
	/// </summary>
	public class unSendedReport : OI.PageBase
	{
		protected System.Web.UI.WebControls.Label LabelWarning;
		protected System.Web.UI.WebControls.Button ButtonSend;
		protected System.Web.UI.WebControls.TextBox TextBoxContent;
		protected System.Web.UI.WebControls.TextBox TextBoxFileDescription;
		protected System.Web.UI.WebControls.DropDownList DropDownListUserID;
		protected System.Web.UI.WebControls.TextBox TextBoxTitle;
		protected System.Web.UI.HtmlControls.HtmlInputFile FilePath;
		private DatabaseOper.DatabaseConnect dc = new DatabaseOper.DatabaseConnect();
	    string intReportID;
		private void Page_Load(object sender, System.EventArgs e)
		{
			intReportID =Request.QueryString ["ReportID"].ToString ();
			// 在此处放置用户代码以初始化页面
			if (!IsPostBack)
			{
				ViewState["intUserID"]=intReportID;
				this.select();
			}
		}
		private void select()
		{
			string sql="SELECT * FROM report WHERE ReportID='"+intReportID+"'";
			DataSet ds=dc.getBinding (sql,"report");
			TextBoxTitle.Text =ds.Tables[0].Rows[0]["Title"].ToString ();
			TextBoxFileDescription.Text =ds.Tables[0].Rows[0]["FileDescription"].ToString();
			TextBoxContent.Text =ds.Tables[0].Rows[0]["Content"].ToString ();
	        FilePath.Value =ds.Tables[0].Rows[0]["FilePath"].ToString ();
		}
		private void Complete()
		{
			this.ButtonSend.Visible=true;
			this.TextBoxContent.ReadOnly=true;
			this.TextBoxFileDescription.ReadOnly=true;
			this.TextBoxTitle.ReadOnly=true;
			this.DropDownListUserID.Enabled=false;
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.TextBoxFileDescription.TextChanged += new System.EventHandler(this.TextBoxFileDescription_TextChanged);
			this.ButtonSend.Click += new System.EventHandler(this.ButtonSend_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void TextBoxFileDescription_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void ButtonSend_Click(object sender, System.EventArgs e)
		{
			if(!this.IsValid)
				return;
			dc=new DatabaseConnect();
			string texTitle =OI.Modules.String.GenSafeChars(this.TextBoxTitle.Text.Trim());
			string texFileDescription =OI.Modules.String.GenSafeChars(this.TextBoxFileDescription.Text.Trim());
			string texContent =OI.Modules.String.GenSafeChars(this.TextBoxContent.Text.Trim());
			int intUserID =Convert.ToInt32(this.DropDownListUserID.SelectedItem.Value);
			string fileName="";
			string path="";
			string fullPath="";
			
			if(this.FilePath.PostedFile.ContentLength>0)
			{
				fileName=OI.Modules.FileName.NewFileName(this.FilePath.PostedFile.FileName);
				path =OI.Modules.Config.GetSetting("toFilePath");
				fullPath=Server.MapPath(path+"\\"+fileName);
				try
				{
					this.FilePath.PostedFile.SaveAs(fullPath);
				}
				catch
				{
					this.RegisterClientScriptBlock("附件未保存成功!","<script language=javascript>\n alert(\"false\"); \n </script>\n");
					return;
				}
			}
			else
			{
				return;
			}
			string sql1 ="insert into report(Title,FilePath,FileDescription,Content,IsSend,ReportDate,DeleteSign,UserID)"+
				"values('"+texTitle+"','"+fullPath+"','"+texFileDescription+"','"+texContent+"','1','"+System.DateTime.Now+"','0','"+this.User.Identity.Name+"')";
			dc.addData(sql1);
			this.Complete();
			this.LabelWarning.Text ="工作汇报发送成功";
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -