protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         /*判断员工是否已经登陆了系统*/
         if (Session["employeeFlag"] == null)
         {
             Response.Write("<script>top.location.href='../login.aspx';</script>");
             return;
         }
         /*取得更新商品的商品编号*/
         string goodNo = Request.QueryString["goodNo"];
         /*调用业务层根据商品编号得到商品的信息并保存在模型中*/
         GoodInfoModel goodInfoModel = GoodLogic.GetGoodInfoByNo(goodNo);
         /*显示该商品的各个信息*/
         this.GoodNo.Text        = goodInfoModel.GoodNo;
         this.GoodClassName.Text = GoodClassLogic.GetGoodClassNameById(goodInfoModel.GoodClassId);
         this.GoodName.Text      = goodInfoModel.GoodName;
         this.GoodUnit.Text      = goodInfoModel.GoodUnit;
         this.GoodModel.Text     = goodInfoModel.GoodModel;
         this.GoodSpecs.Text     = goodInfoModel.GoodSpecs;
         this.GoodPrice.Text     = goodInfoModel.GoodPrice.ToString();
         this.GoodPlace.Text     = goodInfoModel.GoodPlace;
         this.GoodMemo.Text      = goodInfoModel.GoodMemo;
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         /*判断管理员是否已经登陆了系统*/
         if (Session["adminFlag"] == null)
         {
             Response.Write("<script>top.location.href='../login.aspx';</script>");
             return;
         }
         DataSet goodClassDs = GoodClassLogic.QueryAllGoodClassInfo();
         for (int i = 0; i < goodClassDs.Tables[0].Rows.Count; i++)
         {
             DataRow dr = goodClassDs.Tables[0].Rows[i];
             this.GoodClassId.Items.Add(new ListItem(dr["goodClassName"].ToString(), dr["goodClassId"].ToString()));
         }
         /*取得更新商品的商品编号*/
         string goodNo = Request.QueryString["goodNo"];
         /*调用业务层根据商品编号得到商品的信息并保存在模型中*/
         GoodInfoModel goodInfoModel = GoodLogic.GetGoodInfoByNo(goodNo);
         /*显示该商品的各个信息*/
         this.GoodNo.Text = goodInfoModel.GoodNo;
         this.GoodClassId.SelectedValue = goodInfoModel.GoodClassId.ToString();
         this.GoodName.Text             = goodInfoModel.GoodName;
         this.GoodUnit.Text             = goodInfoModel.GoodUnit;
         this.GoodModel.Text            = goodInfoModel.GoodModel;
         this.GoodSpecs.Text            = goodInfoModel.GoodSpecs;
         this.GoodPrice.Text            = goodInfoModel.GoodPrice.ToString();
         this.GoodPlace.Text            = goodInfoModel.GoodPlace;
         this.GoodMemo.Text             = goodInfoModel.GoodMemo;
     }
 }
    protected void Btn_GetGoodInfo_Click(object sender, EventArgs e)
    {
        /*根据商品编号查询商品信息*/
        string goodNo = this.GoodNo.Text;

        if (goodNo == "")
        {
            Response.Write("<script>alert('请输入商品编号信息!');</script>");
            return;
        }
        GoodInfoModel goodInfoModel = GoodLogic.GetGoodInfoByNo(goodNo);

        if (goodInfoModel == null)
        {
            Response.Write("<script>alert('不存在该商品的信息!');</script>");
        }
        else
        {
            /*将该商品的详细信息显示在界面上供管理员确认无错误*/
            this.GoodName.Text         = goodInfoModel.GoodName;
            this.GoodModel.Text        = goodInfoModel.GoodModel;
            this.GoodSpecs.Text        = goodInfoModel.GoodSpecs;
            this.GoodPlace.Text        = goodInfoModel.GoodPlace;
            this.GoodInfoPanel.Visible = true;
        }
    }
    protected void Btn_Add_Click(object sender, EventArgs e)
    {
        /*建立商品信息模型并从界面中搜集管理员输入的商品信息*/
        GoodInfoModel goodInfoModel = new GoodInfoModel();

        goodInfoModel.GoodNo      = this.GoodNo.Text;
        goodInfoModel.GoodClassId = Int32.Parse(this.GoodClassId.SelectedValue);
        goodInfoModel.GoodName    = this.GoodName.Text;
        goodInfoModel.GoodUnit    = this.GoodUnit.Text;
        goodInfoModel.GoodModel   = this.GoodModel.Text;
        goodInfoModel.GoodSpecs   = this.GoodSpecs.Text;
        goodInfoModel.GoodPrice   = Convert.ToSingle(this.GoodPrice.Text);
        goodInfoModel.GoodPlace   = this.GoodPlace.Text;
        goodInfoModel.GoodMemo    = this.GoodMemo.Text;
        goodInfoModel.GoodAddTime = DateTime.Now;
        /*调用业务层执行商品信息的加入操作*/
        GoodLogic goodLogic = new GoodLogic();

        if (goodLogic.AddGoodInfo(goodInfoModel))
        {
            Response.Write("<script>alert('商品信息添加成功!');location.href='GoodInfoAdd.aspx';</script>");
        }
        else
        {
            Response.Write("<script>alert('" + goodLogic.ErrMessage + "');location.href='GoodInfoAdd.aspx';</script>");
        }
    }
Ejemplo n.º 5
0
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        /*取得查询参数*/
        string goodNo      = this.GoodNo.Text;
        string goodName    = this.GoodName.Text;
        int    goodClassId = Int32.Parse(this.GoodClassId.SelectedValue);

        /*调用业务层进行查询,返回dataset,重新绑定*/
        this.GridView1.DataSourceID = null;
        this.GridView1.DataSource   = GoodLogic.QueryGoodInfo(goodNo, goodName, goodClassId);
        this.GridView1.PageIndex    = e.NewPageIndex;
        this.GridView1.DataBind();
    }
Ejemplo n.º 6
0
    protected void Btn_Update_Click(object sender, EventArgs e)
    {
        /*建立商品信息模型,搜集该商品的各个信息*/
        GoodInfoModel goodInfoModel = new GoodInfoModel();

        goodInfoModel.GoodNo      = Request.QueryString["goodNo"];
        goodInfoModel.GoodClassId = Int32.Parse(this.GoodClassId.SelectedValue);
        goodInfoModel.GoodName    = this.GoodName.Text;
        goodInfoModel.GoodUnit    = this.GoodUnit.Text;
        goodInfoModel.GoodModel   = this.GoodModel.Text;
        goodInfoModel.GoodSpecs   = this.GoodSpecs.Text;
        goodInfoModel.GoodPrice   = Convert.ToSingle(this.GoodPrice.Text);
        goodInfoModel.GoodPlace   = this.GoodPlace.Text;
        goodInfoModel.GoodMemo    = this.GoodMemo.Text;
        /*调用业务层执行该商品信息的更新操作*/
        if (GoodLogic.UpdateGoodInfo(goodInfoModel))
        {
            Response.Write("<script>alert('商品信息更新成功!');location.href='GoodInfoUpdate.aspx?goodNo=" + goodInfoModel.GoodNo + "';</script>");
        }
        else
        {
            Response.Write("<script>alert('商品信息更新失败!');location.href='GoodInfoUpdate.aspx?goodNo=" + goodInfoModel.GoodNo + "';</script>");
        }
    }