ShopingNet/Pages/Background/ProductManage/ProductAdd.aspx.cs

(完整代码) 2KB

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;
using Model;
using System.IO;
using Bll;

public partial class Pages_Background_ProductManage_ProductAdd : System.Web.UI.Page
{
    /// <summary>
    /// 图片操作类的对象声明
    /// </summary>
    upImage imageControl;
    protected void Page_Load(object sender, EventArgs e)
    {
        imageControl = new upImage();
        if (!Page.IsPostBack)
        {
            ProductClassManagment pcm = new ProductClassManagment();
            pcm.GetProductClass(this.dorp_productClassID);
            this.Image2.ImageUrl=@"~\Images\SmallImages\16.jpg";
        }
    }
    protected void bt_ok_Click(object sender, EventArgs e)
    {
        Product newProduct = new Product();
        newProduct.ProductClassID1 = Convert.ToInt32(this.dorp_productClassID.SelectedItem.Value);
        newProduct.ProductContent1 = this.txt_content.Text;
        newProduct.ProductCount1 = Convert.ToInt32(this.txt_count.Text);
        newProduct.ProductImg1 = Path.GetFileName(this.File1.Value);
        newProduct.ProductName1 = this.txt_name.Text;
        newProduct.ProductUnitPrice1 = Convert.ToInt32(this.txt_price.Text);
        ProductMangement pm = new ProductMangement();
        imageControl.SaveSmallImg(Server.MapPath(@"~\Images\SmallImages\") + "\\" + imageControl.GetFileName(this.File1), 212, 202, "", 27, this.File1);
        this.Image2.ImageUrl = @"~\Images\SmallImages\" + "\\" + imageControl.GetFileName(this.File1);
        imageControl.SaveUpFile(Server.MapPath(@"~\Images\ProductsImages\")+ imageControl.GetFileName(this.File1), this.File1);
        if ((pm.ProductAdd(newProduct)) > 0)
        {
            Response.Write("<script>alert('添加产品成功!')</script>");
        }
        else
        {
            Response.Write("<script>alert('添加产品失败!')</script>");
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect(@"..\Main.aspx");
    }
}

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

AI 解读 AI

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

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