Exemplo n.º 1
0
        private async Task PerformUpdateAsync(DataSet <SalesOrder> salesOrders, CancellationToken ct)
        {
            salesOrders._.ResetRowIdentifiers();
            await SalesOrderHeader.UpdateAsync(salesOrders, ct);

            await SalesOrderDetail.DeleteAsync(salesOrders, (s, _) => s.Match(_.FK_SalesOrderHeader), ct);

            var salesOrderDetails = salesOrders.GetChild(_ => _.SalesOrderDetails);

            salesOrderDetails._.ResetRowIdentifiers();
            await SalesOrderDetail.InsertAsync(salesOrderDetails, ct);
        }
Exemplo n.º 2
0
        public async Task UpdateSalesOrderAsync(DataSet <SalesOrderInfo> salesOrders, CancellationToken ct = default(CancellationToken))
        {
            await EnsureConnectionOpenAsync(ct);

            using (var transaction = BeginTransaction())
            {
                salesOrders._.ResetRowIdentifiers();
                await SalesOrderHeader.UpdateAsync(salesOrders, ct);

                await SalesOrderDetail.DeleteAsync(salesOrders, (s, _) => s.Match(_.FK_SalesOrderHeader), ct);

                var salesOrderDetails = salesOrders.GetChild(_ => _.SalesOrderDetails);
                salesOrderDetails._.ResetRowIdentifiers();
                await SalesOrderDetail.InsertAsync(salesOrderDetails, ct);

                await transaction.CommitAsync(ct);
            }
        }
Exemplo n.º 3
0
        public async Task <int?> CreateSalesOrderAsync(DataSet <SalesOrderInfo> salesOrders, CancellationToken ct)
        {
            await EnsureConnectionOpenAsync(ct);

            using (var transaction = BeginTransaction())
            {
                salesOrders._.ResetRowIdentifiers();
                await SalesOrderHeader.InsertAsync(salesOrders, true, ct);

                var salesOrderDetails = salesOrders.GetChild(_ => _.SalesOrderDetails);
                salesOrderDetails._.ResetRowIdentifiers();
                await SalesOrderDetail.InsertAsync(salesOrderDetails, ct);

                await transaction.CommitAsync(ct);

                return(salesOrders.Count > 0 ? salesOrders._.SalesOrderID[0] : null);
            }
        }
Exemplo n.º 4
0
        private static DataSet <SalesOrderHeader> Headers()
        {
            DataSet <SalesOrderHeader> result = DataSet <SalesOrderHeader> .Create().AddRows(4);

            SalesOrderHeader _ = result._;

            _.SuspendIdentity();
            _.SalesOrderID[0]           = 1;
            _.SalesOrderID[1]           = 2;
            _.SalesOrderID[2]           = 3;
            _.SalesOrderID[3]           = 4;
            _.RevisionNumber[0]         = 2;
            _.RevisionNumber[1]         = 2;
            _.RevisionNumber[2]         = 2;
            _.RevisionNumber[3]         = 2;
            _.OrderDate[0]              = Convert.ToDateTime("2008-06-01T00:00:00.000");
            _.OrderDate[1]              = Convert.ToDateTime("2008-06-01T00:00:00.000");
            _.OrderDate[2]              = Convert.ToDateTime("2008-06-01T00:00:00.000");
            _.OrderDate[3]              = Convert.ToDateTime("2008-06-01T00:00:00.000");
            _.DueDate[0]                = Convert.ToDateTime("2008-06-13T00:00:00.000");
            _.DueDate[1]                = Convert.ToDateTime("2008-06-13T00:00:00.000");
            _.DueDate[2]                = Convert.ToDateTime("2008-06-13T00:00:00.000");
            _.DueDate[3]                = Convert.ToDateTime("2008-06-13T00:00:00.000");
            _.ShipDate[0]               = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ShipDate[1]               = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ShipDate[2]               = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ShipDate[3]               = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.Status[0]                 = SalesOrderStatus.Shipped;
            _.Status[1]                 = SalesOrderStatus.Shipped;
            _.Status[2]                 = SalesOrderStatus.Shipped;
            _.Status[3]                 = SalesOrderStatus.Shipped;
            _.OnlineOrderFlag[0]        = false;
            _.OnlineOrderFlag[1]        = false;
            _.OnlineOrderFlag[2]        = false;
            _.OnlineOrderFlag[3]        = false;
            _.PurchaseOrderNumber[0]    = "PO348186287";
            _.PurchaseOrderNumber[1]    = "PO19952192051";
            _.PurchaseOrderNumber[2]    = "PO19604173239";
            _.PurchaseOrderNumber[3]    = "PO19372114749";
            _.AccountNumber[0]          = "10-4020-000609";
            _.AccountNumber[1]          = "10-4020-000106";
            _.AccountNumber[2]          = "10-4020-000340";
            _.AccountNumber[3]          = "10-4020-000582";
            _.CustomerID[0]             = 29847;
            _.CustomerID[1]             = 30072;
            _.CustomerID[2]             = 30113;
            _.CustomerID[3]             = 29485;
            _.ShipToAddressID[0]        = 1092;
            _.ShipToAddressID[1]        = 640;
            _.ShipToAddressID[2]        = 653;
            _.ShipToAddressID[3]        = 1086;
            _.BillToAddressID[0]        = 1092;
            _.BillToAddressID[1]        = 640;
            _.BillToAddressID[2]        = 653;
            _.BillToAddressID[3]        = 1086;
            _.ShipMethod[0]             = "CARGO TRANSPORT 5";
            _.ShipMethod[1]             = "CARGO TRANSPORT 5";
            _.ShipMethod[2]             = "CARGO TRANSPORT 5";
            _.ShipMethod[3]             = "CARGO TRANSPORT 5";
            _.CreditCardApprovalCode[0] = null;
            _.CreditCardApprovalCode[1] = null;
            _.CreditCardApprovalCode[2] = null;
            _.CreditCardApprovalCode[3] = null;
            _.SubTotal[0]               = 880.3484M;
            _.SubTotal[1]               = 78.8100M;
            _.SubTotal[2]               = 38418.6895M;
            _.SubTotal[3]               = 39785.3304M;
            _.TaxAmt[0]                 = 70.4279M;
            _.TaxAmt[1]                 = 6.3048M;
            _.TaxAmt[2]                 = 3073.4952M;
            _.TaxAmt[3]                 = 3182.8264M;
            _.Freight[0]                = 22.0087M;
            _.Freight[1]                = 1.9703M;
            _.Freight[2]                = 960.4672M;
            _.Freight[3]                = 994.6333M;
            _.Comment[0]                = null;
            _.Comment[1]                = null;
            _.Comment[2]                = null;
            _.Comment[3]                = null;
            _.RowGuid[0]                = new Guid("89e42cdc-8506-48a2-b89b-eb3e64e3554e");
            _.RowGuid[1]                = new Guid("8a3448c5-e677-4158-a29b-dd33069be0b0");
            _.RowGuid[2]                = new Guid("a47665d2-7ac9-4cf3-8a8b-2a3883554284");
            _.RowGuid[3]                = new Guid("f1be45a5-5c57-4a50-93c6-5f8be44cb7cb");
            _.ModifiedDate[0]           = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ModifiedDate[1]           = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ModifiedDate[2]           = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ModifiedDate[3]           = Convert.ToDateTime("2008-06-08T00:00:00.000");
            _.ResumeIdentity();
            return(result);
        }
Exemplo n.º 5
0
 private KeyMapping FK_SalesOrderHeader_Address_ShipTo_AddressID(SalesOrderHeader _)
 {
     return(_.FK_ShipToCustomerAddress.Join(CustomerAddress._));
 }
Exemplo n.º 6
0
 private KeyMapping FK_SalesOrderHeader_Customer_CustomerID(SalesOrderHeader _)
 {
     return(_.FK_Customer.Join(Customer._));
 }
Exemplo n.º 7
0
 private DbSet <SalesOrderHeader> GetSalesOrderHeaders(_String filterText)
 {
     return(SalesOrderHeader.Where(_ => _.SalesOrderNumber.Contains(filterText) | _.PurchaseOrderNumber.Contains(filterText)));
 }
Exemplo n.º 8
0
 public Task <int> DeleteSalesOrderAsync(DataSet <SalesOrderHeader.Key> dataSet, CancellationToken ct = default(CancellationToken))
 {
     return(SalesOrderHeader.DeleteAsync(dataSet, (s, _) => s.Match(_), ct));
 }