private void windowLoadedHandler()
        {
            // Load sections from database and display on canvas
            _storeSectionList = _db.TableStoreSection.GetAllStoreSections(_floorplanID);
            foreach (var section in _storeSectionList)
            {
                SectionShape loadedSectionShape = new SectionShape();
                loadedSectionShape.Top   = section.CoordinateY;
                loadedSectionShape.Left  = section.CoordinateX;
                loadedSectionShape.Shape = ShapeButtonCreator.CreateShapeForButton();
                loadedSectionShape.Name  = "Button" + section.StoreSectionID;
                loadedSectionShape.ID    = section.StoreSectionID;

                ShapeCollection.Add(loadedSectionShape);
            }

            // Load items from database and display on itemdatagrid
            ListOfItems.Populate(_db.TableItem.SearchItems(""));


            // Load floorplan and display on canvas
            _db.TableFloorplan.DownloadFloorplan(@"../../images/");

            FloorplanImage = null;
            ImageBrush       floorplanImgBrush = new ImageBrush();
            RefreshableImage refresh           = new RefreshableImage();
            BitmapImage      result            = refresh.Get("../../images/floorplan.jpg");

            floorplanImgBrush.ImageSource = result;
            FloorplanImage = floorplanImgBrush;
        }
        private void selectCurrentStoreSectionHandler(SectionShape shape)
        {
            _selectedStoreSection = shape.ID;
            ItemsInSectionList    = _db.TableItemSectionPlacement.ListItemsInSection(_selectedStoreSection);

            StoreSection selectedStoreSection = _db.TableStoreSection.GetStoreSection(_selectedStoreSection);

            SelectedStoreSectionName = selectedStoreSection.Name;
        }
        public void CreateStoreSection(object sender, MouseButtonEventArgs e)
        {
            Canvas       canvas          = sender as Canvas;
            SectionShape newSectionShape = new SectionShape();

            newSectionShape.Top  = e.GetPosition(canvas).Y - 7;
            newSectionShape.Left = e.GetPosition(canvas).X - 7;

            newSectionShape.Shape = ShapeButtonCreator.CreateShapeForButton();

            ShapeCollection.Add(newSectionShape);
            _newlyCreatedSection = newSectionShape;

            NewlyCreatedStoreSectionName = "";
        }
        private void deleteStoreSectionHandler()
        {
            SectionShape shapeToDelete        = null;
            string       sectionShapeToDelete = "Button" + _selectedStoreSection;

            foreach (var shape in ShapeCollection)
            {
                if (shape.Name == sectionShapeToDelete)
                {
                    shapeToDelete = shape;
                }
            }

            if (shapeToDelete != null)
            {
                ShapeCollection.Remove(shapeToDelete);
            }

            _db.TableStoreSection.DeleteStoreSection(_selectedStoreSection);
        }