📄 notice_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 functionClass;
namespace jpgSoftware_SM.i
{
/// <summary>
/// notice_Add 的摘要说明。
/// </summary>
public class notice_Add : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList belongTo;
protected System.Web.UI.WebControls.Button saveBtn;
DataBaseLink db = new DataBaseLink();
protected System.Web.UI.WebControls.TextBox noticeTitle;
protected System.Web.UI.WebControls.TextBox noticeContents;
protected System.Web.UI.WebControls.DropDownList noticeGrade;
dbLable dbAction = new dbLable();
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack);
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void saveBtn_Click(object sender, System.EventArgs e)
{
try
{
if(this.noticeTitle.Text.Trim()=="" && this.noticeContents.Text.Trim()=="")
{
Response.Write("<script>alert('请填写标题和公告内容!');</script>");
return;
}
int maxID = dbAction.getmaxID("formid","oa_notice");
string sql = "insert into oa_notice(formid,title,contents,employeeID,crdate,grade,status)values("+maxID+",'"+this.noticeTitle.Text.Trim()+"','"+this.noticeContents.Text.Trim()+"','"+Session["employeeid"].ToString().Trim()+"','"+System.DateTime.Now.ToString().Trim()+"','"+this.noticeGrade.SelectedItem.Text.ToString().Trim()+"','N')";
db.ExecuteTransaction(sql);
Response.Write("<script>alert('发布公告成功!');window.close();</script>");
}
catch(Exception ex)
{
Response.Write("<script>alert('"+ex.Message.ToString().Trim()+"');</script>");
return;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -