public string ValidateOutput(string _choices, int fc, Mealtime mealtime)
        {
            List <Dish> list = new List <Dish>();

            _choices = _choices.Substring(fc, _choices.Length - fc);
            string[] choices = _choices.Split(',', StringSplitOptions.RemoveEmptyEntries);



            foreach (var item in choices)
            {
                int choice = int.TryParse(item, out choice) ? choice : 0;
                list.Add(Request(mealtime, (DishType)choice));
            }
            list = ValidateDishes(list);

            list = list.OrderBy(x => x.Id).ToList();

            string result = "";

            foreach (var d in list)
            {
                result += String.Format("{0}, ", d.DishName);
            }
            return(result[0..^ 2]);
示例#2
0
 public Dish(int id, DishType type, Mealtime mealtime, string dishName, bool multipleOrders)
 {
     Id             = id;
     Type           = type;
     _Mealtime      = mealtime;
     DishName       = dishName;
     MultipleOrders = multipleOrders;
 }
示例#3
0
        private static void WriteMealtime(Mealtime m, Font font, Font subheaderFont)
        {
            if (m.Products.Count != 0)
            {
                PdfPCell cell = new PdfPCell();
                cell.Border = 0;

                if (m.Name == "Завтрак")
                {
                    cell = WriteMealtimeImage(Directory.GetCurrentDirectory() + @"/Pictures/Завтрак.png");
                }
                else if (m.Name == "Обед")
                {
                    cell = WriteMealtimeImage(Directory.GetCurrentDirectory() + @"/Pictures/Обед.png");
                }
                else if (m.Name == "Ужин")
                {
                    cell = WriteMealtimeImage(Directory.GetCurrentDirectory() + @"/Pictures/Ужин.png");
                }
                else
                {
                    cell = WriteMealtimeImage(Directory.GetCurrentDirectory() + @"/Pictures/mealtime.png");
                }

                ration.AddCell(cell);

                mealtime = new PdfPTable(1);

                cell        = new PdfPCell();
                cell.Phrase = new Phrase(m.Name, subheaderFont);
                cell.Border = 0;
                mealtime.AddCell(cell);

                foreach (Product p in m.Products)
                {
                    cell        = new PdfPCell();
                    cell.Phrase = new Phrase(p.Name + ", " + p.Weight + "г\n", font);
                    cell.Border = 0;
                    mealtime.AddCell(cell);
                }

                PdfPCell mealtimeCell = new PdfPCell(mealtime);
                mealtimeCell.Border = 0;
                ration.AddCell(mealtimeCell);
            }
        }
 public Dish Request(Mealtime mealtime, DishType dishType)
 {
     return(GetDish(mealtime, dishType));
 }