ASP.NET网上订餐系统(8)

来源:xiaoniu168.com 作者:本站原创 添加时间:2011-12-16 点击数:32330

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

5.2 餐品信息维护
此模块主要是对餐品信息的维护。展示餐品信息列表,可以添加 修改 和删除餐品信息。

以下是引用片段:

核心代码如下:
    protected void Button1_Click(object sender, EventArgs e)
    {
        //判断信息是否正确
        if (this.TextBox1.Text.Trim() == "")
        {
            Page.ClientScri'餐品名称不能为空!'>");           
            return;
        }

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

            Guid tmp = Guid.NewGuid();
            FileName = tmp.ToString() + strHzm;
            FileName1 = DPath + tmp.ToString() + strHzm;
            this.File1.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)
        {
            if (FileName == "")
            {
                DataBase.ExecSql("update spxx set spmc='" + TextBox1.Text + "', spjg=" + this.Textbox2.Text.Trim() + ",spjs='" + this.Textbox3.Text.Trim() + "',sccj='" + this.Textbox4.Text.Trim() + "',spflbh=" + this.Dropdownlist2.SelectedValue + " where spbh=" + Request.QueryString["ID"]);
            }
            else
            {
                DataBase.ExecSql("update spxx set spmc='" + TextBox1.Text + "',spjg=" + this.Textbox2.Text.Trim() + ",spjs='" + this.Textbox3.Text.Trim() + "',sccj='" + this.Textbox4.Text.Trim() + "',spflbh=" + this.Dropdownlist2.SelectedValue + ",sptpwjm='" + FileName + "' where spbh=" + Request.QueryString["ID"]);
            }
        }
        else
        {
            DataBase.ExecSql("insert into spxx(spmc,sptpwjm,spjs,sccj,spflbh,spjg) values('" + this.TextBox1.Text.Trim() + "','" + FileName + "','" + this.Textbox3.Text.Trim() + "','" + this.Textbox4.Text.Trim() + "'," + this.Dropdownlist2.SelectedValue + "," + Textbox2.Text + ")");

        }

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

第9页为计算机毕业论文订单信息功能介绍......

【联系方式】

【本站信誉】

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