Exemplo n.º 1
0
 //construct function for edit staff: forbid editing current user's role
 public StaffEditForm(Staff staff, DiningArea diningArea) : this(staff)
 {
     if (staff.Name == diningArea.CurrentStaff.Name)
     {
         comboBoxRole.Enabled = false;
     }
 }
        public TabelStatusForm(DiningArea diningArea)
        {
            InitializeComponent();
            this.diningArea = diningArea;
            staffManager    = new StaffManager();
            tableManager    = new TableManager();
            itemManager     = new ItemManager();
            this.Text       = this.Text + string.Format("  ({0}: {1})", diningArea.CurrentStaff.Role, diningArea.CurrentStaff.Name);
            InitTablePosition_Simple();

            waitlistForm             = new WaitlistForm(diningArea);
            waitlistForm.OnAllocate += waitlistForm_OnAllocate;
            //set TabelStatusForm location
            int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Width + waitlistForm.Width) / 2;
            int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Height) / 2;

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = (Point) new Size(x, y);
            //set waitlistForm location
            waitlistForm.ShowInTaskbar = false;
            waitlistForm.StartPosition = FormStartPosition.Manual;
            waitlistForm.Location      = new Point(this.Location.X - waitlistForm.Width, this.Location.Y);
            waitlistForm.Height        = this.Height;
            waitlistForm.Show();
        }
        public TabelStatusForm(DiningArea diningArea)
        {
            InitializeComponent();
            this.diningArea = diningArea;
            staffManager    = new StaffManager();
            tableManager    = new TableManager();
            itemManager     = new ItemManager();
            orderManager    = new OrderManager();

            diningArea.AWaitingTimePredictor.PredictWaitingTimeReg(diningArea.Tables, diningArea.Customers, diningArea.Orders, (List <Order>)orderManager.GetByOrderStatus(OrderStatus.Finish), (List <Item>)itemManager.GetAll());

            this.Text = this.Text + string.Format("  ({0}: {1})", diningArea.CurrentStaff.Role, diningArea.CurrentStaff.Name);
            InitTablePosition_Simple();

            waitlistForm             = new WaitlistForm(diningArea);
            waitlistForm.OnAllocate += waitlistForm_OnAllocate;
            //set TabelStatusForm location
            int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Width + waitlistForm.Width) / 2;
            int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Height) / 2;

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = (Point) new Size(x, y);
            //set waitlistForm location
            waitlistForm.ShowInTaskbar = false;
            waitlistForm.StartPosition = FormStartPosition.Manual;
            waitlistForm.Location      = new Point(this.Location.X - waitlistForm.Width, this.Location.Y);
            waitlistForm.Height        = this.Height;
            waitlistForm.Show();

            //groupbox:table information
            txtTableId.Enabled             = false;
            txtCapacity.Enabled            = false;
            comboBoxTableStatus.DataSource = System.Enum.GetNames(typeof(TableStatus));
            comboBoxWaiterName.DataSource  = diningArea.Waiters.Select(waiter => waiter.Name).ToList();
            //groupbox:order information
            txtOrderId.Enabled = false;

            dgvItemMenu1.DataSource          = itemManager.GetAll();
            dgvItemMenu1.ReadOnly            = true;
            dgvItemMenu1.RowHeadersVisible   = false;
            dgvItemMenu1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvItemMenu1.Columns["AverageTimeCost"].Visible = false;
            dgvItemMenu1.Columns["ItemStatus"].Visible      = false;
            dgvItemMenu1.Columns["ItemAmount"].Visible      = false;
            dgvItemMenu1.Columns["Description"].Visible     = false;

            dgvSelectedItems.DataSource = new List <Item>();
            //dgvSelectedItems.ReadOnly = true;
            dgvSelectedItems.RowHeadersVisible   = false;
            dgvSelectedItems.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dgvSelectedItems.Columns["AverageTimeCost"].Visible = false;
            dgvSelectedItems.Columns["ItemStatus"].Visible      = false;
            dgvSelectedItems.Columns["Description"].Visible     = false;
            dgvSelectedItems.Columns["ItemId"].ReadOnly         = true;
            dgvSelectedItems.Columns["Name"].ReadOnly           = true;
            dgvSelectedItems.Columns["Price"].ReadOnly          = true;
            dgvSelectedItems.AllowUserToAddRows = false;
        }
Exemplo n.º 4
0
 public AdminForm(DiningArea diningArea)
 {
     InitializeComponent();
     this.diningArea    = diningArea;
     this.StartPosition = FormStartPosition.CenterScreen;
     staffManager       = new StaffManager();
     tableManager       = new TableManager();
     itemManager        = new ItemManager();
     this.Text          = this.Text + string.Format("  ({0}: {1})", diningArea.CurrentStaff.Role, diningArea.CurrentStaff.Name);
 }
    public void InitializeScripts()
    {
        // empty tall and short rooms
        defaultRoom = GetComponent <RoomManager>();
        test        = GetComponent <TestTall>();

        exitPortal  = GetComponent <RoomExit>();
        diningRoom  = GetComponent <DiningArea>();
        tableRoom   = GetComponent <RoomTables>();
        libraryRoom = GetComponent <RoomLibrary>();
    }
Exemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Staff     currentStaff = new Staff();
            LoginForm loginForm    = new LoginForm();

            // TEST PURPOSE CODE BELOW
            //Application.Run(new OrderListForm());
            // TEST PURPOSE CODE ABOVE


//>>>>>>> origin/master
            if (loginForm.ShowDialog() == DialogResult.OK)
            {
                currentStaff = loginForm.currentStaff;
                DiningArea diningArea = new DiningArea(currentStaff);
                loginForm.Dispose();
                if (currentStaff.Role == StaffRole.Manager)
                {
                    //MessageBox.Show(string.Format("Welcome {0}! Your role is {1}", currentStaff.Name, currentStaff.Role));
                    //main form for Manager
                    Application.Run(new AdminForm(diningArea));
                }
                else if (currentStaff.Role == StaffRole.Waiter)
                {
                    //main form for waiter
                    Application.Run(new TabelStatusForm(diningArea));
                }
                else if (currentStaff.Role == StaffRole.Cook)
                {
                    MessageBox.Show(string.Format("Welcome {0}! Your role is {1}", currentStaff.Name, currentStaff.Role));
                    Application.Run(new OrderListForm());
                }
                else
                {
                    Application.Run(new WaitinglistScreenForm());
                    //MessageBox.Show(string.Format("Welcome {0}! Your role is {1}. And you will see customer UI.", currentStaff.Name, currentStaff.Role));
                }
            }


            ////test db
            //IntelligentRestaurantManager.Model.Staff staff = new Model.Staff();
            //DAL.StaffService staffService = new DAL.StaffService();
            //staff = staffService.GetByName("manager1");
            //MessageBox.Show(staff.Password + staff.Role);
            ////test int[] to string
            //int[] tableIds = new int[] { 1, 2, 3, 4, 5 };

            //MessageBox.Show(string.Join(",", tableIds));
        }
Exemplo n.º 7
0
 public WaitlistForm(DiningArea diningArea)
 {
     InitializeComponent();
     this.diningArea = diningArea;
     maxWaitID       = 1;
     customerManager = new CustomerManager();
     tableManager    = new TableManager();
     foreach (Customer customer in diningArea.Customers)
     {
         lbList.Items.Add("Number " + customer.WaitingNumber.ToString("000") + ":  " + customer.NumberofPeople.ToString("000") + " Customer");
         if (customer.WaitingNumber > maxWaitID)
         {
             maxWaitID = customer.WaitingNumber;
         }
     }
     nudNumber.Value         = 2;
     txtCustomerId.Enabled   = false;
     txtCustomerId.BackColor = Color.White;
     txtNoOfPeople.Enabled   = false;
     txtNoOfPeople.BackColor = Color.White;
 }
Exemplo n.º 8
0
        public TabelStatusForm(DiningArea diningArea)
        {
            InitializeComponent();
            this.diningArea = diningArea;
            staffManager    = new StaffManager();
            tableManager    = new TableManager();
            itemManager     = new ItemManager();
            this.Text       = this.Text + string.Format("  ({0}: {1})", diningArea.CurrentStaff.Role, diningArea.CurrentStaff.Name);
            InitTablePosition_Simple();

            waitlistForm             = new WaitlistForm(diningArea);
            waitlistForm.OnAllocate += waitlistForm_OnAllocate;
            //set TabelStatusForm location
            int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Width + waitlistForm.Width) / 2;
            int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Height) / 2;

            this.StartPosition = FormStartPosition.Manual;
            this.Location      = (Point) new Size(x, y);
            //set waitlistForm location
            waitlistForm.ShowInTaskbar = false;
            waitlistForm.StartPosition = FormStartPosition.Manual;
            waitlistForm.Location      = new Point(this.Location.X - waitlistForm.Width, this.Location.Y);
            waitlistForm.Height        = this.Height;
            waitlistForm.Show();

            //groupbox:table information
            txtTableId.Enabled  = false;
            txtCapacity.Enabled = false;
            //groupbox:order information
            txtOrderId.Enabled      = false;
            dgvItemMenu1.DataSource = itemManager.GetAll();
            dgvItemMenu1.ReadOnly   = true;
            dgvItemMenu1.Columns["ItemId"].Visible          = false;
            dgvItemMenu1.Columns["AverageTimeCost"].Visible = false;
            dgvItemMenu1.Columns["ItemStatus"].Visible      = false;
            dgvItemMenu1.Columns["ItemStatus"].Visible      = false;
            dgvItemMenu1.Columns["ItemAmount"].Visible      = false;
        }