private void btnEdit_Click(object sender, RoutedEventArgs e) { KeyValuePair <Route, AirlinerClass.ClassType> type = (KeyValuePair <Route, AirlinerClass.ClassType>)((Button)sender).Tag; RouteAirlinerClass aClass = (RouteAirlinerClass)PopUpRouteFacilities.ShowPopUp(this.Classes[type.Key][type.Value]); if (aClass != null) { foreach (RouteFacility facility in aClass.getFacilities()) { this.Classes[type.Key][type.Value].addFacility(facility); } double rate = 1; if (GameObject.GetInstance().CurrencyCountry != null) { CountryCurrency currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime); rate = currency == null ? 1 : currency.Rate; } this.Classes[type.Key][type.Value].FarePrice = aClass.FarePrice / rate; this.Classes[type.Key][type.Value].Seating = aClass.Seating; } }
private void btnEditCargo_Click(object sender, RoutedEventArgs e) { double rate = 1; if (GameObject.GetInstance().CurrencyCountry != null) { CountryCurrency currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime); rate = currency == null ? 1 : currency.Rate; } TextBox tbCargoPrice = new TextBox(); tbCargoPrice.Text = string.Format("{0:0.00}", this.CargoPrice * rate); tbCargoPrice.TextAlignment = TextAlignment.Left; tbCargoPrice.Width = 100; tbCargoPrice.Background = Brushes.Transparent; tbCargoPrice.SetResourceReference(TextBox.ForegroundProperty, "TextColor"); tbCargoPrice.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PanelNewRoute", "1008"), tbCargoPrice) == PopUpSingleElement.ButtonSelected.OK && tbCargoPrice.Text.Length > 0) { this.CargoPrice = Convert.ToDouble(tbCargoPrice.Text) / rate; txtCargo.Text = new ValueCurrencyConverter().Convert(this.CargoPrice).ToString(); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { int amount = (int)value; if (GameObject.GetInstance().CurrencyCountry == null) { return(string.Format("{0:C}", value)); } CountryCurrency currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime); if (currency == null) { return(string.Format("{0:C}", value)); } else { string sFormat = Translator.GetInstance().GetString("General", "2000"); double v = amount * currency.Rate; if (currency.Position == CountryCurrency.CurrencyPosition.Right) { return(string.Format("{0:#,0.##} {2} {1}", v, currency.CurrencySymbol, sFormat)); } else { return(string.Format("{1}{0:#,0.##} {2}", v, currency.CurrencySymbol, sFormat)); } } }
public async void UnassignCountryCurrency(int countryId, int currencyId) { CountryCurrency countryCurrency = await FindByCountryIdAndCurrencyId(countryId, currencyId); if (countryCurrency == null) { Remove(countryCurrency); } }
public async Task AssignCountryCurrency(int countryId, int currencyId) { CountryCurrency countryCurrency = await FindByCountryIdAndCurrencyId(countryId, currencyId); if (countryCurrency == null) { countryCurrency = new CountryCurrency { CountryId = countryId, CurrencyId = currencyId }; await AddAsync(countryCurrency); } }
public async Task <CountryCurrencyResponse> UnassignCountryCurrencyAsync(int countryId, int currencyId) { try { CountryCurrency countryCurrency = await _countryCurrencyRepository.FindByCountryIdAndCurrencyId(countryId, currencyId); _countryCurrencyRepository.Remove(countryCurrency); await _unitOfWork.CompleteAsync(); return(new CountryCurrencyResponse(countryCurrency)); } catch (Exception ex) { return(new CountryCurrencyResponse($"An error ocurred while assigning Currency to Country: {ex.Message}")); } }
public static OnlineStoreDbContext SeedCountryCurrencies(this OnlineStoreDbContext dbContext) { var countryCurrency = new CountryCurrency { CountryID = 1, CurrencyID = "USD", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.CountryCurrencies.Add(countryCurrency); dbContext.SaveChanges(); return(dbContext); }
public void InsertCurrencies(Country country, int index) { string property = "currencies"; if (allCountries[index][property].HasValues) { country.CountryCurrencies = new List <CountryCurrency>(4); int len = allCountries[index][property].Count(); for (int i = 0; i < len; i++) { var o = new CountryCurrency(); o.CurrencyName = GetSafeStringArray(index, property, i); if (!string.IsNullOrEmpty(o.CurrencyName)) { country.CountryCurrencies.Add(o); } } } }
//adds a currency to the country public void addCurrency(CountryCurrency currency) { this.Currencies.Add(currency); }
public void Remove(CountryCurrency countryCurrency) { _context.CountryCurrencies.Remove(countryCurrency); }
public async Task AddAsync(CountryCurrency countryCurrency) { await _context.CountryCurrencies.AddAsync(countryCurrency); }
public static void SeedInMemory(this OnlineStoreDbContext dbContext) { var creationUser = "******"; var creationDateTime = DateTime.Now; var country = new Country { CountryID = 1, CountryName = "USA", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Countries.Add(country); var currency = new Currency { CurrencyID = "USD", CurrencyName = "US Dollar", CurrencySymbol = "$", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Currencies.Add(currency); var countryCurrency = new CountryCurrency { CountryID = country.CountryID, CurrencyID = currency.CurrencyID, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.CountryCurrencies.Add(countryCurrency); dbContext.SaveChanges(); var employee = new Employee { EmployeeID = 1, FirstName = "John", LastName = "Doe", BirthDate = DateTime.Now.AddYears(-25), CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Employees.Add(employee); dbContext.SaveChanges(); var productCategory = new ProductCategory { ProductCategoryID = 1, ProductCategoryName = "PS4 Games", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.ProductCategories.Add(productCategory); var product = new Product { ProductID = 1, ProductName = "The King of Fighters XIV", ProductCategoryID = 1, UnitPrice = 29.99m, Description = "KOF XIV", Discontinued = false, Stocks = 15000, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Products.Add(product); var location = new Location { LocationID = "W0001", LocationName = "Warehouse 001", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Warehouses.Add(location); var productInventory = new ProductInventory { ProductID = product.ProductID, LocationID = location.LocationID, OrderDetailID = 1, Quantity = 1500, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.ProductInventories.Add(productInventory); dbContext.SaveChanges(); var orderStatus = new OrderStatus { OrderStatusID = 100, Description = "Created", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.OrderStatuses.Add(orderStatus); var paymentMethod = new PaymentMethod { PaymentMethodID = Guid.NewGuid(), PaymentMethodDescription = "Credit Card", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.PaymentMethods.Add(paymentMethod); var customer = new Customer { CustomerID = 1, CompanyName = "Best Buy", ContactName = "Colleen Dunn", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Customers.Add(customer); var shipper = new Shipper { ShipperID = 1, CompanyName = "DHL", ContactName = "Ricardo A. Bartra", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Shippers.Add(shipper); var order = new OrderHeader { OrderStatusID = orderStatus.OrderStatusID, CustomerID = customer.CustomerID, EmployeeID = employee.EmployeeID, OrderDate = DateTime.Now, Total = 29.99m, CurrencyID = "USD", PaymentMethodID = paymentMethod.PaymentMethodID, Comments = "Order from unit tests", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Orders.Add(order); var orderDetail = new OrderDetail { OrderHeaderID = order.OrderHeaderID, ProductID = product.ProductID, ProductName = product.ProductName, UnitPrice = 29.99m, Quantity = 1, Total = 29.99m, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.OrderDetails.Add(orderDetail); dbContext.SaveChanges(); }
public async Task <ActionResult> PopulateDatabase() { if (this.context.Countries.Any() == false) { var httpClient = new HttpClient(); var countriesAsString = await httpClient.GetStringAsync("https://restcountries.eu/rest/v2/all"); var countriesAsJson = JsonConvert.DeserializeObject <List <CountryCreateApiBindingModel> >(countriesAsString); foreach (var countryCreateModel in countriesAsJson) { var country = new Country { Name = countryCreateModel.Name, Alpha2Code = countryCreateModel.Alpha2Code, Aplha3Code = countryCreateModel.Aplha3Code, Capital = countryCreateModel.Capital, Region = countryCreateModel.Region, SubRegion = countryCreateModel.SubRegion, Population = countryCreateModel.Population, Demonym = countryCreateModel.Demonym, Area = countryCreateModel.Area, Gini = countryCreateModel.Gini, NativeName = countryCreateModel.NativeName, NumericCode = countryCreateModel.NumericCode, FlagUrl = countryCreateModel.FlagUrl, Cioc = countryCreateModel.Cioc, }; foreach (var internetDomainAsString in countryCreateModel.Domains) { var internetDomain = new InternetDomain { Name = internetDomainAsString, Country = country }; this.context.InternetDomains.Add(internetDomain); } foreach (var callingCodeAsString in countryCreateModel.CallingCodes) { var callingCode = new CallingCode { Name = callingCodeAsString, CountryId = country.Id }; this.context.CallingCodes.Add(callingCode); } foreach (var altSpellingAsString in countryCreateModel.AlternativeSpellings) { var alternativeSpelling = new AlternativeSpelling { Name = altSpellingAsString, Country = country }; this.context.AlternativeSpellings.Add(alternativeSpelling); } if (countryCreateModel.Coordinates.Count == 2) { var coordinates = new Coordinates { Latitude = countryCreateModel.Coordinates[0], Longitude = countryCreateModel.Coordinates[1] }; country.Coordinates = coordinates; } else { var coordinates = new Coordinates { Latitude = 50, Longitude = 50 }; country.Coordinates = coordinates; } foreach (var timeZomeAsString in countryCreateModel.TimeZones) { var timeZone = new Countries.Domain.TimeZone { Name = timeZomeAsString }; if (this.context.TimeZones.Any(tz => tz.Name == timeZone.Name) == false) { this.context.TimeZones.Add(timeZone); var countryTimeZone = new CountryTimeZone { Country = country, TimeZone = timeZone }; this.context.CountryTimeZone.Add(countryTimeZone); } } foreach (var borderAsString in countryCreateModel.Borders) { var border = new Border { Name = borderAsString }; if (this.context.Borders.Any(tz => tz.Name == border.Name) == false) { this.context.Borders.Add(border); var countryBorder = new CountryBorder { Country = country, Border = border }; this.context.CountryBorder.Add(countryBorder); } } foreach (var currencyCreateModel in countryCreateModel.Currencies) { var currency = new Currency { Code = currencyCreateModel.Code, Name = currencyCreateModel.Name, Symbol = currencyCreateModel.Symbol }; if (this.context.Currencies.Any(c => c.Code == currency.Code) == false) { this.context.Currencies.Add(currency); var countryCurrency = new CountryCurrency { Country = country, Currency = currency }; this.context.CountryCurrency.Add(countryCurrency); } } foreach (var languageCreateModel in countryCreateModel.Languages) { var language = new Language { Iso639_1 = languageCreateModel.Iso639_1, Iso639_2 = languageCreateModel.Iso639_2, Name = languageCreateModel.Name, NativeName = languageCreateModel.NativeName, }; if (this.context.Languages.Any(l => l.Name == language.Name) == false) { this.context.Languages.Add(language); var countryLanguage = new CountryLanguage { Country = country, Language = language }; this.context.CountryLanguage.Add(countryLanguage); } } var translations = new Translations { De = countryCreateModel.Translations.De, Es = countryCreateModel.Translations.Es, Fr = countryCreateModel.Translations.Fr, Ja = countryCreateModel.Translations.Ja, It = countryCreateModel.Translations.It, Br = countryCreateModel.Translations.Br, Pt = countryCreateModel.Translations.Pt, Nl = countryCreateModel.Translations.Nl, Hr = countryCreateModel.Translations.Hr, Fa = countryCreateModel.Translations.Fa, }; country.Translations = translations; foreach (var blockCreateModel in countryCreateModel.Blocks) { var regionalBlock = new RegionalBlock { Acronym = blockCreateModel.Acronym, Name = blockCreateModel.Name }; if (this.context.RegionalBlocks.Any(rb => rb.Name == regionalBlock.Name) == false) { this.context.RegionalBlocks.Add(regionalBlock); var countryRegionalBlock = new CountryRegionalBlock { Country = country, RegionalBlock = regionalBlock }; this.context.CountryRegionalBlock.Add(countryRegionalBlock); } } this.context.Countries.Add(country); this.context.SaveChanges(); } return(this.Ok($"Successfully populated table with {this.context.Countries.Count()} countries.")); } return(this.Ok("Database is already populated.")); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { double v = Double.Parse(value.ToString()); if (GameObject.GetInstance().CurrencyCountry == null || Double.IsInfinity(v)) { return(string.Format("{0:C}", value)); } else { CountryCurrency currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime); if (currency == null) { if (Settings.GetInstance().CurrencyShorten) { if (v >= 1000000000 || v <= -1000000000) { return(string.Format("{0:C} {1}", v / 1000000000, Translator.GetInstance().GetString("General", "2001"))); } if (v >= 1000000 || v <= -1000000) { return(string.Format("{0:C} {1}", v / 1000000, Translator.GetInstance().GetString("General", "2000"))); } return(string.Format("{0:C}", value)); } else { return(string.Format("{0:C}", value)); } } else { double currencyValue = v * currency.Rate; if (Settings.GetInstance().CurrencyShorten) { if (currencyValue >= 1000000 || currencyValue <= -1000000) { double sValue = currencyValue / 1000000; string sFormat = Translator.GetInstance().GetString("General", "2000"); if (currencyValue >= 1000000000 || currencyValue <= -1000000000) { sValue = currencyValue / 1000000000; sFormat = Translator.GetInstance().GetString("General", "2001"); } if (currency.Position == CountryCurrency.CurrencyPosition.Right) { return(string.Format("{0:#,0.##} {2} {1}", sValue, currency.CurrencySymbol, sFormat)); } else { return(string.Format("{1}{0:#,0.##} {2}", sValue, currency.CurrencySymbol, sFormat)); } } else { if (currency.Position == CountryCurrency.CurrencyPosition.Right) { return(string.Format("{0:#,0.##} {1}", currencyValue, currency.CurrencySymbol)); } else { return(string.Format("{1}{0:#,0.##}", currencyValue, currency.CurrencySymbol)); } } } else { if (currency.Position == CountryCurrency.CurrencyPosition.Right) { return(string.Format("{0:#,0.##} {1}", currencyValue, currency.CurrencySymbol)); } else { return(string.Format("{1}{0:#,0.##}", currencyValue, currency.CurrencySymbol)); } } } } } catch (Exception) { return(string.Format("{0:C}", value)); } }
public PopUpRouteFacilities(RouteAirlinerClass aClass) { this.cbFacilities = new List <ComboBox>(); this.Uid = "1000"; this.AirlinerClass = new RouteAirlinerClass(aClass.Type, aClass.Seating, aClass.FarePrice); foreach (RouteFacility facility in aClass.getFacilities()) { this.AirlinerClass.addFacility(facility); } InitializeComponent(); this.Title = Translator.GetInstance().GetString("PopUpRouteFacilities", this.Uid); this.Width = 400; this.Height = 250; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel contentPanel = new StackPanel(); ListBox lbRouteInfo = new ListBox(); lbRouteInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbRouteInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); contentPanel.Children.Add(lbRouteInfo); foreach (RouteFacility.FacilityType type in Enum.GetValues(typeof(RouteFacility.FacilityType))) { if (GameObject.GetInstance().GameTime.Year >= (int)type) { ComboBox cbFacility = new ComboBox(); cbFacility.Background = Brushes.Transparent; cbFacility.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbFacility.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; cbFacility.DisplayMemberPath = "Name"; cbFacility.SelectedValuePath = "Name"; cbFacility.Tag = type; cbFacility.Width = 150; foreach (RouteFacility facility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, type)) { cbFacility.Items.Add(facility); } cbFacilities.Add(cbFacility); lbRouteInfo.Items.Add(new QuickInfoValue(new TextUnderscoreConverter().Convert(type).ToString(), cbFacility)); cbFacility.SelectedItem = this.AirlinerClass.getFacility(type); } } // chs, 2011-18-10 added for type of seating cbSeating = new ComboBox(); cbSeating.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle"); cbSeating.Width = 150; cbSeating.ItemTemplate = this.Resources["SeatingItem"] as DataTemplate; foreach (RouteAirlinerClass.SeatingType sType in Enum.GetValues(typeof(RouteAirlinerClass.SeatingType))) { cbSeating.Items.Add(sType); } lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpRouteFacilities", "1004"), cbSeating)); WrapPanel panelPrice = new WrapPanel(); txtPrice = new TextBox(); txtPrice.Background = Brushes.Transparent; txtPrice.Width = 100; txtPrice.TextAlignment = TextAlignment.Right; txtPrice.Margin = new Thickness(2, 0, 0, 0); txtPrice.PreviewKeyDown += new KeyEventHandler(txtPrice_PreviewKeyDown); txtPrice.PreviewTextInput += new TextCompositionEventHandler(txtPrice_PreviewTextInput); txtPrice.TextChanged += new TextChangedEventHandler(txtPrice_TextChanged); panelPrice.Children.Add(txtPrice); CultureInfo cultureInfo = new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, false); CountryCurrency currency = null; if (GameObject.GetInstance().CurrencyCountry != null) { currency = GameObject.GetInstance().CurrencyCountry.getCurrency(GameObject.GetInstance().GameTime); } TextBlock txtCurrencySign = UICreator.CreateTextBlock(currency == null ? cultureInfo.NumberFormat.CurrencySymbol : currency.CurrencySymbol); txtCurrencySign.VerticalAlignment = System.Windows.VerticalAlignment.Center; panelPrice.Children.Add(txtCurrencySign); lbRouteInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpRouteFacilities", "1005"), panelPrice)); WrapPanel panelButtons = new WrapPanel(); panelButtons.Margin = new Thickness(0, 5, 0, 0); contentPanel.Children.Add(panelButtons); btnOk = new Button(); btnOk.Uid = "100"; btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnOk.Height = Double.NaN; btnOk.Width = Double.NaN; btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid); btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); //btnOk.Margin = new System.Windows.Thickness(0, 5, 0, 0); btnOk.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnOk.Click += new RoutedEventHandler(btnOk_Click); btnOk.IsEnabled = false; panelButtons.Children.Add(btnOk); Button btnCancel = new Button(); btnCancel.Uid = "101"; btnCancel.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnCancel.Height = Double.NaN; btnCancel.Width = Double.NaN; btnCancel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btnCancel.Click += new RoutedEventHandler(btnCancel_Click); btnCancel.Margin = new Thickness(5, 0, 0, 0); btnCancel.Content = Translator.GetInstance().GetString("General", btnCancel.Uid); btnCancel.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); panelButtons.Children.Add(btnCancel); this.Content = contentPanel; double fareprice = currency == null ? this.AirlinerClass.FarePrice : this.AirlinerClass.FarePrice * currency.Rate; txtPrice.Text = String.Format("{0:0.##}", fareprice); cbSeating.SelectedItem = this.AirlinerClass.Seating; }
public static void SeedInMemory(this StoreDbContext dbContext) { var creationUser = "******"; var creationDateTime = DateTime.Now; var country = new Country { CountryID = 1, CountryName = "USA", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Country>().Add(country); var currency = new Currency { CurrencyID = 1000, CurrencyName = "US Dollar", CurrencySymbol = "$", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Currency>().Add(currency); dbContext.SaveChanges(); var countryCurrency = new CountryCurrency { CountryID = country.CountryID, CurrencyID = currency.CurrencyID, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <CountryCurrency>().Add(countryCurrency); dbContext.SaveChanges(); var employee = new Employee { EmployeeID = 1, FirstName = "John", LastName = "Doe", BirthDate = DateTime.Now.AddYears(-25), CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Employee>().Add(employee); dbContext.SaveChanges(); var productCategory = new ProductCategory { ProductCategoryID = 1, ProductCategoryName = "PS4 Games", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <ProductCategory>().Add(productCategory); dbContext.SaveChanges(); var product = new Product { ProductID = 1, ProductName = "The King of Fighters XIV", ProductCategoryID = 1, UnitPrice = 29.99m, Description = "KOF XIV", Discontinued = false, Stocks = 15000, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Product>().Add(product); dbContext.SaveChanges(); var warehouse = new Warehouse { WarehouseID = "W0001", WarehouseName = "Warehouse 001", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Warehouse>().Add(warehouse); dbContext.SaveChanges(); var productInventory = new ProductInventory { ProductID = product.ProductID, WarehouseID = warehouse.WarehouseID, Stocks = 1500, Quantity = 1500, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <ProductInventory>().Add(productInventory); dbContext.SaveChanges(); var foo = dbContext.Set <ProductInventory>().ToList(); var orderStatus = new OrderStatus { OrderStatusID = 100, Description = "Created", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <OrderStatus>().Add(orderStatus); dbContext.SaveChanges(); var paymentMethod = new PaymentMethod { PaymentMethodID = Guid.NewGuid(), PaymentMethodDescription = "Credit Card", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <PaymentMethod>().Add(paymentMethod); dbContext.SaveChanges(); var customer = new Customer { CustomerID = 1, CompanyName = "Best Buy", ContactName = "Colleen Dunn", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Customer>().Add(customer); dbContext.SaveChanges(); var shipper = new Shipper { ShipperID = 1, CompanyName = "DHL", ContactName = "Ricardo A. Bartra", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Shipper>().Add(shipper); dbContext.SaveChanges(); var order = new Order { OrderStatusID = 100, CustomerID = 1, EmployeeID = 1, ShipperID = 1, OrderDate = DateTime.Now, Total = 29.99m, CurrencyID = 1000, PaymentMethodID = paymentMethod.PaymentMethodID, Comments = "Order from mocks", CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <Order>().Add(order); dbContext.SaveChanges(); var orderDetail = new OrderDetail { OrderID = order.OrderID, ProductID = 1, ProductName = "The King of Fighters XIV", UnitPrice = 29.99m, Quantity = 1, Total = 29.99m, CreationUser = creationUser, CreationDateTime = creationDateTime }; dbContext.Set <OrderDetail>().Add(orderDetail); dbContext.SaveChanges(); }