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

📄 calendarview.aspx.cs

📁 OA源代码,是一个不可多得的OA源代码.
💻 CS
📖 第 1 页 / 共 2 页
字号:
							else
							{
								
							    nc.Controls.Add(new LiteralControl("<font color=#FFF8F7>0</font>"));
							    nc.BackColor=Color.FromName("#FFF8F7");
								nc.Attributes.Add("onclick","return dialwinprocess('"+sDate.AddDays(i-1).ToShortDateString()+"','"+(startTimeNo+j).ToString()+"','1','0')");
								nc.Attributes.Add("OnMouseOver","return high( this );");
								nc.Attributes.Add("OnMouseOut","return low( this );");
								//nc.Attributes.Add("onclick","return dialwinprocess('"+q.ToString()+j.ToString()+tmp[q][j].ToString()+"')");
								nc.Style.Add("cursor","hand");
								//							System.Drawing.ColorConverter cc=new System.Drawing.ColorConverter();
								//							newtable.BackColor=(System.Drawing.Color)cc.ConvertFromString("#FF9900");
								//						
							}
							nr.Cells.Add(nc);
				
						}					
					
					
						newtable.CellPadding = 1;
						newtable.CellSpacing = 1;
						newtable.GridLines = System.Web.UI.WebControls .GridLines.Both;
						newtable.BorderWidth = 0;
						newtable.Rows.Add(nr);
						// 新table设置结束
				
						c.Controls.Add(newtable);
					}

					r.Cells.Add(c);
				}
				Table1.CellPadding = 1;
				Table1.CellSpacing = 1;
				Table1.GridLines = System.Web.UI.WebControls .GridLines.Horizontal;
				Table1.BorderWidth = 1;
				Table1.Rows.Add(r);
				
			}

		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.lnkbtnToday.Click += new System.EventHandler(this.lnkbtnToday_Click);
			this.lnkbtnHistory.Click += new System.EventHandler(this.lnkbtnHistory_Click);
			this.lnkbtnFinished.Click += new System.EventHandler(this.lnkbtnFinished_Click);
			this.lnkbtnReturn.Click += new System.EventHandler(this.lnkbtnReturn_Click);
			this.lnkbtnNew.Click += new System.EventHandler(this.lnkbtnNew_Click);
			this.lnkbtnAccept.Click += new System.EventHandler(this.lnkbtnAccept_Click);
			this.lnkbtnCancel.Click += new System.EventHandler(this.lnkbtnCancel_Click);
			this.lnkbtnFinish.Click += new System.EventHandler(this.lnkbtnFinish_Click);
			this.lnkbtnAdd.Click += new System.EventHandler(this.lnkbtnAdd_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		public string GetStatus(string str)
		{
			
			switch (str) {
			case "0":
					return "?"; // 待定
			case "1":
					return "!"; // 待办
			case "2":
					return "√"; // 完成
			default:
					return "";
			}
			

		}

		public string GetPeriodByPeriodID(string begintime,string endtime)
		{
			int b = Int32.Parse(begintime);
			int e = Int32.Parse(endtime);
			DateTime dt = new DateTime(1999,1,1,8,0,0,0);
			TimeSpan ts = new TimeSpan(0,0,(b-1)*30,0,0);
			DateTime bt = dt.Add(ts);
			DateTime et = bt.Add(new TimeSpan(0,0,(e-b+1)*30,0,0));
			return bt.ToShortTimeString()+"----"+et.ToShortTimeString();
			
		}
		
	
		private void setgrid()
		{
			foreach(DataGridItem dgi in this.dgList .Items)
			{
				Label lb=(Label)(dgi.Cells[4].Controls[1]);
				if(lb.Text=="?") dgi.BackColor=Color.AliceBlue ;
			}
		}
		
		#region 翻页事件
		public void DataGrid_PageChanged(object sender,DataGridPageChangedEventArgs e)
		{
			this.dgList .CurrentPageIndex = e.NewPageIndex;
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			
		}
		#endregion

		private void btnChart_Click(object sender, System.EventArgs e)
		{
			// 打印图示代码
			Response.Write("<table width=\"49%\" border=\"1\" align=\"center\" class=\"top\"><tr><td width=\"2%\"  bgcolor=\"#A692F5\">&nbsp;</td>	<td width=\"18%\">未确认任务</td> <td width=\"2%\" bgcolor=\"BlanchedAlmond\">&nbsp;</td> <td width=\"18%\">已确认任务</td></tr></table>");
			this.dgList.Visible = false;
			this.lnkbtnAccept .Visible = false;
			this.lnkbtnCancel .Visible = false;
			this.lnkbtnFinish .Visible = false;
			this.lnkbtnAdd.Visible = false;
			System.Globalization.DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek = System.DayOfWeek.Monday;
			System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames=new String[]{"七","一","二","三","四","五","六"};
			PopulateListView();
			PopulateDateToTable(DateTime.Today.AddDays(-(Convert.ToInt32(DateTime.Today.DayOfWeek))+1),6);
					
		}

	
		private void btnList_Click(object sender, System.EventArgs e)
		{
			Task task = new Task();
			this.dgList.Visible = true;
			this.lnkbtnCancel .Visible = true;
			this.lnkbtnFinish .Visible = true;
			this.lnkbtnAccept .Visible = true;
			this.lnkbtnAdd.Visible = true;
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			mydb.Dispose();
		}

		private void lnkbtnAccept_Click(object sender, System.EventArgs e)
		{
			string ids = "";
			foreach(DataGridItem dgi in this.dgList .Items)
			{
				CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
				if (cb.Checked==true)
				{
					ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";				
				}	
			}
			
			if(ids!="")
			{
				ids = ids.Substring(0,ids.Length-1);
				Task task = new Task();
				try
				{
					task.DealTask(ids,1,Username,DateTime.Today.ToShortDateString());
					Response.Write("<script language=javascript>alert('操作成功!');window.location='CalendarView.aspx?Action=1';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		}

		private void lnkbtnCancel_Click(object sender, System.EventArgs e)
		{
			string ids = "";
			foreach(DataGridItem dgi in this.dgList .Items)
			{
				CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
				if (cb.Checked==true)
				{
					ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";				
				}	
			}
			
			if(ids!="")
			{
				ids = ids.Substring(0,ids.Length-1);
				Task task = new Task();
				try
				{
					task.DealTask(ids,0,Username,DateTime.Today .ToShortDateString());
					Response.Write("<script language=javascript>alert('操作成功!');window.location='CalendarView.aspx?Action=1';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		
		}

		private void lnkbtnFinish_Click(object sender, System.EventArgs e)
		{
			string ids = "";
			foreach(DataGridItem dgi in this.dgList .Items)
			{
				CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
				if (cb.Checked==true)
				{
					ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";				
				}	
			}
			
			if(ids!="")
			{
				ids = ids.Substring(0,ids.Length-1);
				Task task = new Task();
				try
				{
					task.DealTask(ids,2,Username,DateTime.Today.ToShortDateString());
					Response.Write("<script language=javascript>alert('操作成功!');window.location='CalendarView.aspx?Action=1';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		
		}

		private void lnkbtnAdd_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("CalendarView.aspx?Action=2");
		}

		private void lnkbtnReturn_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("CalendarView.aspx?Action=1");
		}

		private void lnkbtnToday_Click(object sender, System.EventArgs e)
		{
			this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton2.gif");
			this.tblContainer.Rows[0].Cells[1].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			mydb.Dispose();
			displayType = 1;
		}

		private void lnkbtnHistory_Click(object sender, System.EventArgs e)
		{
			this.tblContainer.Rows[0].Cells[1].Attributes.Add("background","../../images/maillistbutton2.gif");
			this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,2));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			mydb.Dispose();
			displayType = 2;
		}

		private void lnkbtnFinished_Click(object sender, System.EventArgs e)
		{
			this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton2.gif");
			this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[1].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,3));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
		//	setgrid();
			mydb.Dispose();
			displayType = 3;
		}

		private void lnkbtnNew_Click(object sender, System.EventArgs e)
		{
			//Response.Redirect("Manage.aspx");
		}

		

		
	}
}

⌨️ 快捷键说明

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