예제 #1
0
        //Options User Interface
        //Allows user to Place an order at set location
        //Allows user to view its full order history
        //Allows user to select another location
        //Allows user to sign out
        public static void optionsUI()
        {
            while (true)
            {
                Console.Clear();
                string select;

                Console.WriteLine("1. Place an Order");
                Console.WriteLine("2. View Order History");
                Console.WriteLine("3. Select Another Location");
                Console.WriteLine("4. Sign Out");
                Console.Write("Please select an option: ");

                select = (Console.ReadLine());

                switch (select)
                {
                case "1":
                    if (DateTimeCheck.checkDT())     // will check if user has odered from this location in the last 24 hours
                                                     // or last 2 hours in any location
                    {
                        orderUI();
                    }
                    else
                    {
                        Console.WriteLine();
                        Console.WriteLine("Press any key to return to other options");
                        Console.ReadKey();
                    }
                    break;

                case "2":
                    historyUI();     // send to order history user interface
                    break;

                case "3":
                    locationUI();     // send to reselect a location user interface
                    break;

                case "4":
                    MainUI.startupUI();     // send to Main Menu
                    break;

                default:
                    Console.WriteLine("Invalid Choice");
                    Console.WriteLine("Press any key to try again");
                    Console.ReadKey();
                    break;
                }
            }
        }
        public ActionResult Options()
        {
            if (DateTimeCheck.checkDT() == false)
            {
                ViewBag.Message = String.Format("Must Wait 24 hours before next purchace at this location!");
                return(View());
            }
            else if (DateTimeCheck.check2hour() == false)
            {
                ViewBag.Message = String.Format("Must Wait 2 hours before next purchace at any store!");
                return(View());
            }

            return(View());
        }
예제 #3
0
        public ActionResult Order()
        {
            if (DateTimeCheck.checkDT() == false)
            {
                return(RedirectToAction("Options", "Options"));
            }
            else if (DateTimeCheck.check2hour() == false)
            {
                return(RedirectToAction("Options", "Options"));
            }

            Entity db    = new Entity();
            var    pizza = Repository.GetPizza(db);

            ViewData["Pizza"] = pizza.ToList();

            return(View());
        }
예제 #4
0
        /// <summary>
        /// 初始化输入面板
        /// </summary>
        private void InitInput()
        {
            const int initY = 35;
            const int nextY = 30;

            // 填充控件
            fillSelect.Initialize(data);
            fillSelect.DataModelChanged += (sender, e) => preview.RefreshPreview();

            // 创建输入项
            int  currentY     = initY;
            bool dateTimeFlag = false;

            foreach (var e in data.ElementList)
            {
                if ((int)e.Type >= 200)
                {
                    CreateItemInInput(currentY, e);
                    currentY += nextY;
                }
                else
                {
                    switch (e.Type)
                    {
                    case ElementType.Text:
                        CreateItemInInput_Text(currentY, e);
                        currentY += nextY;
                        break;

                    case ElementType.Year:
                    case ElementType.Month:
                    case ElementType.Day:
                    case ElementType.Hour:
                    case ElementType.Minute:
                    case ElementType.Second:
                        dateTimeFlag = true;
                        break;
                    }
                }
            }

            // 日期时间控件
            if (dateTimeFlag)
            {
                var label = new Label()
                {
                    Location = new Point(X_Label, currentY),
                    Text     = "寄件时间",
                };
                var dateTimeCheck = new DateTimeCheck()
                {
                    Location = new Point(X_Control, currentY),
                };
                dateTimeCheck.Initialize(data);
                dateTimeCheck.DataModelChanged += (sender, e) => preview.RefreshPreview();
                pInput.Controls.Add(label);
                pInput.Controls.Add(dateTimeCheck);
            }

            // 滚动条出现导致面板宽度减小,在 Anchor 作用下导致TextBox宽度减小,所以延迟修改 Anchor
            foreach (Control control in pInput.Controls)
            {
                if (control is TextBox || control is FillSelect)
                {
                    control.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                }
            }
        }