public CustomerDetailsWindow(int _id)
        {
            InitializeComponent();
            ListsViewModel _viewModel = new ListsViewModel(_id, "customer");

            this.DataContext = _viewModel;
        }
Пример #2
0
        public void CreateBorrowedBooksCollection()
        {
            ListsViewModel listsViewModel             = new ListsViewModel();
            ObservableCollection <BorrowedBook> books = listsViewModel.GetBorrowedBooks();

            Assert.AreEqual(books.Count, BorrowedBookCRUD.countBorrowedBooks());
        }
Пример #3
0
        public MainView()
        {
            var vmLoader = Mvx.GetSingleton <NavigationService>();

            Mvx.GetSingleton <IMessageManager>().CharacterMessageReceived += OnMessage;
            ChatViewModel   = vmLoader.Load <ChatViewModel>();
            CharacterLists  = vmLoader.Load <ListsViewModel>();
            EventsViewModel = vmLoader.Load <EventsViewModel>();
            PeopleViewModel = vmLoader.Load <ListPeopleViewModel>();
            IsHomeTabShown  = ChatViewModel.SelectedTab == ChatViewModel.HomeTab;
            EventsViewModel.Events.CollectionChanged += (sender, args) => {
                if (args.Action != NotifyCollectionChangedAction.Add)
                {
                    return;
                }
                foreach (EventViewModel evm in args.NewItems)
                {
                    OnEvent(evm);
                }
            };
            var characterManager = Mvx.GetSingleton <ICharacterManager>();
            var channelManager   = Mvx.GetSingleton <IChannelManager>();

            ChatViewModel.SelectedTabChanged += () => {
                IsHomeTabShown = ChatViewModel.SelectedTab == ChatViewModel.HomeTab;
                var channelTab = ChatViewModel.SelectedTab as ChannelConversationViewModel;
                ChannelMembers = channelTab != null ? new ChannelMembersViewModel(channelManager, characterManager, channelTab.Channel) : null;
                if (!IsHomeTabShown)
                {
                    MessagesView.ViewModel = (ConversationViewModel)ChatViewModel.SelectedTab;
                }
            };
            InitializeComponent();
            DataContextChanged += OnViewModelSet;
        }
Пример #4
0
        public BookDetailsWindow(int _id)
        {
            InitializeComponent();
            ListsViewModel _viewModel = new ListsViewModel(_id, "book");

            this.DataContext = _viewModel;
        }
Пример #5
0
        public BookEditWindow(int _id)
        {
            InitializeComponent();
            ListsViewModel _viewModel = new ListsViewModel(_id, "book");

            DataContext = _viewModel;
        }
Пример #6
0
        public void CreateCustomersCollection()
        {
            ListsViewModel listsViewModel             = new ListsViewModel();
            ObservableCollection <Customer> customers = listsViewModel.GetCustomers();

            Assert.AreEqual(customers.Count, CustomerCRUD.countCustomers());
        }
        public ListsView()
        {
            InitializeComponent();
            var model = new ListsViewModel();

            BindingContext = model;
        }
Пример #8
0
        public ActionResult MyList(int?id)
        {
            var user    = UserManager.FindById(User.Identity.GetUserId());
            var getWord = _context.UserLists.SingleOrDefault(l => l.UserName == user.UserName &&
                                                             l.Id == id);

            if (getWord != null && getWord.Word != null)
            {
                var wordList = getWord.Word.Split(',').Select(w => w.Trim())
                               .Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                var listViewModel = new ListsViewModel()
                {
                    ListName = getWord.ListName,
                    Words    = wordList,
                    ListId   = getWord.Id
                };
                return(View(listViewModel));
            }
            else if (getWord != null && getWord.ListName != null)
            {
                var listViewModel = new ListsViewModel()
                {
                    ListName = getWord.ListName,
                };
                return(View(listViewModel));
            }

            return(View());
        }
Пример #9
0
        public async Task <IActionResult> ListTe()
        {
            /*
             * var Softwares = await _context.Softwares
             *  .Include(s => s.AppUser)
             *  .Include(s => s.TechArea)
             *  .Include(s => s.Tipi)
             *  .Include(s => s.Teams)
             *  .Include(s => s.SoftwareTeams).ToListAsync(); */
            var Softwares = await _context.Softwares.Include(s => s.Tipi).ToListAsync();

            var SoftwareTeams = await _context.SoftwareTeams.ToListAsync();

            var Teams = await _context.Teams.ToListAsync();



            var vm = new ListsViewModel()
            {
                Softwares     = Softwares,
                SoftwareTeams = SoftwareTeams,
                Teams         = Teams
            };


            return(View(vm));
        }
Пример #10
0
 public async Task <IActionResult> Delete(long?id)
 {
     if (id.HasValue)
     {
         return(View(ListsViewModel.GetAList(id.Value, await APIListGetOne(id.Value))));
     }
     return(RedirectToAction("Index", "Home"));
 }
Пример #11
0
        public async Task <IActionResult> ListTa()
        {
            var vm = new ListsViewModel
            {
                Softwares = await _context.Softwares.Include(t => t.Tipi).ToListAsync(),
                TechAreas = await _context.TechAreas.AsNoTracking().ToListAsync()
            };

            return(View(vm));
        }
Пример #12
0
        public ActionResult CreateList(string title)
        {
            TokenRepository repository = new TokenRepository(Request, Response);
            ListsViewModel  model      = new ListsViewModel();

            model.IsConnectedToO365 = repository.IsConnectedToO365;

            repository.CreateList(title);

            return(RedirectToAction("Index"));
        }
Пример #13
0
        //
        // GET: /Lists/
        public ActionResult Index()
        {
            TokenRepository repository = new TokenRepository(Request, Response);
            ListsViewModel  model      = new ListsViewModel();

            model.IsConnectedToO365 = repository.IsConnectedToO365;
            model.SiteTitle         = repository.GetSiteTitle();
            model.Lists             = repository.GetLists();

            return(View(model));
        }
Пример #14
0
        public void CheckContentOfCustomersCollection()
        {
            ListsViewModel listsViewModel             = new ListsViewModel();
            ObservableCollection <Customer> customers = listsViewModel.GetCustomers();

            for (int i = 0; i < customers.Count; i++)
            {
                Assert.AreEqual(customers[i].Name, CustomerCRUD.getName(customers[i].CustomerId));
                Assert.AreEqual(customers[i].Money, CustomerCRUD.getMoney(customers[i].CustomerId));
            }
        }
Пример #15
0
        public void CheckContentOfBooksCollection()
        {
            ListsViewModel listsViewModel     = new ListsViewModel();
            ObservableCollection <Book> books = listsViewModel.GetBooks();

            for (int i = 0; i < books.Count; i++)
            {
                Assert.AreEqual(books[i].Title, BookCRUD.getTitle(books[i].BookId));
                Assert.AreEqual(books[i].Author, BookCRUD.getAuthor(books[i].BookId));
            }
        }
Пример #16
0
        public void CheckContentOfBorrowedBooksCollection()
        {
            ListsViewModel listsViewModel             = new ListsViewModel();
            ObservableCollection <BorrowedBook> books = listsViewModel.GetBorrowedBooks();

            for (int i = 0; i < books.Count; i++)
            {
                Assert.AreEqual(books[i].BBookId, BorrowedBookCRUD.getBookId(books[i].BorrowedBookId));
                Assert.AreEqual(books[i].BCustomerId, BorrowedBookCRUD.getCustomerId(books[i].BorrowedBookId));
            }
        }
Пример #17
0
        public async Task <ActionResult> Index(string list = null, string task = null)
        {
            ListsViewModel vm = await BuildViewModel(list, task);

            //if (!string.IsNullOrWhiteSpace(list) && vm.SelectedList == null)
            //    return HttpNotFound();  // Don't do this as we refresh the demo data periodically

            //if (!string.IsNullOrWhiteSpace(task) && vm.SelectedTask == null)
            //    return HttpNotFound(); // Don't do this as we refresh the demo data periodically

            return(View(vm));
        }
Пример #18
0
        public async Task <IActionResult> Update(long id, [Bind("ID,Name,IsDone")] ToDoList list)
        {
            ListsViewModel lvm = ListsViewModel.GetAList(id, await APIListGetOne(id));

            if (ModelState.IsValid)
            {
                list.ID = (int)id;
                await APIListPut(id, list);

                return(RedirectToAction("Index", "Home"));
            }
            return(View(ListsViewModel.GetAList(id, await APIListGetOne(id))));
        }
Пример #19
0
        public async Task <IActionResult> ListDe()
        {
            var vm = new ListsViewModel
            {
                Softwares = await _context.Softwares.Include(s => s.AppUser)
                            .ThenInclude(u => u.Team)
                            .ThenInclude(d => d.Department)
                            .Include(t => t.Tipi)
                            .Include(it => it.ItOwner)
                            .ToListAsync(),
                Departments = await _context.Departments.ToListAsync()
            };

            return(View(vm));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,IsDone,ToDoList")] ToDoItem toDo)
        {
            HomeController hc      = new HomeController();
            ListsViewModel lvm     = ListsViewModel.GetLists(toDo.ID, await hc.APIListGet());
            ToDoList       getList = lvm.ToDoLists.FirstOrDefault(i => i.Name == toDo.ToDoList);

            toDo.ListID = getList.ID;

            if (ModelState.IsValid)
            {
                await APITaskPost(toDo);

                return(RedirectToAction("Index"));
            }
            return(View(lvm));
        }
        public async Task <IActionResult> Update(int id, [Bind("ID,Name,IsDone,ToDoList")] ToDoItem toDo)
        {
            HomeController hc      = new HomeController();
            ListsViewModel lvm     = ListsViewModel.GetLists(id, await hc.APIListGet());
            ToDoList       getList = lvm.ToDoLists.FirstOrDefault(i => i.Name == toDo.ToDoList);

            toDo.ListID = getList.ID;

            if (ModelState.IsValid)
            {
                toDo.ID = id;
                await APITaskPut(toDo.ID, toDo);

                return(RedirectToAction("Index", "ToDo"));
            }
            return(View(TaskViewModel.GetDetails(id, await hc.APIListGet(), await APItodoGetOne(id))));
        }
Пример #22
0
        // GET: List
        public ActionResult ListIndex(BaseViewModel baseViewModel)
        {
            var viewModel = new ListsViewModel();

            viewModel.SessionId = baseViewModel.SessionId;

            if (_sessionManager.IsActive(viewModel.SessionId))
            {
                viewModel.Lists = _listManager.GetLists(viewModel.SessionId);
                viewModel.User  = _sessionManager.GetSession(viewModel.SessionId).User;
                return(View(viewModel));
            }
            else
            {
                return(RedirectToAction("SignInForm", "Auth"));
            }
        }
Пример #23
0
        private async Task <ListsViewModel> BuildViewModel(string list = null, string task = null, string listName = null)
        {
            var lists = await _listsService.GetAllLists();

            var vm = new ListsViewModel()
            {
                Lists = lists
            };

            //Set selected list
            if (vm.Lists.Any())
            {
                if (!string.IsNullOrWhiteSpace(list))
                {
                    vm.SelectedList = vm.Lists.SingleOrDefault(x => x.Id == list);
                }
                else if (!string.IsNullOrWhiteSpace(listName))
                {
                    vm.SelectedList = vm.Lists.SingleOrDefault(x => x.Name == listName);
                }

                if (vm.SelectedList == null)
                {
                    vm.SelectedList = vm.Lists[0];
                }
            }

            //Set selected task view model
            if (!string.IsNullOrWhiteSpace(list) && vm.SelectedList != null && vm.SelectedList.Tasks != null && vm.SelectedList.Tasks.Any())
            {
                var t = vm.SelectedList.Tasks.FirstOrDefault(x => x.Id == task);
                if (t != null && vm.SelectedList != null)
                {
                    vm.SelectedTask.Task   = t;
                    vm.SelectedTask.ListId = vm.SelectedList.Id;
                }
            }

            return(vm);
        }
Пример #24
0
        // GET: Dictionary

        public ActionResult Index(string word = "")
        {
            var user           = UserManager.FindById(User.Identity.GetUserId());
            var listsViewModel = new ListsViewModel();

            if (user != null)
            {
                var getCurrentLists = _context.UserLists.Where(l => l.UserName == user.UserName).ToList();

                var getLists = new Dictionary <int, string>();
                foreach (var list in getCurrentLists)
                {
                    getLists.Add(list.Id, list.ListName);
                }

                listsViewModel.Word           = word;
                listsViewModel.ListDictionary = getLists;

                return(View(listsViewModel));
            }

            listsViewModel.Word = word;
            return(View(listsViewModel));
        }
        public async Task <IActionResult> Create()
        {
            HomeController hc = new HomeController();

            return(View(ListsViewModel.GetLists(0, await hc.APIListGet())));
        }
Пример #26
0
        public async Task <ActionResult> ThisWeek()
        {
            ListsViewModel vm = await BuildViewModel(listName : "This Week");

            return(View("Index", vm));
        }
Пример #27
0
        public async Task <ActionResult> Important()
        {
            ListsViewModel vm = await BuildViewModel(listName : "Important");

            return(View("Index", vm));
        }
Пример #28
0
 public void TestAddingList()
 {
     ListsViewModel mainViewModel = new ListsViewModel();
     //mainViewModel.NewListCommand("Test");
 }