ASP.NET古董鉴赏管理网站(6)

来源:xiaoniu168.com 作者:本站原创 添加时间:2012-01-05 点击数:21561

计算机毕业设计信息维护功能介绍:

5.3  紫砂壶信息维护界面
此模块主要是对紫砂壶信息的维护。展示紫砂壶信息列表,可以添加 修改 和删除紫砂壶信息。

以下是引用片段:

核心代码如下:
protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            Session.Remove("imgname");
            Session.Remove("swf");
            //绑定类别列表
            this.drSSFL.DataTextField = "分类";
            this.drSSFL.DataValueField = "分类编号";
            this.drSSFL.DataSource = DataBase.Get_Table("select (B.分类名称 + '-->' +  A.分类名称) as 分类,A.分类编号 from dbo.紫砂壶分类 A left join dbo.紫砂壶分类 B on A.上级分类编号=B.分类编号 where A.上级分类编号 is not null ");
            this.drSSFL.DataBind();

            if (Request.QueryString["ID"] != null)
            {
                //显示当前的商品信息
                DataTable tmpda = new DataTable();
                tmpda = DataBase.Get_Table("select * from 紫砂壶信息 where 紫砂壶编号=" + Request.QueryString["ID"]);
                if (tmpda.Rows.Count > 0)
                {
                    this.txtZSHMC.Text = tmpda.Rows[0]["紫砂壶名称"].ToString();
                    this.txtZSHMS.Text = tmpda.Rows[0]["紫砂壶描述"].ToString();
                    Image1.ImageUrl = "../image/zsh/" + tmpda.Rows[0]["图片文件名"].ToString();
                    Session["imgname"] = tmpda.Rows[0]["图片文件名"].ToString();
                    this.txtSCJG.Text = tmpda.Rows[0]["紫砂壶市场价格"].ToString();
                    this.drSSFL.SelectedValue = tmpda.Rows[0]["小类型编号"].ToString();
                    Session["swf"] = tmpda.Rows[0]["紫砂壶动画"].ToString();
                }
            }
        }

protected void Button1_Click(object sender, EventArgs e)
    {
        //判断信息是否正确
        if (this.txtZSHMC.Text.Trim() == "")
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "info", "");           
            return;
        }

        //将相关的图片上传到@"Image\"路径下
        string FileName = "";
        string FileName1;
        string DPath;
        DPath = Server.MapPath("") + @"\";
        DPath = DPath + @"..\image\zsh\";
        if (this.FileTP.PostedFile.FileName != "")
        {
            string[] temp = this.FileTP.PostedFile.FileName.Split('.');
            string strHzm = "." + temp[temp.Length - 1];

            Guid tmp = Guid.NewGuid();
            FileName = tmp.ToString() + strHzm;
            FileName1 = DPath + tmp.ToString() + strHzm;
            this.FileTP.PostedFile.SaveAs(FileName1);
            if (Session["imgname"] != null)
            {
                if (File.Exists(DPath + Session["imgname"].ToString()))
                {
                    File.Delete(DPath + Session["imgname"].ToString());
                }
            }
        }

〖资料来源:计算机毕业论文 www.xiaoniu168.com

第7页为计算机毕业论文......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网