public int GetInsert(M_ArticlePromotion articlePromotion) { string sqlStr = "INSERT INTO [dbo].[ZL_ArticlePromotion] ([PromotionUserId],[CartProId],[PromotionUrl],[IsBalance],[IsEnable],[AddTime],[BalanceTime],[RebatesId]) VALUES (@PromotionUserId,@CartProId,@PromotionUrl,@IsBalance,@IsEnable,@AddTime,@BalanceTime,@RebatesId);SET @Id = SCOPE_IDENTITY()"; SqlParameter[] cmdParams = articlePromotion.GetParameters(); return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams))); }
protected void Page_Load(object sender, EventArgs e) { int id = DataConverter.CLng(Request["id"]); if (Request["item"] != null && Request["item"] != "") { SafeSC.CheckIDSEx(Request["item"]); DataTable dt = new DataTable(); M_CartPro mcp = bcp.SelReturnModel(DataConverter.CLng(Request["item"].Split(',')[0])); M_ArticlePromotion map = bap.GetSelectBySqlParams("select * from ZL_ArticlePromotion where CartProId=" + mcp.ID, null); M_UserInfo mui = bu.GetUserByUserID(map.PromotionUserId); if (mcp.ID <= 0 || map.Id <= 0) { function.WriteErrMsg("参数错误!"); return; } if (dt == null) { return; } Label2.Text = dt.Rows[0]["moneysum"].ToString(); Label1.Text = mui.UserName.ToString(); Label3.Value = Label3.Value; label4.Text = (DataConverter.CDouble(Label2.Text) * DataConverter.CDouble(Label3.Value) / 100).ToString(); } else if (id > 0) { M_ArticlePromotion map = bap.GetSelect(id); M_UserInfo mui = bu.GetUserByUserID(map.PromotionUserId); M_CartPro mcp = bcp.SelReturnModel(map.CartProId); hfId.Value = map.Id.ToString(); Label2.Text = mcp.AllMoney.ToString(); Label1.Text = mui.UserName; Label3.Value = Label3.Value; label4.Text = (DataConverter.CDouble(Label2.Text) * DataConverter.CDouble(Label3.Value) / 100).ToString(); } Call.SetBreadCrumb(Master, "<li>商城管理</li><li>推广</li>"); }
// 如果是推广商品就添加推广信息 public void PromotionComfirm(M_OrderList orlist) { B_ArticlePromotion bap = new B_ArticlePromotion(); DataTable mcp; mcp = cartProBll.GetCartProOrderID(orlist.id); if (mcp != null && mcp.Rows.Count > 0) { if (orlist.Settle == 1) { for (int i = 0; i < mcp.Rows.Count; i++) { Response.Write(mcp.Rows[i]["id"].ToString()); M_ArticlePromotion map = bap.GetSelectBySqlParams("select * from ZL_ArticlePromotion where cartproid=" + mcp.Rows[i]["id"].ToString(), null); if (map.Id > 0) { map.IsEnable = true; bap.GetUpdate(map); } } } } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button2_Click(object sender, EventArgs e) { if (this.Label3.Value.Trim() == "") { Label5.Text = "<font style='color:red'></font>"; return; } else { Label5.Text = ""; } string[] proid; if (Request["item"] != null && Request["item"] != "") { proid = Request["item"].Split(','); M_ArticlePromotion map = new M_ArticlePromotion(); for (int i = 0; i < proid.Length; i++) { M_Rebates mr = new M_Rebates(); M_UserInfo mui = bu.GetUserIDByUserName(Label1.Text.Trim()); M_CartPro mcp = bcp.SelReturnModel(DataConverter.CLng(proid[i])); map = bap.GetSelectBySqlParams("select * from ZL_ArticlePromotion where cartproid=" + mcp.ID, null); mr.Money = mcp.AllMoney; mr.UserID = mui.UserID; mr.Scale = DataConverter.CFloat(this.Label3.Value) / 100; mr.BalanceMoney = (mcp.AllMoney * DataConverter.CFloat(Label3.Value) / 100); map.RebatesId = brb.GetInsert(mr); map.IsBalance = true; bap.GetUpdate(map); } if (map.RebatesId > 0) { function.Script(this, "alert('结算成功!');gotourl('shop/OrderBlanace.aspx?id=" + map.PromotionUserId + "&balance=0');Dialog.close();"); } else { function.Script(this, "alert('添加失败!');gotourl('shop/OrderBlanace.aspx?id=" + map.PromotionUserId + "&balance=0');Dialog.close();"); } } else { M_Rebates mr = new M_Rebates(); M_ArticlePromotion map = bap.GetSelect(DataConverter.CLng(hfId.Value)); mr.Money = DataConverter.CLng(this.Label2.Text); mr.UserID = map.PromotionUserId; mr.Scale = DataConverter.CFloat(this.Label3.Value) / 100; mr.BalanceMoney = DataConverter.CDouble(this.label4.Text); map.RebatesId = brb.GetInsert(mr); map.IsBalance = true; bap.GetUpdate(map); if (map.RebatesId > 0) { function.Script(this, "alert('结算成功!');gotourl('shop/OrderBlanace.aspx?id=" + map.PromotionUserId + "&balance=0');Dialog.close();"); } else { function.Script(this, "alert('添加失败!');gotourl('shop/OrderBlanace.aspx?id=" + map.PromotionUserId + "&balance=0');Dialog.close();"); } } }
public int insert(M_ArticlePromotion model) { return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
public bool GetUpdate(M_ArticlePromotion model) { return(Sql.UpdateByIDs(strTableName, PK, model.Id.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }