Admin/GoodsManager.aspx.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class GoodsManager : System.Web.UI.Page
{
    public static string fname;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = DBHelper.GetDataSet("select * from tb_GoodsType");
            this.DropDownList1.DataTextField = "TypeName";
            this.DropDownList1.DataValueField = "TypeID";
            this.DropDownList1.DataSource = ds.Tables[0];
            this.DropDownList1.DataBind();
            if (Request["ID"] != null)
            {
                InitData();
            }
        }

    }
    protected void InitData()
    {
        string id = Request["ID"].ToString();
        try
        {
            string sql = "select * from View_1 where GoodsID=" + id;
            DataTable dt = DBHelper.GetDataSet(sql).Tables[0];
            if (dt.Rows.Count > 0)
            {
                this.TextBox1.Text = dt.Rows[0]["GoodsName"].ToString();
                this.TextBox2.Text = dt.Rows[0]["Price"].ToString();
                this.TextBox3.Text = dt.Rows[0]["Introduce"].ToString();
                this.DropDownList1.SelectedItem.Value = dt.Rows[0]["TypeID"].ToString();
                fname = dt.Rows[0]["GoodsPicture"].ToString();
                this.Image1.ImageUrl = "../" + fname;
            }
        }
        catch
        {
        }
    }
    private void FileUpLoad()
    {
        if (UploadFile.Value != null)
        {
            string nam = UploadFile.PostedFile.FileName;
            //取得文件名(抱括路径)里最后一个"."的索引
            int i = nam.LastIndexOf(".");
            //取得文件扩展名
            string newext = nam.Substring(i);
            //这里我自动根据日期和文件大小不同为文件命名,确保文件名不重复
            DateTime now = DateTime.Now;
            string newname = now.ToFileTimeUtc() + UploadFile.PostedFile.ContentLength.ToString();
后面还有 52 行代码,购买后查看完整代码

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

AI 解读 AI

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

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