private Invoices Map(InvoicesRow row, string[] fieldNames)
        {
            var hasFn = fieldNames != null && fieldNames.Any();
            var item  = new Invoices();

            if (!hasFn || fieldNames.Contains("ShipName", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipName = row.ShipName;
            }
            if (!hasFn || fieldNames.Contains("ShipAddress", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipAddress = row.ShipAddress;
            }
            if (!hasFn || fieldNames.Contains("ShipCity", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipCity = row.ShipCity;
            }
            if (!hasFn || fieldNames.Contains("ShipRegion", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipRegion = row.ShipRegion;
            }
            if (!hasFn || fieldNames.Contains("ShipPostalCode", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipPostalCode = row.ShipPostalCode;
            }
            if (!hasFn || fieldNames.Contains("ShipCountry", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipCountry = row.ShipCountry;
            }
            if (!hasFn || fieldNames.Contains("CustomerId", StringComparer.OrdinalIgnoreCase))
            {
                item.CustomerId = row.CustomerId;
            }
            if (!hasFn || fieldNames.Contains("CustomerName", StringComparer.OrdinalIgnoreCase))
            {
                item.CustomerName = row.CustomerName;
            }
            if (!hasFn || fieldNames.Contains("Address", StringComparer.OrdinalIgnoreCase))
            {
                item.Address = row.Address;
            }
            if (!hasFn || fieldNames.Contains("City", StringComparer.OrdinalIgnoreCase))
            {
                item.City = row.City;
            }
            if (!hasFn || fieldNames.Contains("Region", StringComparer.OrdinalIgnoreCase))
            {
                item.Region = row.Region;
            }
            if (!hasFn || fieldNames.Contains("PostalCode", StringComparer.OrdinalIgnoreCase))
            {
                item.PostalCode = row.PostalCode;
            }
            if (!hasFn || fieldNames.Contains("Country", StringComparer.OrdinalIgnoreCase))
            {
                item.Country = row.Country;
            }
            if (!hasFn || fieldNames.Contains("Salesperson", StringComparer.OrdinalIgnoreCase))
            {
                item.Salesperson = row.Salesperson;
            }
            if (!hasFn || fieldNames.Contains("OrderId", StringComparer.OrdinalIgnoreCase))
            {
                item.OrderId = row.OrderId;
            }
            if (!hasFn || fieldNames.Contains("OrderDate", StringComparer.OrdinalIgnoreCase))
            {
                item.OrderDate = row.OrderDate;
            }
            if (!hasFn || fieldNames.Contains("RequiredDate", StringComparer.OrdinalIgnoreCase))
            {
                item.RequiredDate = row.RequiredDate;
            }
            if (!hasFn || fieldNames.Contains("ShippedDate", StringComparer.OrdinalIgnoreCase))
            {
                item.ShippedDate = row.ShippedDate;
            }
            if (!hasFn || fieldNames.Contains("ShipperName", StringComparer.OrdinalIgnoreCase))
            {
                item.ShipperName = row.ShipperName;
            }
            if (!hasFn || fieldNames.Contains("ProductId", StringComparer.OrdinalIgnoreCase))
            {
                item.ProductId = row.ProductId;
            }
            if (!hasFn || fieldNames.Contains("ProductName", StringComparer.OrdinalIgnoreCase))
            {
                item.ProductName = row.ProductName;
            }
            if (!hasFn || fieldNames.Contains("UnitPrice", StringComparer.OrdinalIgnoreCase))
            {
                item.UnitPrice = row.UnitPrice;
            }
            if (!hasFn || fieldNames.Contains("Quantity", StringComparer.OrdinalIgnoreCase))
            {
                item.Quantity = row.Quantity;
            }
            if (!hasFn || fieldNames.Contains("Discount", StringComparer.OrdinalIgnoreCase))
            {
                item.Discount = row.Discount;
            }
            if (!hasFn || fieldNames.Contains("ExtendedPrice", StringComparer.OrdinalIgnoreCase))
            {
                item.ExtendedPrice = row.ExtendedPrice;
            }
            if (!hasFn || fieldNames.Contains("Freight", StringComparer.OrdinalIgnoreCase))
            {
                item.Freight = row.Freight;
            }


            return(item);
        }
コード例 #2
0
 public void AddInvoicesRow(InvoicesRow row) {
     this.Rows.Add(row);
 }
コード例 #3
0
 public void RemoveInvoicesRow(InvoicesRow row) {
     this.Rows.Remove(row);
 }
コード例 #4
0
 public InvoicesRowChangeEvent(InvoicesRow row, System.Data.DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }