taskmod.aspx.cs
来自「ASP.NET的一些开发实例,有论坛管理系统等」· CS 代码 · 共 123 行
CS
123 行
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.task
{
/// <summary>
/// TaskMod 的摘要说明。
/// </summary>
public class TaskMod : WorkGroupManager.WebFormBase
{
protected System.Web.UI.WebControls.TextBox tbName;
protected System.Web.UI.WebControls.CheckBox cbShare;
protected System.Web.UI.WebControls.TextBox tbContent;
protected System.Web.UI.WebControls.TextBox tbRemark;
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.RangeValidator RangeValidator2;
protected System.Web.UI.WebControls.Label lbNo;
protected System.Web.UI.WebControls.LinkButton datacheck;
protected System.Web.UI.WebControls.Label lbExecutor;
protected Task.TaskService ts=new Task.TaskService();
protected System.Web.UI.WebControls.TextBox tbDate;
protected System.Web.UI.WebControls.TextBox tbEndDate;
protected System.Web.UI.WebControls.CheckBox cbScan;
protected System.Web.UI.WebControls.Label lbPromulgator;
protected Task.task task=new Task.task();
private void Page_Load(object sender, System.EventArgs e)
{
this.VerifyPage();
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
this.task=this.ts.GetTask(this.GetCurrentPks(this,true));
this.lbNo.Text=this.task.tNo;
this.lbExecutor.Text=this.task.tExecutor;
this.tbContent.Text=this.task.tContent;
this.tbDate.Text=this.task.tDate.ToString("yyyy-MM-dd");
this.tbEndDate.Text=this.task.tEndDate.ToString("yyyy-MM-dd");
this.tbName.Text=this.task.tName;
this.lbPromulgator.Text=this.task.tPromulgator;
this.tbRemark.Text=this.task.tRemark;
if(this.task.tShare=="1")
this.cbShare.Checked=true;
else if(this.task.tShare=="0")
this.cbShare.Checked=false;
if(this.task.tScan=="1")
this.cbScan.Checked=true;
else if(this.task.tScan=="0")
this.cbScan.Checked=false;
}
}
#region Web Form Designer generated code
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.task.tNo=this.lbNo.Text;
this.task.tDate=DateTime.Parse(this.tbDate.Text);
this.task.tContent=this.tbContent.Text;
this.task.tExecutor=this.lbExecutor.Text;
this.task.tPromulgator=this.lbPromulgator.Text;
this.task.tName=this.tbName.Text;
this.task.tEndDate=DateTime.Parse(this.tbEndDate.Text);
this.task.tRemark=this.tbRemark.Text;
if(this.cbScan.Checked==true)
this.task.tScan="1";
else
this.task.tScan="0";
if(this.cbShare.Checked==true)
this.task.tShare="1";
else
this.task.tShare="0";
if(this.ts.ModTask(this.task))
{
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 + -
显示快捷键?