📄 class_manage.aspx.cs
字号:
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Data;
using System.Runtime;
using System.Data.SqlClient;
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_class_manage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["shang_admin"] == null)
{
Response.Redirect("get_your_passport.aspx");
}
if (!IsPostBack)
{
Label1.Text = "你可以轻易的创建或更新文件夹,但是最好以英文或拼音形式命名分类名称!";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
if (!Directory.Exists(Server.MapPath("../articls/" + TextBox1.Text + "")))
{
DirectoryInfo dirinfo = Directory.CreateDirectory(Server.MapPath("../articls/" + TextBox1.Text + ""));
SqlConnection con = db.CreateConnection();
con.Open();
string strsql = "insert into bigclass (bigclassname) values ('" + TextBox1.Text + "') ";
SqlCommand cmd = new SqlCommand(strsql, con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("class_manage.aspx");
}
else
{
Label1.Text = "已存在此分类的文件夹或分类!";
}
}
else
{
Label1.Text = "新闻分类名称不许为空!";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (TextBox2.Text != "")
{
if (!Directory.Exists(Server.MapPath("../downloads/" + TextBox2.Text + "")))
{
DirectoryInfo dirinfo = Directory.CreateDirectory(Server.MapPath("../downloads/" + TextBox2.Text + ""));
SqlConnection con = db.CreateConnection();
con.Open();
string strsql = "insert into download_class (classname) values ('" + TextBox2.Text + "') ";
SqlCommand cmd = new SqlCommand(strsql, con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("class_manage.aspx");
}
else
{
Label1.Text = "已存在此分类的文件夹或分类!";
}
}
else
{
Label1.Text = "下载分类名称不许为空!";
}
}
protected void Button3_Click(object sender, EventArgs e)
{
if (TextBox3.Text != "")
{
if (!Directory.Exists(Server.MapPath("../shops/" + TextBox3.Text + "")))
{
DirectoryInfo dirinfo = Directory.CreateDirectory(Server.MapPath("../shops/" + TextBox3.Text + ""));
SqlConnection con = db.CreateConnection();
con.Open();
string strsql = "insert into shop_class (classname) values ('" + TextBox3.Text + "')";
SqlCommand cmd = new SqlCommand(strsql, con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("class_manage.aspx");
}
else
{
Label1.Text = "已存在此分类的文件夹或分类!";
}
}
else
{
Label1.Text = "商城分类名称不许为空!";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -