Exemplo n.º 1
0
        // Bestillings-listeboksen
        private void listBoxOrders_MouseDown(object sender, MouseEventArgs e)
        {
            index = listBoxOrders.IndexFromPoint(e.X, e.Y);

            if (index == -1)
            {
                return;
            }

            listBoxItems = listBoxOrders.Items[index].ToString();
            string[] listBoxSplit  = listBoxItems.Split(':');
            string   firstName     = listBoxSplit[0].Split(',')[0].Trim();
            string   lastName      = listBoxSplit[0].Split(',')[1].Trim(); //greit å splitte opp navna også   :     ^       )
            string   partOne       = listBoxSplit[1].Split('-')[0].Trim();
            string   partTwo       = listBoxSplit[1].Split('-')[1].Trim();
            string   roomType      = listBoxSplit[2].Trim().ToLower();
            string   orderIDString = listBoxSplit[3].Trim();

            orderID = Int32.Parse(orderIDString);

            string[] fromDateSplit = partOne.Split('.');
            string[] toDateSplit   = partTwo.Split('.');

            string fromDateString = fromDateSplit[2] + "-" + fromDateSplit[1] + "-" + fromDateSplit[0];
            string toDateString   = toDateSplit[2] + "-" + toDateSplit[1] + "-" + toDateSplit[0];

            flippedFromDate = fromDateString;
            flippedToDate   = toDateString;
            List <Room> availableRooms = BookingData.GetAvailableRoomsForPeriod(fromDateString, toDateString);

            currentPeriod.Text = "Viser oversikt for: " + partOne + " - " + partTwo;

            for (int i = 0; i < roomDataList.Count; i++)
            {
                bool isAssigned      = true;
                bool isWrongRoomType = true;

                for (int j = 0; j < availableRooms.Count; j++)
                {
                    if (roomDataList[i].number == availableRooms[j].number)
                    {
                        isAssigned = false;
                    }
                }

                for (int j = 0; j < availableRooms.Count; j++)
                {
                    if (roomDataList[i].type == roomType)
                    {
                        isWrongRoomType = false;
                    }
                }

                roomDataList[i].assigned      = isAssigned;
                roomDataList[i].wrongRoomType = isWrongRoomType;
            }

            ShowRoomData(selectedFloor);
            DragDropEffects dde = DoDragDrop(listBoxItems, DragDropEffects.All);
        }
Exemplo n.º 2
0
        // Finn alle rom som er ledige for dags dato
        private void ShowRoomsForToday()
        {
            List <Room> availableRooms = BookingData.GetAvailableRoomsForToday();

            for (int i = 0; i < roomDataList.Count; i++)
            {
                bool isAssigned = true;

                for (int j = 0; j < availableRooms.Count; j++)
                {
                    if (roomDataList[i].number == availableRooms[j].number)
                    {
                        isAssigned = false;
                    }
                }

                roomDataList[i].assigned = isAssigned;
            }

            ShowRoomData(selectedFloor);
        }