public override void Start()
        {
            base.Start();

            IStack Stack = Platform.Current.Create <IStack>();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text     = "Tis is my team";
            lblLabel.Height   = 50;
            lblLabel.FontSize = 20;
            Stack.Children.Add(lblLabel);

            IAutocomplete txtBox = Platform.Current.Create <IAutocomplete>();

            txtBox.Name = "Team";
            //txtBox.BackgroundColor = new Color(1, 222, 184, 135);
            txtBox.FontColor   = new Color(1, 36, 24, 130);
            txtBox.BorderColor = new Color(1, 229, 238, 0);
            txtBox.Width       = 100;
            txtBox.Height      = 80;
            txtBox.FontFamily  = "Times new roman";
            txtBox.FontSize    = 20;
            Stack.Children.Add(txtBox);

            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            Stack.Children.Add(cmdClose);

            Platform.Current.Page.Title   = "Test Autocomplete";
            Platform.Current.Page.Content = Stack;
        }
 public void SetUp()
 {
     _storemanager = Substitute.For<IStoremanager>();
     _storemanager.Store = new Store() {StoreName = "Lidl", StoreId = 12};
     _autocomplete = Substitute.For<IAutocomplete>();
     _uut = new StoremanagerViewModel(_storemanager, _autocomplete);
 }
Пример #3
0
        protected void lnkSelectOrganisation_Click(object sender, EventArgs e)
        {
            AutoCompleteManager amManager = new AutoCompleteManager();
            IAutocomplete       org       = amManager.GetIAutocompleteByReference(ucACSchoolOrganisation.SelectedID);

            ucACSchoolOrganisation.Populate(org);
        }
Пример #4
0
        public MainWindow()
        {
            InitializeComponent();
            var unit = new UnitOfWork(new DataContext());

            _user         = new Consumer.Consumer(unit);
            _autocomplete = new Autocomplete(unit);
        }
Пример #5
0
 public MainWindow()
 {
     InitializeComponent();
     _manager = new Storemanager.Storemanager(new UnitOfWork(new DataContext()), new Store()
     {
         StoreName = "Aldi"
     });
     _autocomplete = new Autocomplete(new UnitOfWork(new DataContext()));
 }
Пример #6
0
        public Form1()
        {
            ac = new Autocomplete.Autocomplete(Data.Cities.Select(s => s.ToCharArray()).ToArray());

            InitializeComponent();

            textBox3.Lines = ac.AllItems.Select(s => new string(s)).ToArray();
            setOptions(ac.InitialOptions);
        }
 public void Populate(IAutocomplete item)
 {
     if (item != null)
     {
         lnkRecord.InnerText = item.Name;
         lnkRecord.HRef      = item.DetailsURL;
         SelectedID          = item.Reference;
         mvInput.SetActiveView(viewLabel);
         hdnTextValue.Value = item.Name;
     }
 }
Пример #8
0
        /// <summary>
        ///     AdminViewModel constructor takes a UnitOfWork to give to each of its user controls view models  and add them to a
        ///     list.
        /// </summary>
        public AdminViewModel(IAdmin admin, IAutocomplete autocomplete)
        {
            // Add available pages
            PageViewModels.Add(new AdminNewStoreModel(admin));
            PageViewModels.Add(new AdminDeleteProductModel());
            PageViewModels.Add(new AdminDeleteStoreModel(admin, autocomplete, new CreateMsgBox()));

            // set startup page
            MainWindowTekst = "Pristjek220 - Administration - Tilføj Forretning";
            _currentPageViewModel = _pageViewModels[0];
        }
        public void SetUp()
        {
            _logIn = Substitute.For<ILogIn>();
            _autocomplete = Substitute.For<IAutocomplete>();
            _storemanager = Substitute.For<IStoremanager>();
            _admin = Substitute.For<IAdmin>();
            _databaseFunctions = Substitute.For<IDatabaseFunctions>();

            _databaseFunctions.ConnectToDb().Returns(true);
            _uut = new LogInViewModel(_autocomplete, _logIn, _databaseFunctions, _storemanager, _admin);
        }
        /// <summary>
        ///     StoremanagerViewModel constructor takes a UnitOfWork to give to each of its user controls view models and add them
        ///     to a list.
        /// </summary>
        public StoremanagerViewModel(IStoremanager storemanager, IAutocomplete autocomplete)
        {
            // Add available pages
            _storemanager = storemanager;
            PageViewModels.Add(new ChangePriceModel(storemanager, autocomplete, new CreateMsgBox()));
            PageViewModels.Add(new DeleteProductModel(storemanager, autocomplete, new CreateMsgBox()));
            PageViewModels.Add(new NewProductModel(storemanager, autocomplete, new CreateMsgBox()));

            // set startup page
            MainWindowTekst = $"Pristjek220 - {_storemanager.Store.StoreName} - Tilføj Produkt";
            _currentPageViewModel = _pageViewModels[2];
        }
Пример #11
0
        protected void lnkSelectSchool_Click(object sender, EventArgs e)
        {
            IAutocomplete org = null;


            AutoCompleteManager acManager = new AutoCompleteManager();

            org = acManager.GetIAutocompleteByReference(acSchoolOrg.SelectedID);

            if (org != null)
            {
                acSchoolOrg.Populate(org);
            }
        }
Пример #12
0
        private void PopulateFields()
        {
            AutoCompleteManager amManager = new AutoCompleteManager();
            IAutocomplete       org       = amManager.GetIAutocompleteByReference(CRM_CalendarCPD.SchoolOrganisationReference);

            ucACSchoolOrganisation.Populate(org);
            txtAttendees.Text = CRM_CalendarCPD.Attendees.ToString();

            if (CRM_CalendarCPD.ConfirmationSent != null)
            {
                txtConfirmationSent.Value = (DateTime)CRM_CalendarCPD.ConfirmationSent;
            }

            ddlLength.SelectedValue  = CRM_CalendarCPD.Length.ToString();
            ddlPackage.SelectedValue = CRM_CalendarCPD.CRM_PackageID.ToString();
            txtInitials.Text         = CRM_CalendarCPD.ConfirmationInitials;
        }
        /// <summary>
        ///     ConsumerViewModel constructor creates a Consumer, adds the user controlls to a list and connects to the database 
        /// </summary>
        public ConsumerViewModel(IConsumer user, IAutocomplete autocomplete, IDatabaseFunctions databaseFunctions)
        {
            // Add available pages
            PageViewModels.Add(new HomeModel());
            PageViewModels.Add(new FindProductModel(user, autocomplete));
            PageViewModels.Add(new ShoppingListModel(user, autocomplete));
            PageViewModels.Add(new GeneratedShoppingListModel(user,
                new Mail(new SmtpClientWrapper("Smtp.gmail.com", 587,
                    new NetworkCredential("*****@*****.**", "pristjek"), true))));

            if (!databaseFunctions.ConnectToDb())
                //Force database to connect at startup, and close application if it cant connect
            {
                MessageBox.Show("Der kan ikke tilsluttes til serveren", "ERROR", MessageBoxButton.OK);
                Application.Current.MainWindow.Close();
            }

            // Set starting page
            MainWindowTekst = "Pristjek220 - Forbruger - Startside";
            CurrentPageViewModel = PageViewModels[0];
        }
Пример #14
0
        public override void Start()
        {
            base.Start();

            Platform.Current.Page.Title = "Escritorio";

            IAutocomplete automcomplete = Platform.Current.Create <IAutocomplete>();

            automcomplete.Searching += Automcomplete_Searching;

            ILabel label = Platform.Current.Create <ILabel>();

            label.Text = "hola amigo!";

            IStack stack = Platform.Current.Create <IStack>();

            stack.Children.Add(label);
            stack.Children.Add(automcomplete);

            Platform.Current.Page.Content = stack;
        }
Пример #15
0
        /// <summary>
        /// Start this instance.
        /// <para xml:lang="es">
        /// Inicia la instancia del Autocomplete.
        /// </para>
        /// </summary>
        public override void Start()
        {
            base.Start();

            // Create a Stack
            IStack Stack = Platform.Current.Create <IStack>();

            // Creates an Label with text and a specific size and adds it to the stack.
            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text     = "Tis is my team";
            lblLabel.Height   = 50;
            lblLabel.FontSize = 20;
            Stack.Children.Add(lblLabel);

            // Create an Autocomplete with a size and type text color and size specific and adds it to the stack.
            IAutocomplete txtBox = Platform.Current.Create <IAutocomplete>();

            txtBox.Name        = "Team";
            txtBox.FontColor   = new Color(1, 36, 24, 130);
            txtBox.BorderColor = new Color(1, 229, 238, 0);
            txtBox.Width       = 100;
            txtBox.Height      = 80;
            txtBox.FontFamily  = "Times new roman";
            txtBox.FontSize    = 20;
            txtBox.Searching  += TxtBox_Searching;
            Stack.Children.Add(txtBox);

            // Creates a button with your event Click and adds it to the stack.
            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            Stack.Children.Add(cmdClose);

            // Establishes the content and title of the page
            Platform.Current.Page.Title   = "Test Autocomplete";
            Platform.Current.Page.Content = Stack;
        }
        public void SetUp()
        {
            var context = new DataContext();
            _unit = new UnitOfWork(context);
            context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
            context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
            _store = new Store() {StoreName = "TestStore"};
            _unit.Stores.Add(_store);
            _product = new Product() {ProductName = "Testproduct"};
            _unit.Products.Add(_product);
            _unit.Complete();
            _unit.HasA.Add(new HasA() {Product = _product, ProductId = _product.ProductId, Store = _store, StoreId = _store.StoreId, Price = 10});
            _unit.Complete();

            _manager = new Storemanager(_unit, _store);
            _autocomplete = new Autocomplete(_unit);
            _createMsgBox = Substitute.For<ICreateMsgBox>();
            _changePriceModel = new ChangePriceModel(_manager, _autocomplete, _createMsgBox);
            _deleteProductModel = new DeleteProductModel(_manager, _autocomplete, _createMsgBox);
        }
 public void SetUp()
 {
     _storemanager = Substitute.For<IStoremanager>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _msgBox = Substitute.For<ICreateMsgBox>();
     _uut = new ChangePriceModel(_storemanager, _autocomplete, _msgBox);
     _productAndPrice.Name = "Banan";
     _productAndPrice.Price = 12;
 }
        public void SetUp()
        {
            _context = new DataContext();
            _unit = new UnitOfWork(_context);

            _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;MultipleActiveResultSets=True;";
            _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");

            _store = new Store() { StoreName = "TestStore" };
            _autocomplete = new Autocomplete(_unit);
            _msgBox = Substitute.For<ICreateMsgBox>();

            _context.Stores.Add(_store);
            _context.SaveChanges();

            _storemanager = new Storemanager(_unit, _store);
            _newProduct = new NewProductModel(_storemanager, _autocomplete, _msgBox );

            _context.Products.Add(new Product() {ProductName = "Test"});
            _context.Products.Add(new Product() { ProductName = "Test2" });
            _context.SaveChanges();
        }
Пример #19
0
        /// <summary>
        ///     Admin constructor takes a admin and a autocomplete to create an AdminViewModel
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="autocomplete"></param>
        public Admin(IAdmin admin, IAutocomplete autocomplete)
        {
            InitializeComponent();

            DataContext = new AdminViewModel(admin, autocomplete);
        }
 public void SetUp()
 {
     _autoComplete = Substitute.For<IAutocomplete>();
     _user = Substitute.For<IConsumer>();
     _uut = new FindProductModel(_user, _autoComplete);
 }
 public void SetUp()
 {
     _context = new DataContext();
     _unit = new UnitOfWork(_context);
     _autoCom = new Autocomplete(_unit);
     _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
     _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
 }
Пример #22
0
 public void SetUp()
 {
     this.fakeDbContext = new FakeDbContext();
     this.autocomplete = new DomainAutocomplete.Autocomplete(FakeRepository<Place>.Mock(fakeDbContext.Places), FakeRepository<Building>.Mock(fakeDbContext.Buildings));
 }
 /// <summary>
 ///     AdminDeleteStoreModel constructor takes a UnitOfWork to create an admin
 /// </summary>
 /// <param name="autocomplete"></param>
 /// <param name="msgBox"></param>
 /// <param name="admin"></param>
 public AdminDeleteStoreModel(IAdmin admin, IAutocomplete autocomplete, ICreateMsgBox msgBox)
 {
     _admin = admin;
     _autocomplete = autocomplete;
     _msgBox = msgBox;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AutocompleteController"/> class.
 /// </summary>
 /// <param name="autocomplete">
 /// The autocomplete. 
 /// </param>
 public AutocompleteController(IAutocomplete autocomplete)
 {
     this.autocomplete = autocomplete;
 }
Пример #25
0
 public void SetUp()
 {
     this.unitOfWork = new FakeUnitOfWork(new FakeDbContext());
     this.autocomplete = new Autocomplete(this.unitOfWork);
 }
 public void SetUp()
 {
     _consumer = Substitute.For<IConsumer>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _databaseFunctions = Substitute.For<IDatabaseFunctions>();
     _databaseFunctions.ConnectToDb().Returns(true);
     _uut = new ConsumerViewModel(_consumer, _autocomplete, _databaseFunctions);
 }
 /// <summary>
 ///     FindProductModel constructor takes a UnitOfWork and a user and reads from a file if there is a local shoppinglist
 /// </summary>
 /// <param name="user"></param>
 /// <param name="autoComplete"></param>
 public ShoppingListModel(IConsumer user, IAutocomplete autoComplete)
 {
     autocomplete = autoComplete;
     User = user;
     ShoppingListData = new ObservableCollection<ProductInfo>();
     User.ReadFromJsonFile();
 }
 public void SetUp()
 {
     _admin = Substitute.For<IAdmin>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _uut = new AdminViewModel(_admin, _autocomplete);
 }
 public void SetUp()
 {
     this.unitOfWork = new FakeUnitOfWork(new FakeDbContext());
     this.autocomplete = new FakeAutocomplete();
     this.autocompleteController = new AutocompleteController(this.autocomplete);
 }
 public void SetUp()
 {
     _autoComplete = Substitute.For<IAutocomplete>();
     _user = Substitute.For<IConsumer>();
     _uut = new ShoppingListModel(_user, _autoComplete);
 }
 /// <summary>
 ///     DeletePriceModel constructor takes a UnitOfWork and a store to create a Storemanager and a AutoComplete
 /// </summary>
 /// <param name="storemanager"></param>
 /// <param name="autocomplete"></param>
 /// <param name="msgBox"></param>
 public DeleteProductModel(IStoremanager storemanager, IAutocomplete autocomplete, ICreateMsgBox msgBox)
 {
     _manager = storemanager;
     _autocomplete = autocomplete;
     _msgBox = msgBox;
 }
 /// <summary>
 ///     ChangePriceModel constructor takes a UnitOfWork and a store to create a Storemanager and a AutoComplete
 /// </summary>
 /// <param name="storemanager"></param>
 /// <param name="autocomplete"></param>
 /// <param name="msgBox"></param>
 public ChangePriceModel(IStoremanager storemanager, IAutocomplete autocomplete, ICreateMsgBox msgBox)
 {
     _manager = storemanager;
     _autocomplete = autocomplete;
     _msgBox = msgBox;
 }
Пример #33
0
        public ISearchFrame GetSearchFrame(IIndexable[] indexables)
        {
            indexables = indexables?.Where(x => x != null).ToArray() ?? new IIndexable[0];

            if (!indexables.Any())
            {
                Func <string>          getUpdatedState = () => $"{_updateCounter}-{SearchResources.UpdateCounter}";
                Func <IndexableResult> fetchIndexables = () => new IndexableResult(_indexers.SelectMany(x => x()).ToArray(), getUpdatedState());
                var indexableUpdateState = new IndexableUpdateState(fetchIndexables, getUpdatedState);
                return(new UpdateableIndexableSearchFrame(indexableUpdateState));
            }

            Type type = indexables.First().GetType();

            var closedActionType = GetInstanceOfGenericType(typeof(IAction <>), type);

            if (closedActionType != null && closedActionType == typeof(IAction <StringIndexable>))
            {
                if (indexables.Length > 1)
                {
                    return(null);
                }

                if (typeof(IHasSearchFrame).IsAssignableFrom(type))
                {
                    IHasSearchFrame hasSearchFrame = (IHasSearchFrame)Activator.CreateInstance(type);
                    return(hasSearchFrame.GetSearchFrame());
                }

                if (typeof(IAutocomplete).IsAssignableFrom(type))
                {
                    IAutocomplete autocomplete = (IAutocomplete)Activator.CreateInstance(type);
                    return(new StringSearchFrame(autocomplete.GetAutocompleteResults));
                }

                return(new StringSearchFrame(null));
            }

            var targetTypes = new Type[0];

            foreach (IIndexable indexable in indexables)
            {
                if (indexable is IAction)
                {
                    if (targetTypes.Any())
                    {
                        return(null);
                    }

                    var actionParameterTypes = indexable.GetType().GetInterfaces()
                                               .Where(x => x.IsGenericTypeDefinition && x.GetGenericTypeDefinition() == typeof(IAction <>))
                                               .Select(x => x.GenericTypeArguments[0])
                                               .ToArray();

                    targetTypes = actionParameterTypes;
                }
                else if (indexable is IConvert)
                {
                    if (targetTypes.Length == 1)
                    {
                        var convertParameterTypes = indexable.GetType().GetInterfaces()
                                                    .Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IConvert <,>) && x.GenericTypeArguments[0] == targetTypes[0])
                                                    .Select(x => x.GenericTypeArguments[1])
                                                    .ToArray();

                        targetTypes = convertParameterTypes;
                    }
                }
                else
                {
                    targetTypes = new[] { indexable.GetType() };
                }
            }

            var actionTypes = targetTypes
                              .SelectMany(x => GetActionForInType(x).Select(y => y.ActionType))
                              .ToArray();

            var convertTypes = targetTypes
                               .SelectMany(x => GetConvertForInType(x).Select(y => y.ConvertType))
                               .ToArray();

            if (actionTypes.Any())
            {
                var matchedIndexables = actionTypes.Concat(convertTypes).Select(Activator.CreateInstance).OfType <IIndexable>().ToArray();
                return(new IndexableSearchFrame(matchedIndexables));
            }

            return(null);
        }
 /// <summary>
 ///     FindProductModel constructor takes a UnitOfWork and a user
 /// </summary>
 /// <param name="user"></param>
 /// <param name="autoComplete"></param>
 public FindProductModel(IConsumer user, IAutocomplete autoComplete)
 {
     User = user;
     autocomplete = autoComplete;
 }
        protected void lnkSelect_Click(object sender, EventArgs e)
        {
            IAutocomplete contact = (IAutocomplete)CRM.Code.Utils.SharedObject.SharedObject.GetSharedObjects <IContact>(db).Single(v => v.Reference.ToString() == acPersons.SelectedID);

            acPersons.Populate(contact);
        }
Пример #36
0
 public NewProductModel()
 {
     _manager = new Storemanager(new UnitOfWork(new DataContext()), new Store() { StoreName = "Aldi" });
     _autocomplete = new SharedFunctionalities.Autocomplete(_unit);
 }
 public void SetUp()
 {
     _admin = Substitute.For<IAdmin>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _msgBox = Substitute.For<ICreateMsgBox>();
     _uut = new AdminDeleteStoreModel(_admin, _autocomplete, _msgBox);
     _store = new Store() {StoreId = 12, StoreName = "Lidl"};
 }
 /// <summary>
 ///     StoremanagerGUI constructor takes a UnitOfWork to create an StoremanagerViewModel
 /// </summary>
 /// <param name="autocomplete"></param>
 /// <param name="storemanager"></param>
 public StoremanagerGUI(IAutocomplete autocomplete, IStoremanager storemanager)
 {
     InitializeComponent();
     base.DataContext = new StoremanagerViewModel(storemanager, autocomplete);
 }
 public void SetUp()
 {
     this.autocomplete = new FakeAutocomplete();
     this.autocompleteController = new AutocompleteController(this.autocomplete);
 }
 public void SetUp()
 {
     _storemanager = Substitute.For<IStoremanager>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _msgBox = Substitute.For<ICreateMsgBox>();
     _uut = new DeleteProductModel(_storemanager, _autocomplete, _msgBox);
     _product = new Product() { ProductName = "Banan", ProductId = 12 };
 }
        public void SetUp()
        {
            _context = new DataContext();
            _unitOfWork = new UnitOfWork(_context);
            _autocomplete = new Autocomplete(_unitOfWork);
            _msgBox = Substitute.For<ICreateMsgBox>();
            _admin = new Admin(_unitOfWork);
            _adminDeleteStoreModel = new AdminDeleteStoreModel(_admin, _autocomplete, _msgBox);
            _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
            _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
            _secureStringTest.AppendChar('A');
            _secureStringTest.AppendChar('B');
            _secureStringTest.AppendChar('C');

            _admin.CreateLogin("Teststore", _secureStringTest, "Teststore");
            _msgBox.DeleteStoreMgsConfirmation("Teststore").Returns(DialogResult.Yes);
        }
        public void SetUp()
        {
            _context = new DataContext();
            _unit = new UnitOfWork(_context);

            _context.Database.Connection.ConnectionString =
                "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;MultipleActiveResultSets=True;";
            _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");

            var store = new Store() {StoreName = "TestStore"};
            var store2 = new Store() { StoreName = "TestStore2" };
            _context.Stores.Add(store);
            _context.Stores.Add(store2);
            _context.SaveChanges();

            _product = new Product() {ProductName = "Test"};
            _product2 = new Product() {ProductName = "Test2"};
            var hasA = new HasA() {Price = 4, Product = _product, Store = store};
            var hasA2 = new HasA() {Price = 6, Product = _product2, Store = store};
            var hasA3 = new HasA() { Price = 5, Product = _product, Store = store2 };

            _context.Products.Add(_product);
            _context.Products.Add(_product2);
            _context.HasARelation.Add(hasA2);
            _context.HasARelation.Add(hasA);
            _context.HasARelation.Add(hasA3);
            _context.SaveChanges();

            _consumer = new global::Consumer.Consumer(_unit);
            _mail = Substitute.For<IMail>();
            _autocomplete = new Autocomplete(_unit);
            _generatedShoppingList = new GeneratedShoppingListModel(_consumer, _mail);
            _shoppingList = new ShoppingListModel(_consumer, _autocomplete);
            _findProduct = new FindProductModel(_consumer, _autocomplete);

            _shoppingList.ClearShoppingListCommand.Execute(this);
        }