protected void btnAddUserPipeSet_Click(object sender, EventArgs e) { BLLJIMP.Model.SMSUserPipeSet model = new SMSUserPipeSet(); model.UserID = this.ViewState["userID"].ToString(); model.UserPipe = this.ddlChargePipe.SelectedValue; model.SendPipe = this.ddlSendPipe.SelectedValue; if (this.smsBll.Exists(model, new List <string>() { "UserID", "UserPipe" })) { this.smsBll.Update( new BLLJIMP.Model.SMSUserPipeSet(), string.Format(" SendPipe = '{0}' ", model.SendPipe), string.Format(" UserID ='{0}' and UserPipe = '{1}'", model.UserID, model.UserPipe) ); this.ShowMessge("已成功更新通道:" + model.UserPipe); } else { this.smsBll.Add(model); this.ShowMessge("已成功添加新通道"); } this.grvUserPipeSet.DataSource = this.smsBll.GetUserPipeList(model.UserID); this.grvUserPipeSet.DataBind(); }
protected void grvUserPipeSet_RowDeleting(object sender, GridViewDeleteEventArgs e) { BLLJIMP.Model.SMSUserPipeSet model = new SMSUserPipeSet(); model.UserID = this.grvUserPipeSet.DataKeys[e.RowIndex].Values["UserID"].ToString(); model.UserPipe = this.grvUserPipeSet.DataKeys[e.RowIndex].Values["UserPipe"].ToString(); model.SendPipe = this.grvUserPipeSet.DataKeys[e.RowIndex].Values["SendPipe"].ToString(); this.smsBll.Delete(model); this.ShowMessge("成功删除!"); this.grvUserPipeSet.DataSource = this.smsBll.GetUserPipeList(model.UserID); this.grvUserPipeSet.DataBind(); }