📄 edit_messagesort.aspx.cs
字号:
/**************************************************************************************
作者:蒲丰.
创建日期:2003-11-12
修改者:
修改日期:
修改部分:
类功能: 信息类别管理的增加,修改,流缆功能.
****************************/
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 OI.DatabaseOper ;
namespace OI.Messagemanage
{
/// <summary>
/// Edit_MessageSort 的摘要说明。
/// </summary>
public class Edit_MessageSort : OI.PageBase
{
protected System.Web.UI.WebControls.TextBox TextBoxInfotypeName;
protected System.Web.UI.WebControls.DropDownList DropDownListIsPublic;
protected System.Web.UI.WebControls.TextBox TextBoxDescription;
DatabaseConnect Dbc =new DatabaseConnect ();
string op;
string InfotypeID;
protected System.Web.UI.WebControls.Label LabelInfotypeName;
protected System.Web.UI.WebControls.Label LabelIsPublic;
protected System.Web.UI.WebControls.Label LabelDescription;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.ImageButton ImageButton2;
protected System.Web.UI.WebControls.Label Labeltitle;
protected DataSet ds;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
op=Request.QueryString ["op"].ToString ();
InfotypeID=Request.QueryString ["id"].ToString ();
//ButtonOK.Attributes["onclick"]="return check()";
if (Page.IsPostBack )
{
}
else
{
switch (op)
{
case "view" :
View();
Labeltitle.Text="查看信息类别";
break;
case "modify" :
Modify();
Labeltitle.Text ="修改信息类别";
break ;
case "new" :
//New();
Labeltitle.Text="新增信息类别";
break;
default :
return;
}
}
}
/// <summary>
/// 用户点查看时调用函数
/// </summary>
private void View()
{
DisplayDefalutData();
TextBoxInfotypeName.Visible =false;
DropDownListIsPublic.Visible =false;
TextBoxDescription.Visible =false;
LabelDescription.Height=96;
ImageButton1.Visible =false;
ImageButton2.Visible=true;
}
private void Modify()
{
LabelInfotypeName.Visible =false;
LabelIsPublic.Visible =false;
LabelDescription.Visible =false;
ImageButton2.Visible=false;
DisplayDefalutData();
}
/// <summary>
/// 显示默认数据,等待操作.
/// </summary>
private void DisplayDefalutData()
{
string sql=" select * from infotype where InfotypeID="+InfotypeID;
ds=new DataSet ();
ds=Dbc.getBinding (sql,"s");
LabelInfotypeName.Text =ds.Tables[0].Rows[0]["InfotypeName"].ToString ();
TextBoxInfotypeName.Text=ds.Tables[0].Rows[0]["InfotypeName"].ToString ();
string ispublic="0";
LabelIsPublic.Text ="禁用";
if (ds.Tables[0].Rows[0]["IsPublic"].ToString ()=="True")
{
ispublic="1";
LabelIsPublic.Text ="启用";
}
DropDownListIsPublic.Items.FindByValue(ispublic).Selected =true;
TextBoxDescription.Text =ds.Tables[0].Rows[0]["Description"].ToString ();
LabelDescription.Text=ds.Tables[0].Rows[0]["Description"].ToString ().Replace("\r\n","<br/>") ;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ButtonOK_Click(object sender, System.EventArgs e)
{
}
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
TextBoxInfotypeName.Text =Dbc.ReplaceDYH (TextBoxInfotypeName.Text);
TextBoxDescription.Text =Dbc.ReplaceDYH (TextBoxDescription.Text);
string str="";
if (op=="modify")
{
str="update infotype set InfotypeName='"+TextBoxInfotypeName.Text +"',Description='"+TextBoxDescription.Text +"',IsPublic="+DropDownListIsPublic.SelectedValue +" where InfotypeID="+ InfotypeID ;
}
if(op=="new")
{
str="insert into infotype values('"+TextBoxInfotypeName.Text +"','"+TextBoxDescription.Text +"',"+DropDownListIsPublic.SelectedValue +")";
}
Dbc.ExecuteSQL (str);
Response.Redirect ("MessageSortManage.aspx");
}
private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect ("MessageSortManage.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -