boguCms/App_Admin/product/addproduct.aspx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using AccessDal;
using System.IO;


public partial class App_Admin_product_addproduct : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GetBdrop();
            GetSdrop(dropBid.SelectedValue.ToString());
        }
        
    }
    protected void GetBdrop()
    {
        dropBid.DataSource = ProBigOpe.GetListBid(0, 0);
        dropBid.DataTextField = "BName";
        dropBid.DataValueField = "ID";
        dropBid.DataBind();
        dropBid.Items.Insert(0, new ListItem("请选择产品大类", "0"));
    }

    protected void GetSdrop(string bid)
    {
        dropMid.DataSource = ProMidOpe.GetList(Convert.ToInt32(bid), 0, 0);
        dropMid.DataTextField = "MName";
        dropMid.DataValueField = "ID";
        dropMid.DataBind();
        dropMid.Items.Insert(0, new ListItem("请选择产品小类", "0"));
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        bool fileOk = false;
        if (FileUpload1.HasFile)
        {
            string fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
            string[] allowedExtensions = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" };
            for (int i = 0; i < allowedExtensions.Length; i++)
            {
                if (fileExtension == allowedExtensions[i])
                {
                    fileOk = true;
                }
            }

            if (fileOk == true && FileUpload1.PostedFile.ContentLength <= 2000000)
            {
                string d = DateTime.Now.ToString("yyyyMMddHHmmss");
                string temppath = Server.MapPath("/userimg/imgs/") + d + fileExtension;
                string mypath = Server.MapPath("/userimg/pro/") + d + fileExtension;
                FileUpload1.SaveAs(temppath);
                Photo.MakeThumbnail(temppath, mypath, 400, 400, "cut");
后面还有 23 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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