public static TaxRuleGroupCollection LoadForGroup(Int32 groupId) { TaxRuleGroupCollection TaxRuleGroups = new TaxRuleGroupCollection(); //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT TaxRuleId"); selectQuery.Append(" FROM ac_TaxRuleGroups"); selectQuery.Append(" WHERE GroupId = @groupId"); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@groupId", System.Data.DbType.Int32, groupId); //EXECUTE THE COMMAND using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read()) { TaxRuleGroup taxRuleGroup = new TaxRuleGroup(); taxRuleGroup.GroupId = groupId; taxRuleGroup.TaxRuleId = dr.GetInt32(0); TaxRuleGroups.Add(taxRuleGroup); } dr.Close(); } return TaxRuleGroups; }
/// <summary> /// Loads the given TaxRuleGroup object from the given database data reader. /// </summary> /// <param name="taxRuleGroup">The TaxRuleGroup object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(TaxRuleGroup taxRuleGroup, IDataReader dr) { //SET FIELDS FROM ROW DATA taxRuleGroup.TaxRuleId = dr.GetInt32(0); taxRuleGroup.GroupId = dr.GetInt32(1); taxRuleGroup.IsDirty = false; }
public static TaxRuleGroup Load(Int32 taxRuleId, Int32 groupId) { TaxRuleGroup taxRuleGroup = new TaxRuleGroup(); taxRuleGroup.TaxRuleId = taxRuleId; taxRuleGroup.GroupId = groupId; taxRuleGroup.IsDirty = false; return taxRuleGroup; }
public static SaveResult Insert(TaxRuleGroup taxRuleGroup) { return taxRuleGroup.Save(); }
public static bool Delete(Int32 taxRuleId, Int32 groupId) { TaxRuleGroup taxRuleGroup = new TaxRuleGroup(); if (taxRuleGroup.Load(taxRuleId, groupId)) return taxRuleGroup.Delete(); return false; }
public static bool Delete(TaxRuleGroup taxRuleGroup) { return taxRuleGroup.Delete(); }
public static SaveResult Update(TaxRuleGroup taxRuleGroup) { return taxRuleGroup.Save(); }