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

📄 filereseive.aspx.cs

📁 很不错的公文流转系统
💻 CS
字号:
/*
作者:蒲丰. 
创建日期:2003-12-10
修改者:
修改日期:
修改部分:
类功能:  公文签收
*/
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 ZHENGYI;
namespace OI.ReFileOperate
{
	/// <summary>
	/// FileReseive 的摘要说明。
	/// </summary>
	public class FileReseive : OI.PageBase
	{
		protected System.Web.UI.WebControls.DataGrid dg;
		protected DataSet ds;
		protected  OI.DatabaseOper.DatabaseConnect Dbc=new OI.DatabaseOper.DatabaseConnect ();
		protected  DataGridNavigation divage ;
		DataTable dt;
		//string linkurltitle="documentdetail.aspx";
		protected OI.cs.readStream rs =new OI.cs.readStream ();
		protected System.Web.UI.WebControls.LinkButton LinkAll;
		protected System.Web.UI.WebControls.LinkButton LinkQS;
		protected string stepID;
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if (Session["userid"]==null)
			{
				Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
				return ;
			}
			SetDivePage();
			if (!Page.IsPostBack )
			{
				dataBind();
			}
		}
		private void CreateDataSource()
		{
			string sql="select *  from ViewDocumentno where  CompleteSign=0 and currentstepid != 2";
			ds=new DataSet ();
			ds=Dbc.getBinding(sql,"t");
			foreach (DataRow dr in ds.Tables[0].Rows )
			{
                
				rs.doucmentID =int.Parse (dr["documentid"].ToString ());
				//如果当前用户没在当前节点中,则应当删除.
				
				if (Dbc.GetValueBySql ("select count(*) from TransactUsers where documentid="+dr["documentid"] +" and stepID="+dr["CurrentStepID"].ToString () +" and userid="+Session["userid"].ToString () ).ToString ()=="0")
				{
					dr.Delete ();
				}
				else
				{   //用户存在当前节点中。
					string  CurrentOprateType=rs.GetCurrentOprateTypeByNodeID (dr["CurrentStepID"].ToString ());
					
					if (CurrentOprateType !="收文办理") //文档指向当前节点如果不是待处理的节点类型
					{
						dr.Delete ();  //那么删除
					}
					else 
					{
						sql="select  count(*) from DocumentTransact where documentid="+dr["documentid"].ToString () +" and " ;
						sql += " StepID=" + dr["CurrentStepID"].ToString () + "  and  userid="+Session["userid"].ToString ();
						sql +=" and  BackState=(select max(BackState) from DocumentTransact where documentid= "+dr["documentid"].ToString ()  +")";
						if (int.Parse (Dbc.GetValueBySql(sql)) >0) //如果当前用户,当前节点在处理表中存在,那么删除.
						{
							dr.Delete ();
						}
					}
				}
					
			}
			dt=ds.Tables[0];
			dt.AcceptChanges();
		}
		private void SetDivePage()
		{
			dg.AllowPaging =true; 
			dg.PageSize =10; 
			
			ZHENGYI.BindDataDelegate f =new ZHENGYI.BindDataDelegate (dataBind);//修改这个dataBind,让f 指向你的方法。 
			divage.SetTarget(dg,f,10);
		}
		private void dataBind()
		{
			CreateDataSource();
			dg.DataSource = dt; //ds.Tables[0];
			dg.DataBind ();
			
		}
		private void dg_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if(e.Item.ItemType ==ListItemType.Item  ||e.Item.ItemType ==ListItemType.AlternatingItem )
			{
				//处理标题列
//				if(GetLengtByString(e.Item .Cells[2].Text) >10 )
//				{
//					if (linkurltitle !="")
//					{
//						e.Item .Cells[2].Text="<a href=\"" + linkurltitle+"?doucumentid="+e.Item.Cells[0].Text +"\" title=\""+e.Item .Cells[2].Text +"\">" + e.Item .Cells[2].Text .Substring (0,8)+"...</a>";
//					}
//					else
//					{
//						e.Item .Cells[2].Text="<a href=\"#\" title=\""+e.Item .Cells[2].Text +"\">" + e.Item .Cells[2].Text .Substring (0,8)+"...</a>";
//					}
//					
//				}
//				else //标题长度不超过10
//				{
//					if (linkurltitle !="")
//					{
//						e.Item .Cells[2].Text="<a href=\""+ linkurltitle+"?doucumentid="+e.Item.Cells[0].Text +"\" >" + e.Item .Cells[2].Text +"</a>";
//					}
//					else
//					{
//						e.Item .Cells[2].Text="<a href=\"#\" >" + e.Item .Cells[2].Text+"</a>";
//					}
//				}
				if (e.Item.Cells[3].Text.Length  > 8)
				{
					e.Item .Cells[3].Text="<a href=\"documentdetail.aspx?documentid="+e.Item.Cells[0].Text +"\" title=\""+e.Item .Cells[3].Text +"\">" + e.Item .Cells[3].Text .Substring (0,8)+"...</a>";
				}
				else
				{
					e.Item .Cells[3].Text="<a href=\"documentdetail.aspx?documentid="+e.Item.Cells[0].Text +"\">" + e.Item .Cells[3].Text +"</a>";
				}


				//end
				//处理增加的操作列
			}
		}
		private int  GetLengtByString(string s)
		{
			if (s=="") return 0;
			else 
				return System.Text.Encoding.Default.GetByteCount(s);
		}

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

		}
		#endregion

		private void LinkAll_Click(object sender, System.EventArgs e)
		{
			for (int i=0;i<dg.Items.Count ;i++)
			{
				CheckBox cb= (CheckBox)dg.Items[i].FindControl ("Ckboxcy");
				cb.Checked =true;

			}
		}

		private void LinkQS_Click(object sender, System.EventArgs e)
		{
			for (int i=0;i<dg.Items.Count ;i++)
			{
				CheckBox cb=(CheckBox)dg.Items[i].FindControl ("Ckboxcy");
				if (cb.Checked) 
				{
					QS (dg.Items[i].Cells [0].Text,dg.Items[i].Cells[1].Text) ;
				}
			}
			Response.Redirect ("FileReseive.aspx");
		}
		private void QS(string documentid,string currentnodeid)
		{
			string maxvalue =Dbc.GetValueBySql ("select max(BackState) from DocumentTransact where documentid= "+documentid ).ToString ();
			string [] sqls =new string [2];
			
			sqls[0]= " insert into documentTransact values ("+currentnodeid+",1,"+documentid+","+Session["userid"].ToString ()+",2,'','"+System.DateTime.Now +"','','',"+maxvalue +")";
			Dbc.ExecuteSQL (sqls[0]);
		   string totalman=Dbc.GetValueBySql ("select count(*) from transactusers where documentid="+documentid +" and stepid=" +currentnodeid).ToString ();
           string completemanSql= " select count(*)from documenttransact where documentid="+documentid +" and stepid=" +currentnodeid  +" and backstate=(select max(backstate) from  documenttransact where documentid=" +documentid +")";
			string  completeman =Dbc.GetValueBySql (completemanSql).ToString ();
			if  (int.Parse (totalman) >int.Parse (completeman) )
			{
				sqls[1]="";
			}
			else
			{
				sqls[1]="update document set CompleteSign =1 where documentid="+ documentid ;
				Dbc.ExecuteSQL (sqls[1]);
			}
			
			
			
          
		}
		/// <summary>
		/// 是否结束当前的结点
		/// </summary>
		/// <param name="documentid">文本ID</param>
		/// <param name="currentnodeid">当前节点iD</param>
		/// <returns></returns>
		private bool  IsEndCurrentNode(string documentid,string currentnodeid)
		{
			rs.doucmentID =int.Parse (documentid);

			int  totalman=	rs.GetCurrentNodePersonNum (currentnodeid);
			string sql="select count(*) from DocumentTransact where documentid= "+documentid +" and StepID =" +currentnodeid + " and BackState=(select max(BackState) from DocumentTransact where documentid= "+documentid +" and StepID =" +currentnodeid +")";
			int compeletePersonMan=int.Parse (Dbc.GetValueBySql(sql)); 
			if (totalman > compeletePersonMan)
				return false;
			else
				return true;
		}

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

		
	}
}

⌨️ 快捷键说明

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