/// <summary> /// 更新一条数据 /// </summary> public bool Update(book_shop.Model.ActionGroupActionInfoModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ActionGroupActionInfo set "); #warning 系统发现缺少更新的字段,请手工确认如此更新是否正确! strSql.Append("ActionGroup_ID=@ActionGroup_ID,"); strSql.Append("ActionInfo_ID=@ActionInfo_ID"); strSql.Append(" where ActionGroup_ID=@ActionGroup_ID and ActionInfo_ID=@ActionInfo_ID "); SqlParameter[] parameters = { new SqlParameter("@ActionGroup_ID", SqlDbType.Int, 4), new SqlParameter("@ActionInfo_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.ActionGroup_ID; parameters[1].Value = model.ActionInfo_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(book_shop.Model.ActionGroupActionInfoModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ActionGroupActionInfo("); strSql.Append("ActionGroup_ID,ActionInfo_ID)"); strSql.Append(" values ("); strSql.Append("@ActionGroup_ID,@ActionInfo_ID)"); SqlParameter[] parameters = { new SqlParameter("@ActionGroup_ID", SqlDbType.Int, 4), new SqlParameter("@ActionInfo_ID", SqlDbType.Int, 4) }; parameters[0].Value = model.ActionGroup_ID; parameters[1].Value = model.ActionInfo_ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public book_shop.Model.ActionGroupActionInfoModel GetModel(int ActionGroup_ID, int ActionInfo_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ActionGroup_ID,ActionInfo_ID from ActionGroupActionInfo "); strSql.Append(" where ActionGroup_ID=@ActionGroup_ID and ActionInfo_ID=@ActionInfo_ID "); SqlParameter[] parameters = { new SqlParameter("@ActionGroup_ID", SqlDbType.Int, 4), new SqlParameter("@ActionInfo_ID", SqlDbType.Int, 4) }; parameters[0].Value = ActionGroup_ID; parameters[1].Value = ActionInfo_ID; book_shop.Model.ActionGroupActionInfoModel model = new book_shop.Model.ActionGroupActionInfoModel(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public book_shop.Model.ActionGroupActionInfoModel DataRowToModel(DataRow row) { book_shop.Model.ActionGroupActionInfoModel model = new book_shop.Model.ActionGroupActionInfoModel(); if (row != null) { if (row["ActionGroup_ID"] != null && row["ActionGroup_ID"].ToString() != "") { model.ActionGroup_ID = int.Parse(row["ActionGroup_ID"].ToString()); } if (row["ActionInfo_ID"] != null && row["ActionInfo_ID"].ToString() != "") { model.ActionInfo_ID = int.Parse(row["ActionInfo_ID"].ToString()); } } return(model); }