public static void UpdatePhones( EntitySet <UserContact> contacts, ContactsVM contactsVM) { UpdateContact(contacts, contactsVM.Phone, ContactTypes.Phone); UpdateContact(contacts, contactsVM.Mobile, ContactTypes.Mobile); UpdateContact(contacts, contactsVM.WorkPhone, ContactTypes.WorkPhone); }
public ContactsPage() { InitializeComponent(); viewModel = Resources["vm"] as ContactsVM; NavigationPage.SetHasBackButton(this, false); BindingContext = new ContactsVM(this); }
private void switchParticipantWithContactViewBtnClick(object sender, RoutedEventArgs e) { if (!addP) { this.cvm = new ContactsVM(); this.cvm.ExcludeUsernames(this.vm.ProjectVM.Participants.Select(u => u.UserName).ToList()); this.currentContacts.DataContext = cvm; currentContacts.Visibility = Visibility.Visible; participantsLV.Visibility = Visibility.Collapsed; UpdateUserMsg(); switchParticipantWithContactViewBtn.Content = "Save"; currentPickListView.UnselectAll(); } else { var selectedContacts = currentPickListView.SelectedItems; List <string> usernames = new List <string>(); foreach (var item in selectedContacts) { ContactVM temp = item as ContactVM; if (temp != null) { usernames.Add((temp).UserName); } } this.vm.AddParticipants(usernames); this.participantsMsg.Visibility = Visibility.Collapsed; currentContacts.Visibility = Visibility.Collapsed; participantsLV.Visibility = Visibility.Visible; switchParticipantWithContactViewBtn.Content = "Add Participant"; } addP = !addP; }
public static void InitPhones(User user, ContactsVM contactsVM) { contactsVM.Phone = GetContact(user.UserContacts, ContactTypes.Phone); contactsVM.Mobile = GetContact(user.UserContacts, ContactTypes.Mobile); contactsVM.WorkPhone = GetContact(user.UserContacts, ContactTypes.WorkPhone); }
// GET: /List public ActionResult List(string id, string filter, int?page, string sortField, int?sortOrder) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(id)) { ViewData["Access"] = "WriteAccess"; } //SortField if (sortField == string.Empty) { sortField = "ContactTypeName"; } ViewData["CurrentSortField"] = sortField; //SortOrder if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; sortOrder = 0; } //Populate View Model ContactsVM contactsVM = new ContactsVM(); clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); contactsVM.ClientSubUnit = clientSubUnit; var contacts = clientSubUnitContactRepository.PageClientSubUnitContacts(id, filter ?? "", sortField, sortOrder ?? 0, page ?? 1); if (contacts != null) { contactsVM.Contacts = contacts; } return(View(contactsVM)); }
public IActionResult _Contacts() { var contacts = ServiceFactory.DriverManagement.GetDriverContacts(); var model = new ContactsVM { Contacts = contacts.Data, }; return(PartialView(model)); }
/// <summary> /// 获取联系人 /// </summary> private void LoadContacts() { var contacts = _dataService.GetContacts(); if (contacts != null) { // 拿到转换集合类型后的联系人 ContactsVM.LoadContacts(_dataService.GetContacts()); IsHidden = true; } }
public void UpdateAddressAndPhones(UserAddress newUserAddress, ContactsVM contactsVM) { var user = UserService.GetByPK(AuthService.CurrentUser.UserID); var userAddresses = user.IsCompany ? user.Company.UserAddresses : user.UserAddresses; UpdateAddress(userAddresses, newUserAddress); if (contactsVM != null) { UpdatePhones(user.UserContacts, contactsVM); } UserService.SubmitChanges(); AuthService.CurrentUser = null; }
// GET: api/Contacts //public ContactsVM GetContacts(string sidx, string sord, int page, int rows) //{ // var products = _db.Contacts as IEnumerable<Contact>; // var pageIndex = Convert.ToInt32(page) - 1; // var pageSize = rows; // var totalRecords = products.Count(); // var totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); // products = products.Skip(pageIndex * pageSize).Take(pageSize); // var vm = new ContactsVM // { // Contact = products, // page = page, // records = totalRecords, // total_pages = totalPages // }; // return vm; //} //search public ContactsVM GetContacts([ModelBinder(typeof(JqgridBinder))] JQGridRequest request) { var products = _db.Contacts as IEnumerable <Contact>; var pageIndex = Convert.ToInt32(request.page) - 1; var pageSize = request.rows; var totalRecords = products.Count(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); products = products.Skip(pageIndex * pageSize).Take(pageSize); var vm = new ContactsVM { Contact = products, page = request.page, records = totalRecords, total_pages = totalPages }; return(vm); }
public ContactsPage() { InitializeComponent(); vm = new ContactsVM(); this.DataContext = vm; }
public EditProfileVM() { User = new User(); UserAddress = new UserAddress(); Contacts = new ContactsVM(); }
public NewContactCommand(ContactsVM viewModel) { this.viewModel = viewModel; }
public NewContactCommand(ContactsVM vM) { ViewModel = vM; }
public ContactsPage() { InitializeComponent(); viewModel = Resources["vm"] as ContactsVM; }
private void LoadContacts() { MockDataService service = new MockDataService(); ContactsVM.LoadContacts(service.GetContacts()); }
private void LoadContacts() { ContactsVM.LoadContacts(_dataService.GetContacts()); }
private void LoadFavorites() { var favorites = _dataService.GetContacts().Where(c => c.IsFavorite); ContactsVM.LoadContacts(favorites); }
public void LoadView(ViewType typeView) { switch (typeView) { case ViewType.SignIn: SignInUC signInV = new SignInUC(); SignInVM signInVM = new SignInVM(this); _SignInVM = signInVM; signInV.DataContext = signInVM; this.AccessView.Content = signInV; this.NavView.Content = null; this.MainView.Content = null; break; case ViewType.SignUp: SignUpUC signUpV = new SignUpUC(); SignUpVM signUpVM = new SignUpVM(this); _SignUpVM = signUpVM; signUpV.DataContext = signUpVM; this.AccessView.Content = signUpV; this.NavView.Content = null; this.MainView.Content = null; break; case ViewType.Main: NavigationUC navV = new NavigationUC(); if (_SignInVM.AuthUser != null) { NavigationVM navVM = new NavigationVM(this, _SignInVM.AuthUser); navV.DataContext = navVM; NotesUC notesV = new NotesUC(); NotesVM notesVM = new NotesVM(this, _SignInVM.AuthUser); notesV.DataContext = notesVM; this.NavView.Content = navV; this.MainView.Content = notesV; this.AccessView.Content = null; } else { NavigationVM navVM = new NavigationVM(this, _SignUpVM.AuthUser); navV.DataContext = navVM; NotesUC notesV = new NotesUC(); NotesVM notesVM = new NotesVM(this, _SignUpVM.AuthUser); notesV.DataContext = notesVM; this.NavView.Content = navV; this.MainView.Content = notesV; this.AccessView.Content = null; } break; case ViewType.Notes: if (_SignInVM.AuthUser != null) { NotesUC notesV1 = new NotesUC(); NotesVM notesVM1 = new NotesVM(this, _SignInVM.AuthUser); notesV1.DataContext = notesVM1; this.MainView.Content = notesV1; } else { NotesUC notesV1 = new NotesUC(); NotesVM notesVM1 = new NotesVM(this, _SignUpVM.AuthUser); notesV1.DataContext = notesVM1; this.MainView.Content = notesV1; } break; case ViewType.Contacts: if (_SignInVM.AuthUser != null) { ContactsUC contactsV = new ContactsUC(); ContactsVM contactsVM = new ContactsVM(this, _SignInVM.AuthUser); contactsV.DataContext = contactsVM; this.MainView.Content = contactsV; } else { ContactsUC contactsV = new ContactsUC(); ContactsVM contactsVM = new ContactsVM(this, _SignUpVM.AuthUser); contactsV.DataContext = contactsVM; this.MainView.Content = contactsV; } break; case ViewType.Meetings: if (_SignInVM.AuthUser != null) { Meetings meetingsV = new Meetings(); MeetingsVM meetingsVM = new MeetingsVM(this, _SignInVM.AuthUser); meetingsV.DataContext = meetingsVM; this.MainView.Content = meetingsV; } else { Meetings meetingsV = new Meetings(); MeetingsVM meetingsVM = new MeetingsVM(this, _SignUpVM.AuthUser); meetingsV.DataContext = meetingsVM; this.MainView.Content = meetingsV; } break; } }