public SalesReasonCollection FetchByQuery(Query qry) { SalesReasonCollection coll = new SalesReasonCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public SalesReasonCollection FetchAll() { SalesReasonCollection coll = new SalesReasonCollection(); Query qry = new Query(SalesReason.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public static AVManager.DAL.SalesReasonCollection GetSalesReasonCollection(int varSalesOrderID) { SubSonic.QueryCommand cmd = new SubSonic.QueryCommand( "SELECT * FROM SalesReason INNER JOIN SalesOrderHeaderSalesReason ON " + "SalesReason.SalesReasonID=SalesOrderHeaderSalesReason.SalesReasonID WHERE SalesOrderHeaderSalesReason.SalesOrderID=@SalesOrderID", SalesOrderHeader.Schema.Provider.Name); cmd.AddParameter("@SalesOrderID", varSalesOrderID, DbType.Int32); IDataReader rdr = SubSonic.DataService.GetReader(cmd); SalesReasonCollection coll = new SalesReasonCollection(); coll.LoadAndCloseReader(rdr); return(coll); }
public static void SaveSalesReasonMap(int varSalesOrderID, SalesReasonCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM SalesOrderHeaderSalesReason WHERE SalesOrderID=@SalesOrderID", SalesOrderHeader.Schema.Provider.Name); cmdDel.AddParameter("@SalesOrderID", varSalesOrderID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (SalesReason item in items) { SalesOrderHeaderSalesReason varSalesOrderHeaderSalesReason = new SalesOrderHeaderSalesReason(); varSalesOrderHeaderSalesReason.SetColumnValue("SalesOrderID", varSalesOrderID); varSalesOrderHeaderSalesReason.SetColumnValue("SalesReasonID", item.GetPrimaryKeyValue()); varSalesOrderHeaderSalesReason.Save(); } }
public SalesReasonCollection FetchByID(object SalesReasonID) { SalesReasonCollection coll = new SalesReasonCollection().Where("SalesReasonID", SalesReasonID).Load(); return(coll); }