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

📄 moas1202.aspx.cs

📁 很具有学习参考价值的OA办公自动化系统,完整源码.OAde
💻 CS
字号:
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;

namespace MOAS
{
	/// <summary>
	/// Moas1202 的摘要说明。
	/// </summary>
	public class MOAS1202 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Table Table2;
		protected System.Web.UI.WebControls.Button Button5;
		protected string[] strGetColor=new string [255];
		protected System.Web.UI.WebControls.Label Label13;
		protected System.Web.UI.WebControls.Label Label14;
		protected System.Web.UI.WebControls.Label Label15;
		protected System.Web.UI.WebControls.Button Button3;
		protected string[] strGetText=new string [255];
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
//			if(!Page.IsPostBack)
//			{
				cheakSession();
				seach();
				creattable();
//			}
						

		}
		//create CMyButton class

		public class CMyButton : System.Web.UI.WebControls.Button
		{
			public int iButtonRow = -1;
			public int iButtonCol = -1;

			public CMyButton(int iRow, int iCol)
			{
				this.iButtonRow = iRow;
				this.iButtonCol = iCol;
			}
		}
		public void cheakSession()
		{
			if(Session["strTransUseridFrom11041"].ToString ().Equals ("")||Session["strArrayCount"].ToString ().Equals (""))
			{
				//Page.RegisterStartupScript("confirm","<script>if (window.confirm('there is not id'))window.close(this);</script>");
			}
			else 
			{
				string iX=((int[])Session["strArrayCount"]).GetValue (0).ToString ();
				string iY=((int[])Session["strArrayCount"]).GetValue (1).ToString ();
				iX="'"+iX+"'";
				iY="'"+iY+"'";
				string s=Session["strTransUseridFrom11041"].ToString ();
				s="'"+s+"'";
				string sql="update seat set ownerid="+s+"  where x="+iX+" and y="+iY+"";
                
				CCoSearchFromDatabase m_Updata=new CCoSearchFromDatabase ();
				m_Updata.Execute(sql);	
				Session.Add ("strTransUseridFrom11041","");
				Session.Add ("strArrayCount","");
				
			}
				
		}
		public void seach()
		{
			//get ownerid;
			string m_Sql="select OWNERID from seat ";
//			CCoSearchFromDatabase m_Search=new CCoSearchFromDatabase ();
			
			
//			string[,] m_String=new string [255 ,1];
//			
//			m_String=((string[,])m_Search.getList (m_Sql))[i,0];
			
			
			//get color and context from AppProConfig
			
			CCoOptionFile m_OptionFile=new CCoOptionFile ("/AppProConfig/colorPro.txt",'=');
			CCoSearchFromDatabase m_Find=new CCoSearchFromDatabase ();
			for(int i=0;i<250;i++)
			{
				string strRecoder=((string[,])m_Find.getList (m_Sql))[i,0];
				if(strRecoder.Trim().Length ==9)
				{
					//select status from user
					
					strRecoder="'"+strRecoder+"'";
					string sql="select STATUS , NAME from USERS where ID="+strRecoder+"";
					

					string s=((string[,])m_Find.getList(sql))[0,0];
					//set color and text 
					if(s.Equals ("1"))
					{
						strGetColor[i]="#808080";
						strGetText[i]=((string[,])m_Find.getList(sql))[0,1].ToString ();
					}
					else if(s.Equals ("2"))
					{
						strGetColor[i]="Red";
						strGetText[i]=((string[,])m_Find.getList(sql))[0,1].ToString ();
					}
					else
					{
						strGetColor[i]="#66cccc";
						strGetText[i]="";
					}
				}
				else
				{
					string str=strRecoder.Trim();
					//read the color from config text
					for(int j=0;j<m_OptionFile.iFileCount;j++)
					{
						
						if(str.Equals(m_OptionFile.strParseContext .GetValue(j).ToString ()))
						{
							strGetColor[i]=m_OptionFile.strParseColor .GetValue (j).ToString ();
							strGetText[i]="";
							break;
						}
						else
						{
							
						}
					}
					if(strGetColor[i]==null)
					{
						strGetColor[i]="White";
					    strGetText[i]="";
					}
				}
			}

		}

		public void creattable()
		{
			//creat Table2's rows and cell
		
			for(int i=0;i<10;i++)
			{
				
				TableRow m_Row =new TableRow() ;
				for(int j=0;j<25;j++)
				{
					TableCell m_Cell =new TableCell() ;
					//set cell's width and height	
					m_Cell.Width =32;
					m_Cell.Height =40; 
					m_Cell.BorderStyle =System.Web .UI .WebControls .BorderStyle .None;
					m_Cell.BorderWidth =0;
					
					
					if(strGetColor[i*25+j]=="#66cccc"||strGetColor[i*25+j]=="#808080")
					{
						//instance CMybutton use i,j @parm
						CMyButton m_Button=new CMyButton(i,j) ;
						
						m_Cell.BackColor=System.Drawing .Color .Blue ;
						m_Button.BackColor =System.Drawing .Color.FromName(strGetColor[i*25+j]);
						m_Button.BorderStyle=System.Web .UI .WebControls .BorderStyle .None;
					   
						m_Button.Text =strGetText[i*25+j];
						m_Button.Click+= new System .EventHandler (this.Button1_Click);					
						//m_Button.Click point Button1_Click
						m_Button.Width =m_Cell.Width ;
					
						m_Button.Height =m_Cell.Height ;
						m_Cell.Controls .Add (m_Button);
						
					
					}
					else
					{
						m_Cell.BackColor =System.Drawing .Color.FromName(strGetColor[i*25+j]);
					}
									
				
					
					
					m_Row.Cells .Add(m_Cell);
					
				}
				Table2.Rows .Add (m_Row);
				
			}
		}


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

		}
		#endregion
		private void Button1_Click(object sender, System.EventArgs e)
		{
			
			//instance CMyButton to get i and j .
			CMyButton tempBut = (CMyButton) sender;						
			//delete the controls from the table's cell	
			Table2.Rows[tempBut.iButtonRow ].Cells[tempBut.iButtonCol].Text =tempBut.Text ;
			//Table2.Rows[tempBut.iButtonRow ].Cells[tempBut.iButtonCol].Font.Size =System.Web .UI .WebControls.FontSize .Smaller;
			
			Table2.Rows[tempBut.iButtonRow ].Cells[tempBut.iButtonCol].Controls .Clear();
			// rember the i and j by Session strArrayCount
			
			int[] iDepose={tempBut.iButtonRow,tempBut.iButtonCol};
			Session.Add ("strArrayCount",iDepose);
			
							
		}
		private void Button3_Click(object sender, System.EventArgs e)
		{
			if(Session["strArrayCount"].ToString ().Equals (""))
			{
				
			}
			else
			{
				Session.Add("strTransHuanmianId","1202");
		          Response.Redirect ("MOAS1104.1.aspx",false);
			}
		}

		private void Button5_Click(object sender, System.EventArgs e)
		{
			if(Session["strArrayCount"].ToString ().Equals (""))
			{
				//do nothing
			}
			else
			{
				string iX=((int[])Session["strArrayCount"]).GetValue (0).ToString ();
				string iY=((int[])Session["strArrayCount"]).GetValue (1).ToString ();
				iX="'"+iX+"'";
				iY="'"+iY+"'";
				string sql="update seat set ownerid='kuuseki     ' where x="+iX+" and y="+iY+"";
                
				CCoSearchFromDatabase m_Updata=new CCoSearchFromDatabase ();
				m_Updata.Execute(sql);
				Session.Add ("strArrayCount","");
				Response.Redirect ("Moas1202.aspx");
			}

		}

		

			
	
	}
	
}

⌨️ 快捷键说明

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