admin/Product/ProductAdd.aspx.cs

(开头部分) 10KB

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

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 SystemProduct;
using SystemProductSort;
using SystemBll;
using NT.Common;
using System.Drawing;
public partial class admin_Product_ProductAdd : System.Web.UI.Page
{
    BLL bll = new BLL();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Binddll();
        }
    }
    public void Binddll()
    {
      ddlclass.DataSource=  ProductSort.GetMsg();
      ddlclass.DataTextField = "psname";
      ddlclass.DataValueField = "id";
      ddlclass.DataBind();
    }
    public static string GetNewFileName(string FileName)
    {//跟据文伯名产生一个由时间+随机数组成的一个新的文件名 
        string newfilename = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString()
        + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString()
        + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString()
        + DateTime.Now.Millisecond.ToString()
            //+ rand.Next(1000).ToString() 
        + FileName.Substring(FileName.LastIndexOf("."), FileName.Length - FileName.LastIndexOf("."));
        return newfilename;
    }
    //上传图片
    private string UploadFile(FileUpload FileUpload1)
    {
        string sResult = "";
        try
        {
            //判断是否已经选取文件
            if (FileUpload1.HasFile)
            {
                string ProductImg = GetNewFileName(FileUpload1.FileName);
                string savePath = Server.MapPath("~/admin/upphoto/") + ProductImg;
                FileUpload1.PostedFile.SaveAs(savePath);
                sResult = ProductImg;
            }
            else
            {
                MessageBox.Show(Page, "请选择大图片!");
            }
后面还有 205 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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