protected override void OnCreate(Bundle savedInstanceState)
        {
            ChatViewModel    = EngineService.EngineInstance.ChatListViewModel;
            ContactViewModel = EngineService.EngineInstance.ContactListViewModel;

            base.OnCreate(savedInstanceState);
            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            imgProfile = FindViewById <ImageView>(Resource.Id.imgProfile);

            ViewContactUserId       = Intent.GetIntExtra(DETAIL_VIEW_USER_ID, 0);
            txtStatusLastUpdateDate = FindViewById <TextView>(Resource.Id.txtStatusLastUpdate);
            txtStatusContent        = FindViewById <TextView>(Resource.Id.txtStatusContent);
            txtUserName             = FindViewById <TextView>(Resource.Id.txtUserName);
            txtUserPhone            = FindViewById <TextView>(Resource.Id.txtUserPhone);
            txtUserEmail            = FindViewById <TextView>(Resource.Id.txtUserEmail);
            imgPhone = FindViewById <ImageView>(Resource.Id.imgPhone);
            imgEmail = FindViewById <ImageView>(Resource.Id.imgEmail);
            btBlock  = FindViewById <Button>(Resource.Id.btBlock);
            fab      = FindViewById <FloatingActionButton>(Resource.Id.fab);

            btChat        = FindViewById <Button>(Resource.Id.btStartChat);
            btCall        = FindViewById <Button>(Resource.Id.btCall);
            btChat.Click += BtChat_Click;
        }
        private void NewContact()
        {
            Contact newContact = Root.AddNewContact();

            ContactListViewModel.SelectedContact = newContact;
            ContactListViewModel.FocusItem();
        }
        public void Can_Paginate()
        {
            //arrange
            Mock <IContactRepository> mock = new Mock <IContactRepository>();

            mock.Setup(m => m.Contacts).Returns(new Contact[]
            {
                new Contact {
                    ContactId = 1, LastName = "1"
                },
                new Contact {
                    ContactId = 2, LastName = "2"
                },
                new Contact {
                    ContactId = 3, LastName = "3"
                },
                new Contact {
                    ContactId = 4, LastName = "4"
                },
                new Contact {
                    ContactId = 5, LastName = "5"
                }
            }.AsQueryable());
            ContactController controller = new ContactController(mock.Object);

            //act
            ContactListViewModel result = (ContactListViewModel)controller.List(null, null, 3, 2).Model;

            //assert
            Contact[] contArray = result.Contacts.ToArray();
            Assert.IsTrue(contArray.Length == 2);
            Assert.AreEqual(contArray[0].LastName, "4");
            Assert.AreEqual(contArray[1].LastName, "5");
        }
Exemplo n.º 4
0
        public IActionResult ViewDetails(int?id)
        {
            //Fetch contact from db
            if (id == null)
            {
                return(StatusCode(StatusCodes.Status400BadRequest));
            }

            var contact = _contactRepository.GetContactById(id);

            if (contact == null)
            {
                return(NotFound());
            }

            ContactListViewModel model = new ContactListViewModel()
            {
                ContactId      = contact.ContactId,
                FirstName      = contact.FirstName,
                LastName       = contact.LastName,
                ContactNumber1 = contact.ContactNumber1,
                ContactNumber2 = contact.ContactNumber2,
                ContactNumber3 = contact.ContactNumber3,
                CompanyName    = contact.CompanyName,
                EmailId        = contact.EmailId,
                Country        = contact.Country.Name,
                State          = contact.State.Name,
                HomeAddress    = contact.HomeAddress,
                WorkAddress    = contact.WorkAddress,
                ImagePath      = contact.ImagePath
            };

            return(View(model));
        }
Exemplo n.º 5
0
        public IActionResult add()
        {
            Boolean active = false;

            if (Request.Form["Active"] == "on")
            {
                active = true;
            }
            var contactList = new List <Contact> {
            };

            contactList.Add(new Contact
            {
                First_name     = Request.Form["First_name"],
                Last_name      = Request.Form["Last_name"],
                Middle_initial = Request.Form["middle_Initial"],
                Home_phone     = Request.Form["Home_phone"],
                Cell_phone     = Request.Form["Cell_phone"],
                Office_ext     = Request.Form["Office_ext"],
                IRD            = int.Parse(Request.Form["IRD"]),
                active         = active,
            });

            exportToCSV(contactList);
            var viewModel = new ContactListViewModel
            {
                Contacts = read()
            };

            return(View("Index", viewModel));
        }
Exemplo n.º 6
0
        // GET: Contact
        public async Task <ActionResult> Index(int?pageNumber)
        {
            if (TempData["SuccessMessage"] != null)
            {
                ViewBag.SuccessMessage = TempData["SuccessMessage"].ToString();
            }

            if (TempData["ErrorMessage"] != null)
            {
                ViewBag.ErrorMessage = TempData["ErrorMessage"].ToString();
            }

            int PageNo = pageNumber ?? 1;

            var list = await _contactService.GetAll(PageNo, Common.RecordsPerPage);

            int TotalRecords = await _contactService.GetTotalRecordsCount();

            var pager = new PagingModel()
            {
                ActionName = "Index", ControllerName = "Contact", CurrentPage = PageNo, TotalRecords = TotalRecords, RecordsPerPage = Common.RecordsPerPage
            };
            ContactListViewModel model = new ContactListViewModel()
            {
                list = list, pager = pager
            };

            return(View(model));
        }
Exemplo n.º 7
0
        // GET: Contact
        public ViewResult List(string city = null, string function = null, int items = 3, int page = 1)
        {
            ContactListViewModel model = new ContactListViewModel
            {
                Contacts = repository.Contacts
                           .Where(c => city == null || c.City == city).Where(c => function == null || c.Function == function)
                           .OrderBy(c => c.ContactId).Skip((page - 1) * items).Take(items),
                PagingInfo = new PagingInfo
                {
                    CurrenPage   = page,
                    ItemsPerPage = items,
                    TotalItems   = (city == null & function == null) ? repository.Contacts.Count() :
                                   repository.Contacts.Where(e => city == null || e.City == city).Count(e => function == null || e.Function == function)
                },
                CurrentCity     = city,
                CurrentFunction = function
            };

            if (city == null & function == null)
            {
                return(View(model));
            }
            else
            {
                return(View("ListByCityOrFunction", model));
            }
        }
        public ActionResult Edit(ContactListViewModel CVM)
        {
            ContactListClient CC = new ContactListClient();

            CC.Edit(CVM.contactlist);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public ActionResult ListByName(string lastName)
        {
            ContactListViewModel model = new ContactListViewModel
            {
                Contacts = repository.Contacts
                           .Where(c => lastName == null || c.LastName == lastName).OrderBy(c => c.LastName),
                PagingInfo = new PagingInfo
                {
                    CurrenPage   = 1,
                    ItemsPerPage = 3,
                    TotalItems   = repository.Contacts.Where(e => lastName == null || e.LastName == lastName).Count()
                },
                CurrentCity     = null,
                CurrentFunction = null
            };

            if (lastName != "")
            {
                return(View(model));
            }
            else
            {
                return(RedirectToAction("FindByLastName", "Menu"));
            }
        }
        public ViewModelLocator()
        {
            try
            {
                var config = new ConfigurationBuilder();
                config.AddJsonFile("autofac.json");
                var module  = new ConfigurationModule(config.Build());
                var builder = new ContainerBuilder();
                builder.RegisterModule(module);
                Container = builder.Build();

                navigationService       = Container.Resolve <INavigationService>();
                appViewModel            = Container.Resolve <AppViewModel>();
                contactListViewModel    = Container.Resolve <ContactListViewModel>();
                addEditContactViewModel = Container.Resolve <AddEditContactViewModel>();

                navigationService.Register <ContactListViewModel>(contactListViewModel);
                navigationService.Register <AddEditContactViewModel>(addEditContactViewModel);

                navigationService.Navigate <ContactListViewModel>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 11
0
        public ActionResult Create(ContactListViewModel cvm)
        {
            ContactListClient CC = new ContactListClient();

            CC.Create(cvm.contactlist);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
        protected override void OnStart()
        {
            base.OnStart();
            if (MyProfileViewModel == null)
            {
                EngineService.EngineInstance.ProfileViewModel = new ProfileViewModel();
                MyProfileViewModel = EngineService.EngineInstance.ProfileViewModel;
            }
            if (MyContactListViewModel == null)
            {
                EngineService.EngineInstance.ContactListViewModel = new ContactListViewModel();
                MyContactListViewModel = EngineService.EngineInstance.ContactListViewModel;
            }

            MyProfileViewModel.ME = MyApplication.Me;
            MyProfileViewModel.PropertyChanged += ProfileViewModel_PropertyChanged;

            MyContactListViewModel.PropertyChanged         += ContactListViewModel_PropertyChanged;
            MyContactListViewModel.Items.CollectionChanged += ContactListViewModel_CollectionChanged;
            if (MyContactListViewModel.Items == null || MyContactListViewModel.Items.Count == 0)
            {
                MyContactListViewModel.LoadAllContactListItemCommand.Execute(MyApplication.Me.TOKEN);
            }
            InitViews();
        }
 public ContactListPage()
 {
     InitializeComponent();
     _vm               = new ContactListViewModel();
     BindingContext    = _vm;
     _vm.ItemSelected += OnItemSelected;
 }
Exemplo n.º 14
0
 public void ShowContacts(ContactListViewModel contactList)
 {
     _contactsAdapter.ReplaceData(contactList);
     ToggleRefreshing(false);
     ToggleRetryOverlay(false);
     ToggleLoadingOverlay(false);
 }
        public ContactListPage()
        {
            InitializeComponent();

            ViewModel = new ContactListViewModel(Navigation);
            ViewModel.RefreshCommand.Execute(null);
        }
Exemplo n.º 16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            MyProfileViewModel     = EngineService.EngineInstance.ProfileViewModel;
            MyContactListViewModel = EngineService.EngineInstance.ContactListViewModel;

            base.OnCreate(savedInstanceState);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.Title = "Privacy";
            txtWhoCanSee = FindViewById <TextView>(Resource.Id.txtWhoCanSee);
            txtMessaging = FindViewById <TextView>(Resource.Id.txtMessaging);

            txtProfilePhotoIndicator = FindViewById <TextView>(Resource.Id.txtProfilePhotoIndicator);
            txtProfilePhoto          = FindViewById <TextView>(Resource.Id.txtProfilePhoto);
            txtStatusIndicator       = FindViewById <TextView>(Resource.Id.txtStatusIndicator);
            txtStatus = FindViewById <TextView>(Resource.Id.txtStatus);
            txtBlockedContactIndicator = FindViewById <TextView>(Resource.Id.txtBlockedContactIndicator);
            txtBlockedContact          = FindViewById <TextView>(Resource.Id.txtBlockedContact);

            btProfilePhoto = FindViewById <Button>(Resource.Id.btProfilePhoto);
            btStatus       = FindViewById <Button>(Resource.Id.btStatus);
            btBlocked      = FindViewById <Button>(Resource.Id.btBlocked);

            btProfilePhoto.Click += BtProfilePhoto_Click;
            btStatus.Click       += BtStatus_Click;
            btBlocked.Click      += BtBlocked_Click;
        }
        public void Should_Search_Contacts_Execute()
        {
            //ARRANGE
            var contactsDataService = MockRepository.GenerateStub <IContactsDataService>();
            var stateManager        = MockRepository.GenerateStub <IVisualStateManager>();
            var dispatcher          = new MockDispatcherService();
            var mockContactData     = new List <Contact>
            {
                new Contact()
            };

            //ACT..
            var viewModel = new ContactListViewModel(contactsDataService, stateManager, dispatcher);

            viewModel.SearchCommand.Execute("some string");

            //we have to make our mock service actually pass back the mock data
            EnsureCallbackForIContactsDataServiceIsCalled(contactsDataService, s => s.GetContactsByName(null, null), mockContactData, args => args[1]);

            //ASSERT
            Assert.AreEqual(mockContactData.Count, viewModel.Contacts.Count, "The contacts were not populated");
            contactsDataService.AssertWasCalled(cds => cds.GetContacts(null), call => call.Constraints(new Anything()));
            stateManager.AssertWasCalled(sm => sm.GoToState("LoadingContacts"));
            stateManager.AssertWasCalled(sm => sm.GoToState("ContactsLoaded"));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> Edit(string id, [Bind("ContactID,FullName,PhoneNumber")] ContactListViewModel contactListViewModel)
        {
            if (id != contactListViewModel.ContactID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contactListViewModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactListViewModelExists(contactListViewModel.ContactID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contactListViewModel));
        }
Exemplo n.º 19
0
 public void ShowContacts(ContactListViewModel contactList)
 {
     _contactsTableViewController.UpdateTableViewContacts(contactList);
     ToggleLoadingOverlay(false);
     ToggleRetryOverlay(false);
     ToggleRefreshing(false);
 }
Exemplo n.º 20
0
        public IActionResult ContactList()
        {
            ContactListViewModel contactListVM = new ContactListViewModel();

            contactListVM.Contacts         = db.Contacts.ToList <Contact>();
            contactListVM.NumberOfContacts = contactListVM.Contacts.Count;
            return(View(contactListVM));
        }
Exemplo n.º 21
0
        public ActionResult GetContacts(int NumberOfContacts = int.MaxValue, short OrderChoice = 1)
        {
            var contacts = _contactService.GetContacts(null, OrderByOption.MapOrderByNickName(OrderChoice)).Take(NumberOfContacts).ToList();

            var model = new ContactListViewModel(NumberOfContacts, OrderChoice, cl.GetContactViewModelList(contacts));

            return(PartialView(model));
        }
Exemplo n.º 22
0
        public MainWindow(ContactListViewModel viewModel)
        {
            this.viewModel = viewModel;
            DataContext    = viewModel;
            InitializeComponent();

            this.Loaded += OnLoaded;
        }
Exemplo n.º 23
0
        public object CreateMainView()
        {
            var viewModel = new ContactListViewModel(new ContactListView());

            contactController = new ContactController(logService, addressBookService, viewModel);
            contactController.Initialize();
            return(viewModel.View);
        }
Exemplo n.º 24
0
        public ActionResult Pricing()
        {
            var viewmodel = new ContactListViewModel(baseviewmodel);

            viewmodel.PopulateContactGroups(repository, subdomainid.Value);

            return(View(viewmodel));
        }
Exemplo n.º 25
0
    private void DeleteContact()
    {
        var nextContact = ContactListViewModel.Contacts.GetNextElementOrDefault(ContactListViewModel.SelectedContact);

        Root.RemoveContact(ContactListViewModel.SelectedContact !);
        ContactListViewModel.SelectedContact = nextContact ?? ContactListViewModel.Contacts.LastOrDefault();
        ContactListViewModel.FocusItem();
    }
 public ContactListPage()
 {
     InitializeComponent();
     this.BindingContext   = viewModel = new ContactListViewModel();
     viewModel.CreatedById = Guid.Parse(UserLogged.Id);
     ModalAddContact.Body.BindingContext = viewModel;
     Init();
 }
Exemplo n.º 27
0
        public ActionResult Edit(int id)
        {
            ContactListClient    CC  = new ContactListClient();
            ContactListViewModel CVM = new ContactListViewModel();

            CVM.contactlist = CC.find(id);
            return(View("Edit", CVM));
        }
Exemplo n.º 28
0
 public void SetMeOnlineStatus(OnlineStatusRequest value)
 {
     if (ContactListViewModel == null)
     {
         ContactListViewModel = new ContactListViewModel();
     }
     ContactListViewModel.SetMeOnlineStatusCommand.Execute(value);
 }
Exemplo n.º 29
0
 public ContactController(IShellService shellService, ContactLayoutViewModel contactLayoutViewModel, ContactListViewModel contactListViewModel, ContactViewModel contactViewModel)
 {
     this.shellService           = shellService;
     this.contactLayoutViewModel = contactLayoutViewModel;
     ContactListViewModel        = contactListViewModel;
     ContactViewModel            = contactViewModel;
     NewContactCommand           = new DelegateCommand(NewContact);
     deleteContactCommand        = new DelegateCommand(DeleteContact, CanDeleteContact);
 }
Exemplo n.º 30
0
 public ContactController(IShellService shellService, ContactLayoutViewModel contactLayoutViewModel, ContactListViewModel contactListViewModel, ContactViewModel contactViewModel)
 {
     this.shellService = shellService;
     this.contactLayoutViewModel = contactLayoutViewModel;
     this.contactListViewModel = contactListViewModel;
     this.contactViewModel = contactViewModel;
     this.newContactCommand = new DelegateCommand(NewContact);
     this.deleteContactCommand = new DelegateCommand(DeleteContact, CanDeleteContact);
 }
 public ContactListPage(bool IsCompany)
 {
     InitializeComponent();
     _isCompany          = IsCompany;
     this.BindingContext = viewModel = new ContactListViewModel();
     viewModel.CompanyId = Guid.Parse(UserLogged.CompanyId);
     ModalAddContact.Body.BindingContext = viewModel;
     Init();
 }
Exemplo n.º 32
0
        public void Initialize()
        {
            _contactList = new ContactList();
            _viewModel = new ContactListViewModel(_contactList);
            _contactList.AddContact(new Contact() { FirstName = "Michael", LastName = "Perry" });
            _contactList.AddContact(new Contact() { FirstName = "Ada", LastName = "Lovelace" });
            _contactList.AddContact(new Contact() { FirstName = "Charles", LastName = "Babbage" });

            _collectionChangedCount = 0;
            _viewModel.ContactsCollectionChanged +=
                delegate
                {
                    _collectionChangedCount++;
                };
        }
Exemplo n.º 33
0
 public SelectContactController(SelectContactViewModel selectContactViewModel, ContactListViewModel contactListViewModel)
 {
     this.selectContactViewModel = selectContactViewModel;
     this.contactListViewModel = contactListViewModel;
     this.selectContactCommand = new DelegateCommand(SelectContact, CanSelectContact);
 }
Exemplo n.º 34
0
 public SelectContactController(SelectContactViewModel selectContactViewModel, ContactListViewModel contactListViewModel)
 {
     this.selectContactViewModel = selectContactViewModel;
     this.contactListViewModel = contactListViewModel;
 }