📄 apply_add.aspx.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 HRAdmin.BLL ;
using HRAdmin.COMMON ;
namespace HRAdmin.USL
{
/// <summary>
/// Apply_Add 的摘要说明。
/// </summary>
public class Apply_Add : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Button b_Add;
private Apply_Info info = null ;
private PersonnelInfo pi = null ;
private void Page_Load(object sender, System.EventArgs e)
{
pi = HRAdminGlobals.LoginUsr ;
if(pi == null)
{
//页面重定向到登录页面
CommHandler.ReDirURL(Page) ;
}
//找到申请信息的用户控件
info = (Apply_Info)this.Page.FindControl("AI") ;
if(!IsPostBack)
{
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.b_Add.Click += new System.EventHandler(this.b_Add_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
/// <summary>
/// 添加申请信息
/// </summary>
/// <returns>新申请信息的ID</returns>
private int Add()
{
//实例一个申请信息对象
ApplyInfo ai = new ApplyInfo() ;
//绑定申请信息
info.BindInfo(ai) ;
//绑定提交人信息和提交日期
ai.PersID = pi.PersonnelID ;
ai.DeptID = pi.DeptID ;
ai.PutDate = System.DateTime.Today ;
//调用添加新申请信息的方法
return ai.AddApply() ;
}
private void b_Add_Click(object sender, System.EventArgs e)
{
//数据检测
if(info.a_ApplyID != "")
{
COMMON.CommHandler.Alert(Page,"该记录已经添加到数据库!") ;
return ;
}
//调用添加函数
int id = Add() ;
if( id > 0 )
{
info.a_ApplyID = id.ToString() ;
COMMON.CommHandler.Alert(Page,"新申请提交成功!") ;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -