📄 shops_add.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_shops_add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["shang_admin"] == null)
{
Response.Redirect("get_your_passport.aspx");
}
DateTime timenow = DateTime.Now;
TextBox6.Text = timenow.ToString();
this.TextBox2.Style.Add("display", "none");
this.eWebEditor1.Attributes.Add("src", "editor/ewebeditor.htm?id=TextBox2&style=gray");
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
Response.Redirect("shops_manage.aspx");
}
else
{
try
{
SqlConnection con = db.CreateConnection();
con.Open();
string newid;
string strsql = "insert into shops (shop_name,shop_infor,shop_pic,shop_money,shop_place,sell_time,sell_end_time,seller_name,seller_qq,seller_phone,seller_email,bigclassname,xiangguan,tag) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "','" + TextBox3.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + DropDownList1.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "') SELECT @@IDENTITY as 'bh'";
SqlCommand cmd = new SqlCommand(strsql, con);
newid = cmd.ExecuteScalar().ToString();
con.Close();
string template;
SqlConnection con1 = db.CreateConnection();
con1.Open();
string strsql1 = "select * from example";
SqlDataAdapter ad1 = new SqlDataAdapter(strsql1, con1);
DataSet ds1 = new DataSet();
ad1.Fill(ds1, "bb");
template = ds1.Tables["bb"].Rows[2]["example"].ToString();
template = Regex.Replace(template, "E_name", TextBox1.Text);
template = Regex.Replace(template, "E_infor", TextBox2.Text);
template = Regex.Replace(template, "E_pic", TextBox4.Text);
template = Regex.Replace(template, "E_money", TextBox3.Text);
template = Regex.Replace(template, "E_place", TextBox5.Text);
template = Regex.Replace(template, "E_sell_time", TextBox6.Text);
template = Regex.Replace(template, "E_sell_end_time", TextBox7.Text);
template = Regex.Replace(template, "E_seller_name", TextBox8.Text);
template = Regex.Replace(template, "E_seller_qq", TextBox9.Text);
template = Regex.Replace(template, "E_seller_phone", TextBox10.Text);
template = Regex.Replace(template, "E_seller_email", TextBox11.Text);
template = Regex.Replace(template, "E_fenlei", DropDownList1.Text);
template = Regex.Replace(template, "E_num", newid);
StreamWriter sw = File.CreateText(Server.MapPath("../shops/" + DropDownList1.Text + "/" + newid + ".aspx"));
sw.Write(template);
sw.Close();
con1.Close();
Response.Redirect("shops_manage.aspx?bigclassname=" + DropDownList1.Text + "");
}
catch (Exception ee)
{
Response.Write("Some thing Error happend->SHOPS SYSTEM INSERT ERROR:you can enter <a href='http://www.shangducms.cn'>shangducms.cn</a> to find more information." + ee.ToString());
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -