Пример #1
0
        public static ClientEvent ToGoalOutcome(this IDataRow dataRow)
        {
            var result = new ClientEvent();
            var email  = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == Constants.DemoGoal.CustomerIdKey);

            if (email != null)
            {
                result.Email = dataRow.GetString(dataRow.Schema.GetFieldIndex(Constants.DemoGoal.CustomerIdKey));
            }

            var date = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == Constants.DemoGoal.ProjectionTimestamp);

            if (date != null)
            {
                result.TimeStamp = dataRow.GetDateTime(dataRow.Schema.GetFieldIndex(Constants.DemoGoal.ProjectionTimestamp));
            }

            var price = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == Constants.DemoGoal.ProjectionEngagementValue);

            if (price != null)
            {
                result.Value = (decimal)dataRow.GetDouble(dataRow.Schema.GetFieldIndex(Constants.DemoGoal.ProjectionEngagementValue));
            }

            return(result);
        }
Пример #2
0
        public static PurchaseInvoice ToPurchaseOutcome(this IDataRow dataRow)
        {
            var result     = new PurchaseInvoice();
            var customerId = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.CustomerId));

            if (customerId != null)
            {
                result.ContactId = (int)dataRow.GetInt64(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.CustomerId)));
            }
            var invoiceId = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.InvoiceId));

            if (invoiceId != null)
            {
                result.Number = (int)dataRow.GetInt64(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.InvoiceId)));
            }

            var quantity = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.Quantity));

            if (quantity != null)
            {
                result.Quantity = (int)dataRow.GetInt64(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.Quantity)));
            }

            var date = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.Timestamp));

            if (date != null)
            {
                result.TimeStamp = dataRow.GetDateTime(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.Timestamp)));
            }

            var price = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.UnitPrice));

            if (price != null)
            {
                result.Price = (decimal)dataRow.GetDouble(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.UnitPrice)));
            }

            var productId = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseOutcome.ProductId));

            if (productId != null)
            {
                result.StockCode = dataRow.GetString(dataRow.Schema.GetFieldIndex(nameof(PurchaseOutcome.ProductId)));
            }

            var country = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == "Country");

            if (country != null)
            {
                result.Country = dataRow.GetString(dataRow.Schema.GetFieldIndex("Country"));
            }

            return(result);
        }
        public static PurchaseInvoice ToPurchaseOutcome(this IDataRow dataRow)
        {
            var result = new PurchaseInvoice
            {
                StockCode = dataRow.GetString(dataRow.Schema.GetFieldIndex(nameof(PurchaseInvoice.StockCode))),
                Quantity  = (int)dataRow.GetInt64(dataRow.Schema.GetFieldIndex(nameof(PurchaseInvoice.Quantity))),
                TimeStamp = dataRow.GetDateTime(dataRow.Schema.GetFieldIndex(nameof(PurchaseInvoice.TimeStamp))),
                Price     = (decimal)dataRow.GetDouble(dataRow.Schema.GetFieldIndex(nameof(PurchaseInvoice.Price)))
            };

            var country = dataRow.Schema.Fields.FirstOrDefault(x => x.Name == nameof(PurchaseInvoice.Country));

            if (country != null)
            {
                result.Country = dataRow.GetString(dataRow.Schema.GetFieldIndex(nameof(PurchaseInvoice.Country)));
            }

            return(result);
        }