예제 #1
0
        public override SyncFeedEntry GetFeedEntry(string idString)
        {
            #region declarations
            int            recordCount;
            DataSets.Order order = new DataSets.Order();
            CalculatedOrdersTableAdapter tableAdapter;
            tableAdapter = new CalculatedOrdersTableAdapter();
            CalculatedOrderDetailsTableAdapter detailTableAdapter;
            detailTableAdapter = new CalculatedOrderDetailsTableAdapter();
            //DeletedOrderDetailsTableAdapter deletedDetailTableAdapter;
            //deletedDetailTableAdapter = new DeletedOrderDetailsTableAdapter();


            int id;
            if (!(Int32.TryParse(idString, out id)))
            {
                id = 0;
            }
            #endregion


            #region fill dataset
            using (OleDbConnection connection = new OleDbConnection(_context.Config.ConnectionString))
            {
                tableAdapter.Connection = connection;
                recordCount             = tableAdapter.FillBy(order.CalculatedOrders, id);
                if (recordCount == 0)
                {
                    return(null);
                }

                detailTableAdapter.Connection = connection;
                detailTableAdapter.FillBy(order.CalculatedOrderDetails, id);

                //deletedDetailTableAdapter.Connection = connection;
                //deletedDetailTableAdapter.Fill(order.DeletedOrderDetails, id.ToString(), lastToken.SequenceNumber, config.CrmUser);
            }
            #endregion


            SyncFeedEntry entry = new SyncFeedEntry();
            entry.Id = String.Format("{0}{1}('{2}')", _context.DatasetLink, _resourceKind.ToString(), idString);

            entry.Title   = String.Format("{0}: {1}", _resourceKind.ToString(), idString);
            entry.Updated = DateTime.Now;

            entry.Payload = GetPayload((DataSets.Order.CalculatedOrdersRow)order.CalculatedOrders[0],
                                       order.CalculatedOrderDetails,
                                       //order.DeletedOrderDetails,
                                       _context.Config);

            entry.SyncLinks.AddRange(GetLinks(entry.Payload.ForeignIds));

            return(entry);
        }
        public override Sage.Common.Syndication.FeedEntry GetFeedEntry(string idString)
        {
            #region declarations
            int recordCount;
            Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order order = new Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order();
            CalculatedOrdersTableAdapter tableAdapter;
            tableAdapter = new CalculatedOrdersTableAdapter();
            CalculatedOrderDetailsTableAdapter detailTableAdapter;
            detailTableAdapter = new CalculatedOrderDetailsTableAdapter();
            //DeletedOrderDetailsTableAdapter deletedDetailTableAdapter;
            //deletedDetailTableAdapter = new DeletedOrderDetailsTableAdapter();


            int id;
            if (!(Int32.TryParse(idString, out id)))
            {
                id = 0;
            }
            #endregion


            #region fill dataset
            using (OleDbConnection connection = new OleDbConnection(_context.Config.ConnectionString))
            {
                tableAdapter.Connection = connection;
                recordCount             = tableAdapter.FillBy(order.CalculatedOrders, id, id);
                if (recordCount == 0)
                {
                    return(null);
                }

                detailTableAdapter.Connection = connection;
                detailTableAdapter.FillBy(order.CalculatedOrderDetails, id);

                //deletedDetailTableAdapter.Connection = connection;
                //deletedDetailTableAdapter.Fill(order.DeletedOrderDetails, id.ToString(), lastToken.SequenceNumber, config.CrmUser);
            }
            #endregion


            SalesInvoiceFeedEntry entry;

            entry = GetPayload((Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order.CalculatedOrdersRow)order.CalculatedOrders[0],
                               order.CalculatedOrderDetails,
                               //order.DeletedOrderDetails,
                               _context.Config);

            return(entry);
        }
예제 #3
0
        public override Document GetDocument(Identity identity, Token lastToken, NorthwindConfig config)
        {
            int recordCount;

            DataSets.Order order = new DataSets.Order();
            CalculatedOrdersTableAdapter tableAdapter;

            tableAdapter = new CalculatedOrdersTableAdapter();
            CalculatedOrderDetailsTableAdapter detailTableAdapter;

            detailTableAdapter = new CalculatedOrderDetailsTableAdapter();
            DeletedOrderDetailsTableAdapter deletedDetailTableAdapter;

            deletedDetailTableAdapter = new DeletedOrderDetailsTableAdapter();


            int id;

            id = Identity.GetId(identity);



            using (OleDbConnection connection = new OleDbConnection(config.ConnectionString))
            {
                tableAdapter.Connection = connection;
                recordCount             = tableAdapter.FillBy(order.CalculatedOrders, id, id);
                if (recordCount == 0)
                {
                    return(GetDeletedDocument(identity));
                }

                detailTableAdapter.Connection = connection;
                detailTableAdapter.FillBy(order.CalculatedOrderDetails, id);

                deletedDetailTableAdapter.Connection = connection;
                deletedDetailTableAdapter.Fill(order.DeletedOrderDetails, id.ToString(), lastToken.SequenceNumber, config.CrmUser);
            }


            return(GetDocument((DataSets.Order.CalculatedOrdersRow)order.CalculatedOrders[0],
                               order.CalculatedOrderDetails,
                               order.DeletedOrderDetails,
                               lastToken, config));
        }