示例#1
0
        public static List <MolvenoIngredient> ConvertCsv(string path)
        {
            var molvenoIngredients = new List <MolvenoIngredient>();
            var lines = GetLines(path);

            foreach (var line in lines)
            {
                var properties        = line.Split(';');
                var molvenoIngredient = new MolvenoIngredient
                {
                    Description   = properties[0],
                    Brand         = properties[1],
                    Deliverer     = properties[2],
                    ArticleNumber = properties[3],
                    Unit          = properties[4],
                    Quantity      = properties[5],
                    Price         = Convert.ToDecimal(properties[6]) / 100,
                    Vat           = properties[7],
                    PricePerUnit  = Convert.ToDecimal(properties[8]) / 100,
                    Category      = properties[9],
                    Stock         = Convert.ToInt32(properties[10]),
                    StockWorth    = Convert.ToDecimal(properties[11])
                };

                molvenoIngredients.Add(molvenoIngredient);
            }

            return(molvenoIngredients);
        }
示例#2
0
 private static Ingredient ToIngredient(this MolvenoIngredient molvenoIngredient)
 {
     return(new Ingredient
     {
         Name = molvenoIngredient.Description,
         CostPrice = molvenoIngredient.PricePerUnit,
         AddOnCharge = 0.25m,
         Deleted = false,
         Unit = new Unit
         {
             Price = molvenoIngredient.PricePerUnit,
             Amount = molvenoIngredient.Stock,
             MeasurementType = molvenoIngredient.Quantity
         }
     });
 }