コード例 #1
0
ファイル: TestArea.cs プロジェクト: Thaibaduc/Restaurant
        public void TestCRUDArea()
        {
            string      nameExpected = "BanVIP";
            Area        area         = areaBLL.CreateArea(nameExpected);
            bool        isCreated    = false;
            List <Area> areas        = areaBLL.ListArea();

            for (int i = 0; i < areas.Count; i++)
            {
                if (areas[i].Name == nameExpected)
                {
                    isCreated = true;
                }
            }
            Assert.AreEqual(true, isCreated);
            TestUpdateArea(area);
        }
コード例 #2
0
ファイル: TestTable.cs プロジェクト: Thaibaduc/Restaurant
        public void TestCRUDTable()
        {
            int         ID    = 0;
            List <Area> areas = areaBLL.ListArea();
            Table       table = tableBLL.CreateTable(new Table {
                Name = "Vip Table", AreaID = areas[0].ID
            });

            List <Table> tables    = tableBLL.ListTablesByArea(areas[0]);
            bool         isCreated = false;

            for (int i = 0; i < tables.Count; i++)
            {
                if (tables[i].Name == "Vip Table" && tables[i].AreaID == areas[0].ID)
                {
                    isCreated = true;
                    ID        = tables[i].ID;
                }
            }
            Assert.AreEqual(true, isCreated);

            TestUpdateTable(ID, table);
        }
コード例 #3
0
        public void TestCRUDOrder()
        {
            string customerName = "AnLe";

            List <Department> departments = departmentBLL.ListDepartment();
            List <Employee>   employees   = employeeBLL.ListEmployeeByDepartment(departments[0]);

            List <Menu>     menus     = menuBLL.ListMenu();
            List <MenuItem> menuItems = menuItemBLL.FindByMenuID(menus[0]);

            List <OrderDetail> listOrderDetail = new List <OrderDetail>();

            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = 0,
                MenuItemID = menuItems[0].ID,
                Price      = menuItems[0].Price,
                Quantity   = 10
            });
            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = 0,
                MenuItemID = menuItems[1].ID,
                Price      = menuItems[1].Price,
                Quantity   = 20
            });
            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = 0,
                MenuItemID = menuItems[2].ID,
                Price      = menuItems[2].Price,
                Quantity   = 30
            });

            List <Area>  areas     = areaBLL.ListArea();
            List <Table> allTables = tableBLL.ListTablesByArea(areas[0]);

            List <Table> tables = new List <Table>();

            tables.Add(allTables[0]);

            Order orderExpected = orderBLL.CreateOrder(employees[0], tables, customerName, listOrderDetail);

            Order currentOrder = orderBLL.GetCurrentOrderByTable(allTables[0]);

            Assert.AreEqual(currentOrder.CustomerName, customerName);
            Assert.AreEqual(currentOrder.EmployeeID, employees[0].ID);

            allTables = tableBLL.ListTablesByArea(areas[0]);

            Assert.AreEqual(1, allTables[0].Status);
            Assert.AreEqual(currentOrder.ID, orderExpected.ID);

            TestAddFood(currentOrder);
        }
コード例 #4
0
        private void LoadData()
        {
            AreaBLL         areaBLL = new AreaBLL();
            List <DAL.Area> areas   = areaBLL.ListArea();

            this.tabControl.Controls.Clear();

            foreach (DAL.Area area in areas)
            {
                var t = new TabPage();
                t.Location = new Point(4, 22);
                t.Name     = area.Name;
                t.Padding  = new Padding(3);
                t.Size     = new Size(597, 257);
                t.Font     = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
                t.Text     = area.Name;
                t.UseVisualStyleBackColor = true;
                t.AutoScroll = true;
                this.tabControl.Controls.Add(t);

                // add layout
                FlowLayoutPanel flowLayoutPanel = new FlowLayoutPanel();
                flowLayoutPanel.Dock       = DockStyle.Fill;
                flowLayoutPanel.AutoScroll = true;
                t.Controls.Add(flowLayoutPanel);

                // add menu item
                TableBLL         tableBLL = new TableBLL();
                List <DAL.Table> tables   = tableBLL.ListTablesByArea(area);
                for (int i = 0; i < tables.Count; i++)
                {
                    TableControl tableControl = new TableControl(tables[i], true);
                    tableControl.Tag = area;
                    flowLayoutPanel.Controls.Add(tableControl);
                    tableControl.Click += new EventHandler(this.tableControl_Click);
                }
            }
        }
コード例 #5
0
ファイル: SeatSetup.cs プロジェクト: Thaibaduc/Restaurant
        public void LoadData()
        {
            int currIndex = this.tabControl.SelectedIndex;

            this.tabControl.Controls.Clear();

            AreaBLL     areaBLL  = new AreaBLL();
            List <Area> listArea = areaBLL.ListArea();

            this.tabPages = new List <System.Windows.Forms.TabPage>();
            foreach (Area area in listArea)
            {
                var t = new System.Windows.Forms.TabPage();
                t.Location = new System.Drawing.Point(4, 22);
                t.Name     = area.Name;
                t.Padding  = new System.Windows.Forms.Padding(3);
                t.Size     = new System.Drawing.Size(597, 257);
                t.Font     = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                t.Text     = area.Name;
                t.UseVisualStyleBackColor = true;
                t.AutoScroll = true;

                // button add table
                Button btnAddTable = new Button();
                btnAddTable.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
                btnAddTable.Location = new System.Drawing.Point(6, 6);
                btnAddTable.Size     = new System.Drawing.Size(75, 20);
                btnAddTable.Tag      = area;
                btnAddTable.Text     = "Add table";
                btnAddTable.Click   += new EventHandler(this.btnAddTable_Click);
                t.Controls.Add(btnAddTable);

                // button update area
                Button btnUpdateArea = new Button();
                btnUpdateArea.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
                btnUpdateArea.Location = new System.Drawing.Point(6, 29);
                btnUpdateArea.Size     = new System.Drawing.Size(75, 20);
                btnUpdateArea.Tag      = area;
                btnUpdateArea.Text     = "Update area";
                btnUpdateArea.Click   += new EventHandler(this.btnUpdateArea_Click);
                t.Controls.Add(btnUpdateArea);

                // button delete area
                Button btnDelArea = new Button();
                btnDelArea.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
                btnDelArea.Location = new System.Drawing.Point(6, 61);
                btnDelArea.Size     = new System.Drawing.Size(75, 20);
                btnDelArea.Tag      = area;
                btnDelArea.Text     = "Delete area";
                btnDelArea.Click   += new EventHandler(this.btnDeleteArea_Click);
                t.Controls.Add(btnDelArea);

                // add tables
                TableBLL     tableBLL  = new TableBLL();
                List <Table> listTable = tableBLL.ListTablesByArea(area);
                for (int i = 0; i < listTable.Count; i++)
                {
                    var tt = new TableControl(listTable[i], false);
                    tt.OnEdit   += new TableControl.OnEditHandler(this.tableControl_OnEdit);
                    tt.OnDelete += new TableControl.OnDeleteHandler(this.tableControl_OnDelete);
                    t.Controls.Add(tt);
                }

                // store
                this.tabPages.Add(t);
                this.tabControl.Controls.Add(t);
            }
            this.tabControl.SelectedIndex = Math.Min(listArea.Count, currIndex);

            this.UpdateControlPosition();
        }