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

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

计算机毕业设计介绍:

5.4  制壶名家管理
此模块可以维护制壶名家信息列表,对制壶专家进行添加、修改、删除的操作。

以下是引用片段:

核心代码如下:
        protected void Button1_Click(object sender, EventArgs e)
    {
        //判断信息是否正确
        if (this.txtXM.Text.Trim() == "")
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ifo", "alert('姓名不能为空!');");
            return;
        }

        //将相关的图片上传到@"Image\"路径下
        string FileName = "";
        string FileName1;
        string DPath;
        DPath = Server.MapPath("") + @"\";
        DPath = DPath + @"..\image\person\";
        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());
                }
            }
        }

        //根据标志判断是添加还是修改的操作 保存商品信息
        if (Request.QueryString["ID"] != null)
        {
            string FilePhoto = "";
            if (FileName != "")
            {
                FilePhoto = ",代表作图片='" + FileName + "'";
            }
            DataBase.ExecSql("UPDATE [制壶名家] set [姓名] ='" + txtXM.Text + "'" + FilePhoto + ",[性别] = '" + rbXB.SelectedValue + "',[所属年代] ='" + drSSND.SelectedValue + "',[名家介绍] = '" + txtMJJS.Text + "',[代表作] = '" + txtDBZMC.Text + "' WHERE 名家编号=" + Request.QueryString["ID"]);
        }
        else
        {
            DataBase.ExecSql("INSERT INTO [制壶名家] ([姓名] ,[性别] ,[所属年代] ,[名家介绍] ,[代表作] ,[代表作图片] ) VALUES ('"+txtXM.Text+"','"+rbXB.SelectedValue+"','"+drSSND.SelectedValue+"','"+txtMJJS.Text+"','"+txtDBZMC.Text+"','"+FileName+"')");

        }


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

第8页为计算机毕业论文用户注册功能介绍......

【联系方式】

【本站信誉】

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