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

📄 addattendanceexplain.aspx.cs

📁 办公室系统包括上下班打卡
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Platform_AddAttendanceExplain : System.Web.UI.Page
{
	private string attendanceDate;
	protected void Page_Load(object sender,EventArgs e)
	{	///判断用户是否登录
		UserSessionValue usv = (UserSessionValue)SessionKeyValue.GetUserSession(Session);
		if(usv == null)
		{   ///返回到上一个页面
			Response.Write("<script>history.back()</script>");
			///跳转到登录页面
			Server.Transfer("~/Common/UserLogin.aspx");
			return;
		}   ///获取添加解释说明所在的日期
		if(Request.Params["AttendanceDate"] != null)
		{   ///获取考勤的日期
			attendanceDate = Request.Params["AttendanceDate"].ToString();
			lbDate.Text = attendanceDate;
		}		
		if(Request.Params["AttendanceID"] != null)
		{
			if(SystemOperation.StringNullChecked(Request.Params["AttendanceID"].ToString()) == false)
			{
				ViewState["AttendanceID"] = Int32.Parse(Request.Params["AttendanceID"].ToString());
			}			
		}
		if(!Page.IsPostBack)
		{
			ViewState["AttendanceID"] = AddNoNormalAttendance();
		}
		///设置添加按钮的可用性
		btnAddAndReturn.Enabled = ViewState["AttendanceID"] == null ? false : true;
	}

	private int AddNoNormalAttendance()
	{   ///获取用户登录信息
		UserSessionValue usv = (UserSessionValue)SessionKeyValue.GetUserSession(Session);
		if(usv == null)
		{
			return 0;
		}
		///执行添加操作
		Attendance attendance = new Attendance();
		return(attendance.AddNoNormalAttendance(
			DateTime.Parse(attendanceDate),
			Int32.Parse(usv.UserID))
			);
	}

	protected void btnAddAndReturn_Click(object sender,EventArgs e)
	{   ///执行添加操作
		if(ViewState["AttendanceID"] != null)
		{
			Attendance attendance = new Attendance();
			if(attendance.AddAttendanceExplain(
				Int32.Parse(ViewState["AttendanceID"].ToString()),
				tbDesn.Text) > 0)
			{   ///显示提示信息
				SystemOperation.OpenDialog(Response,"添加考勤的解释说明成功……");
				///返回到管理页面
				Server.Transfer("~/Platform/ViewAttendance.aspx");
			}
		}
	}
	protected void btnReturn_Click(object sender,EventArgs e)
	{   ///返回到管理页面
		Server.Transfer("~/Platform/ViewAttendance.aspx");
	}
}

⌨️ 快捷键说明

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