コード例 #1
0
        /// <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.");
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public ActionResult AddRecipeItem()
 {
     ViewBag.IngradientName = new SelectList(DatabaseRepresentation.GetIngradients(), "IngradientName",
                                             "IngradientName");
     return(View());
 }
コード例 #4
0
 public ActionResult Sallary()
 {
     ViewBag.SellerName = new SelectList(DatabaseRepresentation.GetSellers(), "SellerName", "SellerName");
     return(View());
 }
コード例 #5
0
 public ActionResult Revenue()
 {
     ViewBag.SellingPointTitle = new SelectList(DatabaseRepresentation.GetSellingPoints(), "ShawarmaTitle",
                                                "ShawarmaTitle");
     return(View());
 }
コード例 #6
0
 public ActionResult AddIngredient()
 {
     ViewBag.CategoryName = new SelectList(DatabaseRepresentation.GetIngredientCategories(), "CategoryName", "CategoryName");
     return(View());
 }
コード例 #7
0
 public ActionResult AddSellingPoint()
 {
     ViewBag.SellingPointCategory = new SelectList(DatabaseRepresentation.GetSellingPointCategories(),
                                                   "SellingPointCategoryName", "SellingPointCategoryName");
     return(View());
 }