Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 4
0
 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));
        }
Exemplo n.º 6
0
        public IActionResult _Contacts()
        {
            var contacts = ServiceFactory.DriverManagement.GetDriverContacts();

            var model = new ContactsVM
            {
                Contacts = contacts.Data,
            };

            return(PartialView(model));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取联系人
        /// </summary>
        private void LoadContacts()
        {
            var contacts = _dataService.GetContacts();

            if (contacts != null)
            {
                // 拿到转换集合类型后的联系人
                ContactsVM.LoadContacts(_dataService.GetContacts());
                IsHidden = true;
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 10
0
 public ContactsPage()
 {
     InitializeComponent();
     vm = new ContactsVM();
     this.DataContext = vm;
 }
Exemplo n.º 11
0
 public EditProfileVM()
 {
     User        = new User();
     UserAddress = new UserAddress();
     Contacts    = new ContactsVM();
 }
Exemplo n.º 12
0
 public NewContactCommand(ContactsVM viewModel)
 {
     this.viewModel = viewModel;
 }
Exemplo n.º 13
0
 public NewContactCommand(ContactsVM vM)
 {
     ViewModel = vM;
 }
Exemplo n.º 14
0
        public ContactsPage()
        {
            InitializeComponent();

            viewModel = Resources["vm"] as ContactsVM;
        }
Exemplo n.º 15
0
        private void LoadContacts()
        {
            MockDataService service = new MockDataService();

            ContactsVM.LoadContacts(service.GetContacts());
        }
Exemplo n.º 16
0
 private void LoadContacts()
 {
     ContactsVM.LoadContacts(_dataService.GetContacts());
 }
Exemplo n.º 17
0
        private void LoadFavorites()
        {
            var favorites = _dataService.GetContacts().Where(c => c.IsFavorite);

            ContactsVM.LoadContacts(favorites);
        }
Exemplo n.º 18
0
        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;
            }
        }