📄 addareafac.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class admin_Default2 : System.Web.UI.Page
{
BaseClass bc = new BaseClass();//定义一个公共类的实例
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["UID"]) == "")
{
Response.Redirect("login.aspx");
}
if (!IsPostBack)
{
this.bind();
}
}
protected void bind()
{
bc.ExecDropDownList(ddl, "select * from type where type = 'Area'", "Name", "code");
}
protected void Button1_Click(object sender, EventArgs e)
{
string sql = "select count(*) from areaFacility where unitName='" + TextBox1.Text.Trim() + "'";
int count=(int)bc.ExecCscalar(sql);
if (count > 0)
{
Response.Write("<script language=javascript>alert('添加失败,存在相同的公共设施!')</script>");
return;
}
string sqlstr = "insert into areaFacility (unitName,mainHead,contactPerson,tel,typeID,memo)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + ddl.SelectedValue + "','" + FreeTextBox1.Text + "')";
//Response.Write(sqlstr);
//Response.End();
if (bc.ExecSql(sqlstr))
{
Response.Write("<script language=javascript>alert('添加公共设施成功!');location='areafacility.aspx'</script>");
}
else
{
Response.Write("<script>alert('添加失败,请重试!');</script>");
}
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
FreeTextBox1.Text = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -