/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.BD_ShopGoodsList model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.BD_ShopGoodsList model) { return(dal.Update(model)); }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (comPid != 0) { SqlTransaction Tran = null; try { object goodsId = Common.NoHTML(Request["hidGoodsId"]); object goodsName = Common.NoHTML(Request["txtGoodsName"]); object showName = Common.NoHTML(Request["txtShowName"]); if (goodsId != null) { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); if (!Util.IsEmpty(this.hidtitle.Value.Trim())) { string title = string.Empty; if (this.hidtitle.Value.Trim() != Request["txtTitle"].Trim()) { title = Common.NoHTML(this.hidtitle.Value.Trim()); } else { title = Common.NoHTML(Request["txtTitle"].Trim()); } List <Hi.Model.BD_ShopGoodsList> ll = new Hi.BLL.BD_ShopGoodsList().GetList("", "isnull(dr,0)=0 and compId=" + comPid + " and title='" + title + "'", "", Tran); if (ll.Count > 0) { new Hi.BLL.BD_ShopGoodsList().Delete(comPid, title, Tran); } } for (int i = 0; i < goodsId.ToString().Split(',').Length; i++) { if (!Util.IsEmpty(goodsId.ToString().Split(',')[i].Trim())) { Hi.Model.BD_ShopGoodsList model = null; model = new Hi.Model.BD_ShopGoodsList(); model.CompID = comPid; model.Title = Common.NoHTML(Request["txtTitle"].Trim()); model.GoodsID = Convert.ToInt32(goodsId.ToString().Split(',')[i].Trim()); if (!Util.IsEmpty(showName.ToString().Split(',')[i].Trim())) { model.ShowName = Common.NoHTML(showName.ToString().Split(',')[i].Trim()); } else { model.ShowName = Common.NoHTML(goodsName.ToString().Split(',')[i].Trim()); } model.CreateDate = DateTime.Now; model.CreateUserID = this.UserID; model.ts = DateTime.Now; model.dr = 0; model.modifyuser = this.UserID; new Hi.BLL.BD_ShopGoodsList().Add(model, Tran); } } Tran.Commit(); Response.Redirect("RecommendGoodsList2.aspx?KeyID=" + comPid); } } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.AlertMsgOne(this, "操作失败!", JScript.IconOption.错误); return; } finally { DBUtility.SqlHelper.ConnectionClose(); } } else { // JScript.AlertMsgOne(this, "厂商Id有误", JScript.IconOption.错误); JScript.AlertMethod(this, "厂商Id有误", JScript.IconOption.错误, "function(){ window.location.href='../../admin/systems/CompList.aspx'; }"); return; } }