📄 position_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>
/// Position_Add 的摘要说明。
/// </summary>
public class Position_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 Position_Info info = null ;
private void Page_Load(object sender, System.EventArgs e)
{
//找到职位信息用户控件
info = (Position_Info)this.Page.FindControl("PI") ;
}
#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()
{
//实例一个申请信息对象
PositionInfo pi = new PositionInfo() ;
//绑定申请信息
info.BindInfo(pi) ;
//调用添加新申请信息的方法
return pi.AddPosition() ;
}
private void b_Add_Click(object sender, System.EventArgs e)
{
//数据检测
if(info.a_PosID != "")
{
COMMON.CommHandler.Alert(Page,"该记录已经添加到数据库!") ;
return ;
}
//添加职位信息
int id = Add() ;
if( id > 0 )
{
//添加成功
info.a_PosID = id.ToString() ;
CommHandler.Alert(Page,"新选项资料添加成功!") ;
}
else if(id==-1)
{
//数据库中已存在该下拉框类型和下拉框ID的数据,添加失败
CommHandler.Alert(Page,"该下拉框类型和下拉框ID的静态数据已存在!") ;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -