private void CheckIfNameAvailable(string name) { var store = storeDB.GetStorebyName(name); if (store != null) { throw new StoreException(OpenStoreStatus.AlreadyExist, "store name must be uniqe"); } }
public void ViewStoreStock(string storename) { try { _storeName = storename; MarketLog.Log("StoreCenter", "checking store stack"); _shopper.ValidateCanBrowseMarket(); MarketLog.Log("StoreCenter", "check if store exists"); CheckIfStoreExists(storename); Store store = storeLogic.GetStorebyName(storename); LinkedList <string> result = new LinkedList <string>(); var IDS = storeLogic.GetAllStoreProductsID(store.SystemId); string info; foreach (string item in IDS) { info = GetProductStockInformation(item, false); if (info != "") { result.AddLast(info); } } string[] resultArray = new string[result.Count]; result.CopyTo(resultArray, 0); answer = new StoreAnswer(StoreEnum.Success, "", resultArray); } catch (StoreException e) { answer = new StoreAnswer((StoreEnum)e.Status, e.GetErrorMessage()); } catch (DataException e) { answer = new StoreAnswer((StoreEnum)e.Status, e.GetErrorMessage()); } catch (MarketException) { MarketLog.Log("StoreCenter", "no premission"); answer = new StoreAnswer(StoreEnum.NoPermission, "User validation as valid customer has been failed . only valid users can browse market. Error message has been created!"); } }
public void CheckName() { Store store = new Store("SX", "name1test", "here"); Store find = handler.GetStorebyName("name1test"); Assert.IsNull(find); Assert.IsFalse(handler.IsStoreExistAndActive("name1test")); toDeleteStore = store; handler.AddStore(store); Assert.IsTrue(handler.IsStoreExistAndActive("name1test")); }