workadd.aspx.cs
来自「ASP.NET的一些开发实例,有论坛管理系统等」· CS 代码 · 共 102 行
CS
102 行
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;
namespace WorkGroupManager.work
{
/// <summary>
/// WorkAdd 的摘要说明。
/// </summary>
public class WorkAdd : WorkGroupManager.WebFormBase
{
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.LinkButton datacheck;
protected System.Web.UI.WebControls.TextBox tbEDate;
protected System.Web.UI.WebControls.Label lbTExcutor;
protected System.Web.UI.WebControls.TextBox tbEContent;
protected System.Web.UI.WebControls.Label lbTNO;
protected Work.WorkService ws=new Work.WorkService();
protected Work.work work=new Work.work();
string[] pks;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.VerifyPage();
pks=this.GetCurrentPks(this,true);
try
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
this.lbTNO.Text=pks[0];
this.lbTExcutor.Text=pks[1];
this.tbEDate.Text=System.DateTime.Now.ToShortDateString();
}
}
catch(Exception ex)
{
string str=ex.Message;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.datacheck.Click += new System.EventHandler(this.datacheck_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void datacheck_Click(object sender, System.EventArgs e)
{
try
{
this.work.tNO=this.lbTNO.Text;
this.work.tExecutor=this.lbTExcutor.Text;
this.work.exDate=DateTime.Parse(this.tbEDate.Text.Trim());
this.work.exContent=this.tbEContent.Text;
//this.work.prDate=Convert.ToDateTime("1900-1-1");
this.work.tPromulgator=pks[2].Trim();
this.work.prScan="0";
this.work.exScan="x";
if(this.ws.AddWork(this.work))
{
this.Return(this);
}
else
{
//使用时将下面代码中的"MainModel_1.aspx"改到特定页面的打开页面的URL
Response.Write("<script language=javascript>window.opener.location='../Error.aspx?errmsg=工作记录未能增加成功。';window.close();</script>");
}
}
catch(Exception ex)
{
this.BaseService.Write("工作纪录添加。");
this.BaseService.Write(ex.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?