Пример #1
0
        public JsonResult SendContact([FromBody] AppContact _contact)
        {
            var contact = _contact;

            contact.UserName = User.Identity.Name;
            _context.Add(contact);
            _context.SaveChanges();
            return(Json(new { contact }));
        }
        private async Task <Contact> GetAggregateContactFromAppContactAsync(AppContact appContact)
        {
            var contactToPinUnpin = await MyContactStoreService.Current.ContactList.GetContactFromRemoteIdAsync(appContact.ContactId);

            // if we have got hold of the raw contact, then grab the parent aggregate contact instead
            if (contactToPinUnpin?.IsAggregate == false && !string.IsNullOrEmpty(contactToPinUnpin?.AggregateId))
            {
                contactToPinUnpin = await MyContactStoreService.Current.ContactStore.GetContactAsync(contactToPinUnpin.AggregateId);
            }

            return(contactToPinUnpin);
        }
        public bool IsCustomerHasContact(string companyid, string customerid)
        {
            AppContact contact = dl.GetContact("", companyid, customerid);

            if (contact != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        protected async override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            if (!_isContactsInitialized)
            {
                await InitializeAllAsync();
            }

            bool isPeopleShare = false;

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                // Make sure the current OS version includes the My People feature before
                // accessing the ShareOperation.Contacts property
                isPeopleShare = (args.ShareOperation.Contacts.Count > 0);
            }

            if (isPeopleShare)
            {
                // Show share UI for MyPeople contact(s)

                Frame      rootFrame          = CreateRootFrame();
                AppContact selectedAppContact = (from c in App.AppContacts where c.ContactId == "1" select c).FirstOrDefault();
                rootFrame.Navigate(typeof(AppContactPanelShell));

                rootFrame.Navigate(typeof(ChatPage), selectedAppContact);

                if (args.ShareOperation.Data.Contains(StandardDataFormats.WebLink))
                {
                    try
                    {
                        Uri sharedWebLink = await args.ShareOperation.Data.GetWebLinkAsync();

                        ((ChatPage)rootFrame.Content).AddChat(args.ShareOperation.Data.Properties.Title);
                        ((ChatPage)rootFrame.Content).AddChat(sharedWebLink.AbsoluteUri);
                    }
                    catch
                    {
                    }
                }


                //AppContact.ChatHistory.Add(ChatTextBox.Text);
            }
            else
            {
                // Show standard share UI for unpinned contacts
            }
        }
Пример #5
0
        public async void NavigateToPage(ContactPanelActivatedEventArgs args)
        {
            args.ContactPanel.LaunchFullAppRequested += ContactPanel_LaunchFullAppRequested;

            var lightContact = args.Contact;

            _appContactId = await MyContactStoreService.Current.GetRemoteIdForContactIdAsync(lightContact.Id);

            AppContact appContact = null;

            if (_appContactId != null)
            {
                appContact = (from a in App.AppContacts where a.ContactId == _appContactId select a).FirstOrDefault();
            }

            AppFrame.Navigate(typeof(ChatPage), appContact);
        }
        private async void ContactGrid_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
        {
            _pinnedContactManager = PinnedContactManager.GetDefault();

            if (PinnedContactManager.IsSupported() && _pinnedContactManager.IsPinSurfaceSupported(PinnedContactSurface.Taskbar))
            {
                Grid       grid       = sender as Grid;
                AppContact appContact = grid.DataContext as AppContact;

                if (appContact != null)
                {
                    MenuFlyout menuFlyout = new MenuFlyout();
                    menuFlyout.Closed += MenuFlyout_Closed;

                    string menuText = $"{Constants.CONTACT_CONTEXT_MENU_TEXT_PIN} {appContact.FirstName}";
                    string menuTag  = Constants.CONTACT_CONTEXT_MENU_TAG_PIN;

                    Contact contactToPinUnpin = await GetAggregateContactFromAppContactAsync(appContact);

                    if (_pinnedContactManager.IsContactPinned(contactToPinUnpin, PinnedContactSurface.Taskbar))
                    {
                        menuText = $"{Constants.CONTACT_CONTEXT_MENU_TEXT_UNPIN} {appContact.FirstName}";
                        menuTag  = Constants.CONTACT_CONTEXT_MENU_TAG_UNPIN;
                    }

                    var menuFlyoutItem = new MenuFlyoutItem
                    {
                        Text = menuText,
                        Tag  = menuTag
                    };

                    menuFlyoutItem.Click += MenuFlyoutItem_Click;
                    menuFlyout.Items.Add(menuFlyoutItem);

                    grid.ContextFlyout = menuFlyout;

                    Point point;
                    bool  succeeded = args.TryGetPosition(grid, out point);

                    if (succeeded)
                    {
                        menuFlyout.ShowAt(grid, point);
                    }
                }
            }
        }
        public string GetContact(string contactid, string objectid)
        {
            AppContact contact = dataLayer.GetContact(contactid, Session["companyid"].ToString(), objectid);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(contact));
        }
Пример #8
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     AppContact = e.Parameter as AppContact;
 }
Пример #9
0
 public AppContactEventArgs(AppContact appContact)
 {
     AppContact = appContact;
 }
Пример #10
0
        public AppContact GetContact(string contactid, string companyid, string objectid)
        {
            AppContact contact = dl.GetContact(contactid, companyid, objectid);

            return(contact);
        }