private static void GenProduction(int nRecords, RosieEvent rosieEvent) { List <ProductItem> productItems = ProductItem.GetProductItems(); int count = productItems.Count; Random randGen = new Random(); for (int i = 0; i < nRecords; i++) { try { ProductItem slctPrdItem = productItems[randGen.Next(0, count - 1)]; Production productionToBeCreated = new Production(); productionToBeCreated.ProductItemID = slctPrdItem.Id; productionToBeCreated.Quantity = (short)randGen.Next(0, 200); //Set valid dates productionToBeCreated.ProductionDate = DateTime.Now.AddDays(-1 * randGen.Next(0, nRecords)) .AddHours(-1 * randGen.Next(0, 12)).AddMinutes(-1 * randGen.Next(0, 30)); productionToBeCreated.ExpiryDate = DateTime.Now.AddDays(randGen.Next(5, nRecords + 5)) .AddHours(randGen.Next(0, 12)).AddMinutes(randGen.Next(0, 30)); productionToBeCreated.Create(); //Console.WriteLine(productionToBeCreated); // Add production to event GenEventProduct(Production.GetLastID(), productionToBeCreated.Quantity, rosieEvent); } catch { } } }
/// <summary> /// Load data into the comboboxes /// </summary> private void loadCmb() { cmbProductName.DataSource = ProductItem.GetProductItems(); if (productItemToSelect != null) { selectProductInForm(productItemToSelect); } }
/// <summary> /// Load comboboxes /// </summary> private void loadCmbs() { productItems = ProductItem.GetProductItems(); cmbProductName.DataSource = productItems; cmbProductName.DisplayMember = "Product.Name"; loadEventCmb(DateTime.Now); }
/// <summary> /// Load combobox/dropdown data /// </summary> private void loadCmbs() { //Load products combobox cmbProduct.DataSource = ProductItem.GetProductItems(); cmbNutrType.DataSource = Nutrition.GetNutritions(); cmbNutrType.DisplayMember = "Name"; cmbValType.DataSource = valueTypes.Keys.ToList <string>(); }
/// <summary> /// Load comboboxes into form /// </summary> private void loadCmb() { cmbProductName.DataSource = ProductItem.GetProductItems(); loadIngredientCmbs(); cmbUnits.SelectedIndex = 0; }