コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentGoods = GoodsBLL.SelectGoods(GetUrlInt("id"));
        if (CurrentGoods == null || CurrentGoods.IsOut == 1)
        {
            MessageBox.Show("该商品不存在或已下架!", true);
        }

        ddlNum.Items.Clear();
        for (int i = 1; i <= CurrentGoods.Num; i++)
        {
            ddlNum.Items.Add(i.ToString());
        }
    }
コード例 #2
0
 public int Add(GoodsInfo model)
 {
     DbParameter[] paras = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras));
 }
コード例 #3
0
 public int Add(GoodsInfo model, DbTransaction tran)
 {
     DbParameter[] para = makeParameterForAdd(model);
     return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para));
 }
コード例 #4
0
ファイル: GoodsEdit.aspx.cs プロジェクト: syunie/.NETandCloud
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int    id      = GetGoodsID();
        string name    = tbName.Text.Trim();
        int    cid     = ddlCat.SelectedValue.ToArrowInt();
        int    point   = tbPoints.Text.Trim().ToArrowInt();
        int    num     = tbNum.Text.Trim().ToArrowInt();
        string cover   = tbCoverPath.Text.Trim();
        string remarks = tbRemarks.Text.Trim();

        if (name.ValidateIsNullOrEmpty("请输入商品名称!"))
        {
            return;
        }

        if ((cid == 0).ValidateSuccess("请先选择分类!"))
        {
            return;
        }

        if ((point == 0).ValidateSuccess("兑换点数必须大于0!"))
        {
            return;
        }

        if ((num == 0).ValidateSuccess("数量必须大于0!"))
        {
            return;
        }


        if (id == 0)
        {
            var model = new TMS.GoodsInfo();
            model.AddTime         = DateTime.Now;
            model.AddUserName     = CurrentAdmin.UserName;
            model.AddUserRealName = CurrentAdmin.RealName;
            model.BigPicPath      = "";
            model.CatID           = cid;
            model.CoverPath       = cover;
            model.IsOut           = 0;
            model.Name            = name;
            model.Num             = num;
            model.Points          = point;
            model.Remarks         = remarks;

            GoodsBLL.AddGoods(model);

            tbName.Text      = "";
            tbPoints.Text    = "";
            tbNum.Text       = "";
            tbCoverPath.Text = "";
            tbRemarks.Text   = "";
            MessageBox.Show("添加成功!");
        }
        else
        {
            var model = GoodsBLL.SelectGoods(id);
            if (model != null)
            {
                model.Name      = name;
                model.CatID     = cid;
                model.CoverPath = cover;
                model.Num       = num;
                model.Points    = point;
                model.Remarks   = remarks;
                GoodsBLL.UpdateGoods(model);
                MessageBox.Show("修改成功!");
            }
        }
    }