public int Update(PromotionGroupInfo model) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] paras = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(strSql, paras)); }
private void fillModel(DbDataReader dr, PromotionGroupInfo model) { model.ID = dr.GetInt32(0); model.PromotionID = dr.GetInt32(1); model.GroupID = dr.GetInt32(2); model.LineID = dr.GetInt32(3); model.TotalNum = dr.GetInt32(4); model.SelledNum = dr.GetInt32(5); model.RemainNum = dr.GetInt32(6); model.RawInnerPrice = dr.GetDecimal(7); model.RawOuterPrice = dr.GetDecimal(8); model.BeginTime = dr.GetDateTime(9); model.AddTime = dr.GetDateTime(10); model.ExtraFields = FieldsHelper.XmlDeserialize(dr.GetString(11)); }
private DbParameter[] makeParameterForAdd(PromotionGroupInfo model) { DbParameter[] paras = { Db.Helper.MakeInParameter("@PromotionID", model.PromotionID), Db.Helper.MakeInParameter("@GroupID", model.GroupID), Db.Helper.MakeInParameter("@LineID", model.LineID), Db.Helper.MakeInParameter("@TotalNum", model.TotalNum), Db.Helper.MakeInParameter("@SelledNum", model.SelledNum), Db.Helper.MakeInParameter("@RemainNum", model.RemainNum), Db.Helper.MakeInParameter("@RawInnerPrice", model.RawInnerPrice), Db.Helper.MakeInParameter("@RawOuterPrice", model.RawOuterPrice), Db.Helper.MakeInParameter("@BeginTime", model.BeginTime), Db.Helper.MakeInParameter("@AddTime", model.AddTime), Db.Helper.MakeInParameter("@ExtraFields", FieldsHelper.XmlSerialize(model.ExtraFields)) }; return(paras); }
protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e) { string commandName = e.CommandName; int id = e.CommandArgument.ToArrowInt(); if (e.CommandName == "AddData") { GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); int num = (gvData.Rows[drv.RowIndex].FindControl("tbNum") as TextBox).Text.Trim().ToArrowInt(); if ((num == 0).ValidateSuccess("促销的团位数无效!")) { BindData(); return; } int lineID = (gvData.Rows[drv.RowIndex].FindControl("hfLineID") as HiddenField).Value.Trim().ToArrowInt(); decimal rawInnerPrice = (gvData.Rows[drv.RowIndex].FindControl("hfInnerPrice") as HiddenField).Value.Trim().ToArrowDecimal(); decimal rawOuterPrice = (gvData.Rows[drv.RowIndex].FindControl("hfOuterPrice") as HiddenField).Value.Trim().ToArrowDecimal(); //判断该团是否已加入 if (PromotionBLL.GroupIsInPromotion(id, MyPromotion.ID).ValidateSuccess("该团已在促销内!")) { BindData(); return; } //开始加入 var model = new TMS.PromotionGroupInfo(); model.AddTime = DateTime.Now; model.GroupID = id; model.LineID = lineID; model.PromotionID = MyPromotion.ID; model.SelledNum = 0; model.TotalNum = num; model.RawInnerPrice = rawInnerPrice; model.RawOuterPrice = rawOuterPrice; model.BeginTime = DateTime.Now; model.RemainNum = model.TotalNum - model.SelledNum; PromotionBLL.AddGroupToPromotion(model); BindData(); MessageBox.Show("添加成功!"); } }
public int Add(PromotionGroupInfo model) { DbParameter[] paras = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras)); }
public int Add(PromotionGroupInfo model, DbTransaction tran) { DbParameter[] para = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para)); }