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

📄 tasklist.aspx.cs

📁 用dot net 构建的可以商用的办公自动化软件
💻 CS
📖 第 1 页 / 共 3 页
字号:
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		
		}


	

		private void lnkbtnToday_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			this.btnCancelSubscription.Visible = false;
			this.btnCancel.Visible = true;
			displayType = 1;
			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");
			this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			mydb.Dispose();
			
		}

		private void lnkbtnHistory_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			this.btnCancelSubscription.Visible = false;
			this.btnCancel.Visible = true;
			displayType = 2;
			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");
			this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			setgrid();
			mydb.Dispose();
			
		}

		private void lnkbtnFinished_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			this.btnCancelSubscription.Visible = false;
			this.btnCancel.Visible = false;
			displayType = 3;
			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");
			this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			//	setgrid();
			mydb.Dispose();
			
		}

		private void btnAccept_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			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='TaskList.aspx';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		}

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			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='TaskList.aspx';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		}

		private void btnFinish_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			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='TaskList.aspx';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		}

		public void listStaff_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Session["Username"]=this.listStaff.SelectedItem .Value.ToString();
			string Username = (string)Session["Username"];
			string ActualUsername = (string)Session["ActualUsername"];
			if(this.btnWeeklyView.Text == "周览")
			{
				Response.Redirect("TaskList.aspx?displayType=1");
			}
			else
			{
				this.lnkbtnFinished .Enabled = false;
				this.lnkbtnHistory .Enabled  = false;
				this.lnkbtnToday .Enabled	 = false;
				this.Linkbutton1.Enabled	 = false;
				this.btnAccept .Enabled		 = false;
				this.btnCancel.Enabled	     = false;
				this.btnNew .Enabled		 = false;
				this.btnWeeklyView .Text = "返回";
				PopulateWeeklyData();
				SetStatus();
				this.btnSubscribe .Enabled			 = false;
				
			}


		}

		private void btnSubscribe_Click(object sender, System.EventArgs e)
		{
			string Username = (string)Session["Username"];
			string ActualUsername = (string)Session["ActualUsername"];
			string ids = "";
			Task task = new Task();
			foreach(DataGridItem dgi in this.dgList .Items)
			{
				CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
				Label  lb=(Label)(dgi.Cells[1].Controls[3]);
				if (cb.Checked==true)
				{
					try
					{
						ids = dgList.DataKeys[dgi.ItemIndex].ToString();
						if(task.AddTaskSubscription(ActualUsername,Username,Int32.Parse(ids),Convert.ToDateTime(lb.Text.ToString()).ToShortDateString()))
						Response.Write("<script language=javascript>alert('订阅成功!');window.location='TaskList.aspx?displayType="+displayType.ToString()+"';</script>");
					}
					catch(Exception dbex)
					{
						UDS.Components .Error.Log(dbex.ToString());
						Server.Transfer("../Error.aspx");
					}
					
				}	
			}
			
				
		}

		

		private void Linkbutton1_Click(object sender, System.EventArgs e)
		{
			string ActualUsername = (string)Session["ActualUsername"];
			string Username = (string)Session["Username"];
			this.btnCancelSubscription.Visible = (ActualUsername.ToLower()==Username.ToLower());
			displayType = 4;
			this.tblContainer.Rows[0].Cells[3].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");
			this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			//	setgrid();
			mydb.Dispose();
		
		}

		private void btnWeeklyView_Click(object sender, System.EventArgs e)
		{
			if(this.btnWeeklyView .Text == "周览")
			{
			
				this.lnkbtnFinished .Enabled = false;
				this.lnkbtnHistory .Enabled  = false;
				this.lnkbtnToday .Enabled	 = false;
				this.Linkbutton1.Enabled	 = false;
				this.btnAccept .Enabled		 = false;
				this.btnCancel.Enabled	     = false;
				this.btnNew .Enabled		 = false;
				this.lnkbtnArranged.Enabled  = false;
				this.btnWeeklyView .Text	 = "返回";
				PopulateWeeklyData();
			}
			else if(this.btnWeeklyView .Text == "返回")
			{
				this.lnkbtnFinished .Enabled = true;
				this.lnkbtnHistory .Enabled  = true;
				this.lnkbtnToday .Enabled	 = true;
				this.Linkbutton1.Enabled	 = true;
				this.lnkbtnArranged .Enabled = true;
				this.btnAccept .Enabled		 = true;
				this.btnCancel.Enabled	     = true;
				this.btnNew .Enabled		 = true;
				this.lblInstru .Visible      = true;
				this.btnWeeklyView .Text	 = "周览";
				InitData();
			}
			SetStatus();
			
		}

		private void btnCancelSubscription_Click(object sender, System.EventArgs e)
		{
			string ActualUsername = (string)Session["ActualUsername"];
			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.DeleteTaskSubscription(ActualUsername,ids);
					
					Response.Write("<script language=javascript>alert('操作成功!');window.location='TaskList.aspx?displayType="+displayType+"';</script>");
					//Response.AddHeader("Refresh","1");
				}
				catch(Exception ex)
				{
					UDS.Components .Error.Log(ex.ToString());
					Server.Transfer("../Error.aspx");
				}
			}
		}

		private void lnkbtnArranged_Click(object sender, System.EventArgs e)
		{
			string ActualUsername = (string)Session["ActualUsername"];
			string Username = (string)Session["Username"];
			//this.btnCancelSubscription.Visible = (ActualUsername.ToLower()==Username.ToLower());
			this.btnCancelSubscription.Visible = false;
			this.btnCancel.Visible = false;
			displayType = 5;
			this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.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");
			this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif");
			this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton2.gif");
			Task task = new Task();
			DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
			this.dgList .DataSource = mydb.DefaultView;
			this.dgList.DataBind();
			//	setgrid();
			mydb.Dispose();
		
		}

	
	}
}

⌨️ 快捷键说明

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