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

📄 dailyreport.aspx.cs

📁 人事管理系统的WEB开发程序源代码,有住于WEB开发的学习
💻 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;
using DBUtils;

namespace BlueHill.Attendance
{
	/// <summary>
	/// DailyReport 的摘要说明。
	/// </summary>
	public class DailyReport : System.Web.UI.Page
	{
		public Employee emp;
		protected System.Web.UI.WebControls.Panel pnlPageFix;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label lblToday;
		protected System.Web.UI.WebControls.Panel pnlToday;
		protected System.Web.UI.WebControls.Label lblDept;
		protected System.Web.UI.WebControls.DropDownList cmbDeptList;
		protected System.Web.UI.WebControls.Button btnSearch;
		protected System.Web.UI.WebControls.Panel pnlChooseDept;
		protected System.Web.UI.WebControls.Label lblMessage;
		protected System.Web.UI.WebControls.DataGrid grdResult;
		protected System.Web.UI.WebControls.Label lblDeptID;
		protected System.Web.UI.WebControls.Panel pnlBody;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			lblToday.Text = DateTime.Now.ToLongDateString().ToString();
			if(!Page.IsPostBack)
			{
				
				int iEmpID;
				iEmpID = Convert.ToInt32(Session["EmployeeID"].ToString());
				int iRetValue;
				DataSet dsResult = new DataSet();

				emp = new Employee();
				//执行数据库操作
				iRetValue=Employee.GetEmployeeInfo(iEmpID,emp);
			
				if( iRetValue == (int) DBResult.Success ) 
				{
					int iCEOID = 0;
					int iRetValue1 = Employee.GetCEOInfo(ref iCEOID);
					if(iRetValue1== 0) 
					{
						this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
					}
					else
					{
						bool IsManager = emp.IsManager;
						if(IsManager)
						{
							if(iCEOID==emp.EmployeeID)
							{
								int iRetValue2 = DBUtils.Attendance.GetDeptList(ref dsResult);
								if(iRetValue2== 0) 
								{
									this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
								}
								else
								{
									lblDeptID.Text = dsResult.Tables[0].Rows[0]["DeptID"].ToString();
									lblDept.Visible = true;
									DataTable Dept = dsResult.Tables[0];
									this.cmbDeptList.DataSource =Dept;
									this.cmbDeptList.DataTextField = "DeptName";
									this.cmbDeptList.DataValueField = "DeptID";
									this.cmbDeptList.DataBind();
									cmbDeptList.Visible = true;
									btnSearch.Visible = true;
								}
							}
							else
							{
								lblDeptID.Text = emp.DeptID.ToString();
								SearchResult();
							}
						}
						else
						{
							grdResult.Visible = false;
							btnSearch.Visible = false;
							lblDept.Visible = false;
							cmbDeptList.Visible = false;
							this.RegisterStartupScript("out","<script>alert('该功能是经理专用');</script>");
					
						}
					}
				}
				else
				{
					this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
					
				}
			}
		}

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

		}
		#endregion

		protected void SearchResult()
		{
			int iDpetID = Convert.ToInt32(lblDeptID.Text);
			string startTime = Convert.ToDateTime(lblToday.Text.Trim()).ToString();
			string endTime = Convert.ToDateTime(lblToday.Text.Trim()).AddDays(1).ToString();
			DataSet dsResult = new DataSet();
			int iRetValue = DBUtils.Attendance.QueryDailyAttend(iDpetID,startTime,endTime,ref dsResult);
			if(iRetValue == 1) 
			{
				if(dsResult.Tables[0].Rows.Count>0)
				{
					lblMessage.Visible = true;
					grdResult.DataSource = dsResult.Tables[0];
					grdResult.DataBind();
				}
				else
				{
					this.RegisterStartupScript("out","<script>alert('考勤全部合格');</script>");
					lblMessage.Visible = false;
					grdResult.Visible = true;
				}
			}
			else
			{
				this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
				
			}
		}

		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			if(lblDeptID.Text.Trim() =="") this.RegisterStartupScript("out","<script>alert('请选择要查看的部门');</script>");
			else 
			SearchResult();
		}

		private void cmbDeptList_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			
			lblDeptID.Text = cmbDeptList.SelectedValue;
		}
	}
}

⌨️ 快捷键说明

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