예제 #1
0
        // Adds a sections in our mock-store
        static async Task SeedSections()
        {
            var sections = new StoreSection[]
            {
                new StoreSection {
                    Name = "Clothes"
                },
                new StoreSection {
                    Name = "Electronics"
                },
                new StoreSection {
                    Name = "Kitchen"
                },
                new StoreSection {
                    Name = "Bedroom"
                },
                new StoreSection {
                    Name = "Recreation"
                },
            };

            await _context.StoreSections.AddRangeAsync(sections);

            await _context.SaveChangesAsync();
        }
예제 #2
0
        public void EnterEditorForNewStore()
        {
            var defaultSection = new StoreSection(new StoreSectionId(Guid.NewGuid()), "Default", 0, true);
            var store          = new Store(0, "", new[] { defaultSection });

            EnterEditor(store);
        }
        static SettingsStoreFactory()
        {
            //var configStore = ConfigurationManager.AppSettings["PPI.Store"];

            var configStore = StoreSection.Get().StoreNameOrType;

            Type storeImplementation = null;

            if (!string.IsNullOrEmpty(configStore))
            {
                storeImplementation = Type.GetType(configStore);
            }
            else
            {
                foreach (var store in DefaultStores)
                {
                    storeImplementation = Type.GetType(store);
                    if (storeImplementation != null)
                    {
                        break;
                    }
                }
            }

            //var storeImplementation= ??DefaultStore;

            try {
                _store = Activator.CreateInstance(storeImplementation);
            }
            catch (Exception e) {
                _eventLogger.LogException("Failed creating data store, using NullStore", e);
                _store = new NullStore();
            }
            //Bus.Buffer.SetPerformanceDataStore((IStorePerformanceData)_store);
        }
        public void StoreSectionTest2()
        {
            Size         size   = new Size(45, 50);
            StoreSection target = new StoreSection(size);

            target.Shape.Size.Should().Be(size);
        }
예제 #5
0
        public List <StoreSection> FindPlacementsByItem(long itemID)
        {
            List <StoreSection> sectionList = new List <StoreSection>();

            _sqlQueryString = @"SELECT * FROM ItemSectionPlacement " +
                              @"WHERE ItemID = @itemID";

            using (_conn = new SqlConnection(_connString))
            {
                _cmd = new SqlCommand(_sqlQueryString, _conn);
                _cmd.Parameters.AddWithValue("@itemID", itemID);

                try
                {
                    _conn.Open();
                    _reader = _cmd.ExecuteReader();
                    while (_reader.Read())
                    {
                        if (!_reader.IsDBNull(_reader.GetOrdinal("StoreSectionID")))
                        {
                            long storeSectionID = (long)_reader["StoreSectionID"];

                            DatabaseService db           = new DatabaseService(new SqlStoreDatabaseFactory());
                            StoreSection    tempStoreSec = db.TableStoreSection.GetStoreSection(storeSectionID);
                            sectionList.Add(tempStoreSec);
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Something went wrong in FindPlacementsByItem: " + e.Message);
                }
            }
            return(sectionList);
        }
        public void StoreSectionTest3()
        {
            StoreSection target = new StoreSection(15, 10);

            target.Shape.Size.Width.Should().Be(15);
            target.Shape.Size.Height.Should().Be(10);
        }
        public void TableStoreSection_CreateStoreSectionGetStoreSection_StoreSectionExistsInDatabase()
        {
            _createdStoreSectionID1 = _db.TableStoreSection.CreateStoreSection("Step3Integration_TestSection1", 20, 20, _floorplanID);

            StoreSection fetchedStoreSection = _db.TableStoreSection.GetStoreSection(_createdStoreSectionID1);

            Assert.That(fetchedStoreSection.StoreSectionID, Is.EqualTo(_createdStoreSectionID1));
        }
        public void StoreSectionTest1()
        {
            Point        location = new Point(15, 25);
            Size         size     = new Size(45, 50);
            StoreSection target   = new StoreSection(location, size);

            target.Shape.Location.Should().Be(location);
            target.Shape.Size.Should().Be(size);
        }
        private void selectCurrentStoreSectionHandler(SectionShape shape)
        {
            _selectedStoreSection = shape.ID;
            ItemsInSectionList    = _db.TableItemSectionPlacement.ListItemsInSection(_selectedStoreSection);

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

            SelectedStoreSectionName = selectedStoreSection.Name;
        }
        public void StoreSectionTest4()
        {
            StoreSection target = new StoreSection(10, 15, 50, 40);

            target.Shape.X.Should().Be(10);
            target.Shape.Y.Should().Be(15);
            target.Shape.Width.Should().Be(50);
            target.Shape.Height.Should().Be(40);
        }
예제 #11
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            StoreSection storeSection = await _db.StoreSections.FindAsync(id);

            _db.StoreSections.Remove(storeSection);
            await _db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
 public static StoreSectionContract ToContract(this StoreSection section)
 {
     return(new StoreSectionContract
     {
         Id = section.Id.BackendId,
         Name = section.Name,
         SortingIndex = section.SortingIndex,
         IsDefaultSection = section.IsDefaultSection
     });
 }
        public void TableStoreSection_DeleteStoreSection_StoreSectionDoesNotExist()
        {
            _createdStoreSectionID1 = _db.TableStoreSection.CreateStoreSection("Step3Integration_TestSection1", 20, 20, _floorplanID);

            _db.TableStoreSection.DeleteStoreSection(_createdStoreSectionID1);

            StoreSection fetchedStoreSection = _db.TableStoreSection.GetStoreSection(_createdStoreSectionID1);

            Assert.That(fetchedStoreSection, Is.Null);
        }
        public void StoreSectionTest()
        {
            Point        location = new Point(15, 25);
            Size         size     = new Size(45, 50);
            Rectangle    shape    = new Rectangle(location, size);
            StoreSection target   = new StoreSection(shape, Color.Red);

            target.Shape.Should().Be(shape);
            target.Color.Should().Be(Color.Red);
        }
예제 #15
0
        public async Task <ActionResult> Edit([Bind(Include = "StoreSectionId,SectionName")] StoreSection storeSection)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(storeSection).State = EntityState.Modified;
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(storeSection));
        }
예제 #16
0
        public StoreSection GetStoreSection(long storeSectionID)
        {
            StoreSection storeSectionReturnValue = null;

            _sqlQueryString = @"SELECT * FROM StoreSection WHERE StoreSectionID = @storeSectionID";

            using (_conn = new SqlConnection(_connString))
            {
                _cmd = new SqlCommand(_sqlQueryString, _conn);
                _cmd.Parameters.AddWithValue("@storeSectionID", storeSectionID);

                try
                {
                    _conn.Open();
                    _reader = _cmd.ExecuteReader();

                    while (_reader.Read())
                    {
                        long   floorPlanID      = 0;
                        string storeSectionName = "";
                        long   coordinateX      = 0;
                        long   coordinateY      = 0;

                        if (!_reader.IsDBNull(_reader.GetOrdinal("Name")))
                        {
                            storeSectionName = (string)_reader["Name"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("CoordinateX")))
                        {
                            coordinateX = (long)_reader["CoordinateX"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("CoordinateY")))
                        {
                            coordinateY = (long)_reader["CoordinateY"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("FloorPlanID")))
                        {
                            floorPlanID = (long)_reader["FloorPlanID"];
                        }

                        storeSectionReturnValue = new StoreSection(storeSectionID, storeSectionName, coordinateX,
                                                                   coordinateY, floorPlanID);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Something went wrong in GetStoreSection: " + e.Message);
                }
            }
            return(storeSectionReturnValue);
        }
예제 #17
0
        public async Task <ActionResult> Create([Bind(Include = "StoreSectionId,SectionName")] StoreSection storeSection)
        {
            if (ModelState.IsValid)
            {
                _db.StoreSections.Add(storeSection);
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(storeSection));
        }
        public void TableStoreSection_UpdateStoreSectionName_StoreSectionNameIsChanged()
        {
            string newSectionName = "Step3Integration_NewSectionName";

            _createdStoreSectionID1 = _db.TableStoreSection.CreateStoreSection("Step3Integration_OldSectionName", 20, 20, _floorplanID);

            _db.TableStoreSection.UpdateStoreSectionName(_createdStoreSectionID1, newSectionName);

            StoreSection fetchedStoreSection = _db.TableStoreSection.GetStoreSection(_createdStoreSectionID1);

            Assert.That(fetchedStoreSection.Name, Is.EqualTo(newSectionName));
        }
예제 #19
0
        // GET: StoreSections/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StoreSection storeSection = await _db.StoreSections.FindAsync(id);

            if (storeSection == null)
            {
                return(HttpNotFound());
            }
            return(View(storeSection));
        }
예제 #20
0
        public List <StoreSection> GetAllStoreSections(long floorPlanID)
        {
            List <StoreSection> allStoreSections = new List <StoreSection>();

            _sqlQueryString = @"SELECT* FROM StoreSection WHERE FloorPlanID = @floorPlanID";

            using (_conn = new SqlConnection(_connString))
            {
                _cmd = new SqlCommand(_sqlQueryString, _conn);
                _cmd.Parameters.AddWithValue("@floorPlanID", floorPlanID);

                try
                {
                    _conn.Open();
                    _reader = _cmd.ExecuteReader();

                    while (_reader.Read())
                    {
                        StoreSection newSection = new StoreSection(0, "", 0, 0, 0);

                        if (!_reader.IsDBNull(_reader.GetOrdinal("Name")))
                        {
                            newSection.Name = (string)_reader["Name"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("StoreSectionID")))
                        {
                            newSection.StoreSectionID = (long)_reader["StoreSectionID"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("CoordinateX")))
                        {
                            newSection.CoordinateX = (long)_reader["CoordinateX"];
                        }

                        if (!_reader.IsDBNull(_reader.GetOrdinal("CoordinateY")))
                        {
                            newSection.CoordinateY = (long)_reader["CoordinateY"];
                        }

                        allStoreSections.Add(newSection);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Something went wrong in GetAllStoreSections: " + e.Message);
                }
            }
            return(allStoreSections);
        }
 public void PrepareSectionToEdit()
 {
     _sectionToEdit      = _db.TableStoreSection.GetStoreSection(_selectedStoreSection);
     NewSectionName      = "";
     PreviousSectionName = _sectionToEdit.Name;
 }