/// <summary> /// Application entry point. /// Opens USDA Nutrient database (revision 26), denormalizes it using UsdaDenormalizer library /// and writes result to a CSV file with a specified name. /// </summary> /// <param name="args"> /// [0] path to the directory containing ASCII version of database /// [1] path to the output CSV file /// </param> private static void Main(string[] args) { // check if input is valid if (args.Length > 1) { var inputDirectoryPath = args[0]; var outputCsvPath = args[1]; if (Directory.Exists(inputDirectoryPath)) { // read nutrient data from files in filesystem to object model in memory var dataProvider = new DirectoryDataProvider(inputDirectoryPath, 26, new WindowsTextReader()); var dbModel = new DatabaseRepresentation(dataProvider); // create denormalized (flat) model based using database data var denormalizedModel = new DenormalizedModel(dbModel); // write flat model into CSV file as one big table using (var writer = File.CreateText(outputCsvPath)) { var csvWriter = new CsvWriter(writer); csvWriter.WriteRecords(denormalizedModel.FoodItems); } } else { throw new ArgumentException( "Specified directory does not exist or you don't have an access to it: " + inputDirectoryPath); } } else { throw new ArgumentException("No arguments were provided."); } }
private void RefreshTables(bool newData = false) { DatabaseRepresentation dataSet = DatabaseHandler.DataSet; dataSet.Models.Clear(); dataSet.Manufacturers.Clear(); modelsDbHandler.Adapter.Fill(dataSet.Models); manufacturersDbHandler.Adapter.Fill(dataSet.Manufacturers); modelsDataGridView.Refresh(); manufacturersDataGridView.Refresh(); }
public ActionResult AddRecipeItem() { ViewBag.IngradientName = new SelectList(DatabaseRepresentation.GetIngradients(), "IngradientName", "IngradientName"); return(View()); }
public ActionResult Sallary() { ViewBag.SellerName = new SelectList(DatabaseRepresentation.GetSellers(), "SellerName", "SellerName"); return(View()); }
public ActionResult Revenue() { ViewBag.SellingPointTitle = new SelectList(DatabaseRepresentation.GetSellingPoints(), "ShawarmaTitle", "ShawarmaTitle"); return(View()); }
public ActionResult AddIngredient() { ViewBag.CategoryName = new SelectList(DatabaseRepresentation.GetIngredientCategories(), "CategoryName", "CategoryName"); return(View()); }
public ActionResult AddSellingPoint() { ViewBag.SellingPointCategory = new SelectList(DatabaseRepresentation.GetSellingPointCategories(), "SellingPointCategoryName", "SellingPointCategoryName"); return(View()); }