admin/product/updatepro.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

public partial class admin_product_updatepro : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strSQL = "select * from Product where ProductId=" + Convert.ToInt32(Request.QueryString["Id"]);
            DataTable dt = MyClass.OfflineSelect(strSQL);
            txtName.Text = Server.HtmlDecode(dt.Rows[0]["ProductName"].ToString()).Replace("<br>", "\r\n");
            DropDownList1.SelectedValue = dt.Rows[0]["TypeId"].ToString();
            txtPrice.Text = dt.Rows[0]["ProductPrice"].ToString();
            txtIntro.Text=Server.HtmlDecode(dt.Rows[0]["ProductContent"].ToString()).Replace("<br>", "\r\n");
            Image1.ImageUrl="~/Product/"+dt.Rows[0]["ProductImg"].ToString();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strSQL = "";
        string strName = Server.HtmlEncode(txtName.Text);
        strName = strName.Replace("\r\n", "<br>");
        strName = strName.Replace("'", "''");
        strName = strName.Replace(" ", "&nbsp;");

        string strIntro = Server.HtmlEncode(txtIntro.Text);
        strIntro = strIntro.Replace("\r\n", "<br>");
        strIntro = strIntro.Replace("'", "''");
        strIntro = strIntro.Replace(" ", "&nbsp;");

        string fPrice = Server.HtmlEncode(txtPrice.Text);
        fPrice = fPrice.Replace("\r\n", "<br>");
        fPrice = fPrice.Replace("'", "''");
        fPrice = fPrice.Replace(" ", "&nbsp;");

        if (FileUpload1.HasFile)
        {
            string strExtention = System.IO.Path.GetExtension(FileUpload1.FileName);
            string strFileName = DropDownList1.SelectedItem.Text + DateTime.Now.ToString("yyMMddHHmmss");
            FileUpload1.SaveAs(Server.MapPath("../../product/image/" + strFileName + strExtention));

            File.Delete(Server.MapPath(Image1.ImageUrl));

            strSQL = "update Product set ProductName='" + strName + "',TypeId='" + DropDownList1.SelectedValue.ToString() + "',ProductPrice='" + txtPrice.Text + "',ProductContent='" + strIntro + "',ProductImg='image/" + strFileName + strExtention + "' where ProductId=" + Request.QueryString["Id"];
        }
        else
            strSQL = "update Product set ProductName='" + strName + "',TypeId='" + DropDownList1.SelectedValue.ToString() + "',ProductPrice='" + txtPrice.Text + "',ProductContent='" + strIntro + "' where ProductId=" + Request.QueryString["Id"];
        if (MyClass.ExecuteSql(strSQL) > 0)
后面还有 10 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。