protected void ButtonSub_Click(object sender, EventArgs e) { for (int i = 0; i < GridViewActor.Rows.Count; i++) { CheckBox checkboxselect = GridViewActor.Rows[i].FindControl("CheckBox1") as CheckBox; if (checkboxselect.Checked == true) { string actorname = GridViewActor.Rows[i].Cells[1].Text; string programid = HiddenFieldP.Value + HiddenFieldActor.Value; DtCms.BLL.Actor actorBll = new DtCms.BLL.Actor(); bool isexist = actorBll.AcExists(programid, actorname); if (isexist == false) { DtCms.Model.Actor actor = new DtCms.Model.Actor(); actor.ActivityId = HiddenFieldP.Value; actor.ProgrammeId = programid; actor.UserName = actorname; actor.TureName = GridViewActor.Rows[i].Cells[2].Text; actor.UserTel = GridViewActor.Rows[i].Cells[3].Text; actorBll.Add(actor); ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('提交成功!')</script>"); } else { ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "<script>alert('提交失败!您已选择了该人员,请不要重复选择!')</script>"); } } } }
public int Add(DtCms.Model.Actor model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into dt_Actor("); strSql.Append("ActivityId,ProgrammeId,UserName,TureName,UserTel)"); strSql.Append(" values ("); strSql.Append("@ActivityId,@ProgrammeId,@UserName,@TureName,@UserTel)"); SqlParameter[] parameters = { new SqlParameter("@ActivityId", SqlDbType.VarChar, 100), new SqlParameter("@ProgrammeId", SqlDbType.VarChar, 100), new SqlParameter("@UserName", SqlDbType.NVarChar, 100), new SqlParameter("@TureName", SqlDbType.NVarChar, 50), new SqlParameter("@UserTel", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.ActivityId; parameters[1].Value = model.ProgrammeId; parameters[2].Value = model.UserName; parameters[3].Value = model.TureName; parameters[4].Value = model.UserTel; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public bool Update(DtCms.Model.Actor model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update dt_Actor set "); strSql.Append("ActivityId=@ActivityId,"); strSql.Append("UserName=@UserName,"); strSql.Append("TureName=@TureName,"); strSql.Append("UserTel=@UserTel,"); strSql.Append(" where ProgrammeId=@ProgrammeId"); SqlParameter[] parameters = { new SqlParameter("@ActivityId", SqlDbType.VarChar, 100), new SqlParameter("@ProgrammeId", SqlDbType.VarChar, 100), new SqlParameter("@UserName", SqlDbType.NVarChar, 100), new SqlParameter("@TureName", SqlDbType.NVarChar, 50), new SqlParameter("@UserTel", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.ActivityId; parameters[1].Value = model.ProgrammeId; parameters[2].Value = model.UserName; parameters[3].Value = model.TureName; parameters[4].Value = model.UserTel; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public bool Update(DtCms.Model.Actor model) { return(dal.Update(model)); }
public int Add(DtCms.Model.Actor model) { return(dal.Add(model)); }