Exemple #1
0
        public SalesReasonCollection FetchByQuery(Query qry)
        {
            SalesReasonCollection coll = new SalesReasonCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemple #2
0
        public SalesReasonCollection FetchAll()
        {
            SalesReasonCollection coll = new SalesReasonCollection();
            Query qry = new Query(SalesReason.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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();
            }
        }
Exemple #5
0
        public SalesReasonCollection FetchByID(object SalesReasonID)
        {
            SalesReasonCollection coll = new SalesReasonCollection().Where("SalesReasonID", SalesReasonID).Load();

            return(coll);
        }