private async void Initialize()
        {
            try
            {
                GetEmailResponse response = await Account.PostAuthenticatedAsync <GetEmailRequest, GetEmailResponse>(
                    Website.URL + "getemailmodern",
                    new GetEmailRequest());

                if (response != null)
                {
                    if (response.Error != null)
                    {
                        SetError(response.Error);
                    }

                    else
                    {
                        Email             = response.Email;
                        IsRetrievingEmail = false;
                    }

                    return;
                }
            }

            catch
            {
            }

            SetError(PowerPlannerResources.GetString("Settings_ChangeEmailPage_Errors_FailedGrabEmail"));
        }
Пример #2
0
        public ActionResult <GetAccountModel> GetAccount([FromRoute] string loginName)
        {
            AccountReadModel account  = _query.Query <AccountReadModel, string>(loginName);
            GetEmailResponse response = _query.Query <GetEmailResponse, string>(account.LoginName);

            return(Json(new GetAccountModel(account.LoginName, response.Email)));
        }
Пример #3
0
        private EmailView GetEmailView(string id)
        {
            GetRequest request = new GetRequest();

            request.ID = Guid.Parse(id);

            GetEmailResponse response = this._emailService.GetEmail(request);

            return(response.EmailView);
        }
Пример #4
0
        public JsonResult GetEmails()
        {
            int userId                = this.Identity.ToUserID();
            int accountId             = this.Identity.ToAccountID();
            GetEmailResponse response = userService.GetEmails(new GetEmailRequest()
            {
                userId    = userId,
                accountId = accountId
            });

            return(Json(new
            {
                success = true,
                response = response.Emails.ToArray()
            }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public GetEmailResponse GetEmail(GetRequest request)
        {
            GetEmailResponse response = new GetEmailResponse();

            try
            {
                Email     email     = new Email();
                EmailView emailView = email.ConvertToEmailView();

                email = _emailRepository.FindBy(request.ID);
                if (email != null)
                {
                    emailView = email.ConvertToEmailView();
                }

                response.EmailView = emailView;
            }
            catch (Exception ex)
            {
            }

            return(response);
        }
Пример #6
0
        /// <summary>
        /// Gets bp ID and acct status while validating acct ID and fullName.
        /// </summary>
        /// <param name="bpID">The business partner id to sync information for in the Cassandra database.</param>
        /// <returns></returns>
        public async Task <bool> SyncCustomerByBpId(long bpID)
        {
            // Get customer for this bp
            CustomerEntity customerEntity = await _customerRepository.GetCustomerByBusinessPartnerId(bpID);

            try
            {
                // getting the latest customer and customer contact detail information from SAP
                McfResponse <BusinessPartnerContactInfoResponse> businessPartnerContactInfo = _mcfClient.GetBusinessPartnerContactInfo(String.Empty, bpID.ToString());
                McfResponse <GetAccountAddressesResponse>        addressResponse            = _mcfClient.GetStandardMailingAddress(String.Empty, bpID);
                McfAddressinfo mcfAddressInfo = addressResponse.Result.AddressInfo;

                // populating object with customer and customer contact information to send to function to update Cassandra data
                CreateBusinesspartnerRequest newCassandraRecordData = new CreateBusinesspartnerRequest();
                newCassandraRecordData.Address     = new AddressDefinedTypeRequest();
                newCassandraRecordData.Phone       = new Phone();
                newCassandraRecordData.MobilePhone = new Phone();
                // populating name and address information
                if (mcfAddressInfo.POBox.Length > 0)
                {
                    newCassandraRecordData.Address.AddressLine1 = $"P. O. Box {mcfAddressInfo.POBox}";
                }
                else
                {
                    newCassandraRecordData.Address.AddressLine1 = $"{mcfAddressInfo.HouseNo}  {mcfAddressInfo.Street}";
                }
                newCassandraRecordData.FirstName = businessPartnerContactInfo.Result.FirstName;
                newCassandraRecordData.LastName  = businessPartnerContactInfo.Result.LastName;
                // populating phone contact information
                GetPhoneResponse phone = new GetPhoneResponse();
                if (businessPartnerContactInfo.Result.AccountAddressIndependentPhones.Results.Count() > 0)
                {
                    phone = businessPartnerContactInfo.Result.AccountAddressIndependentPhones.Results.Last();
                    newCassandraRecordData.Phone.Number    = phone.PhoneNo;
                    newCassandraRecordData.Phone.Type      = PhoneType.Work;
                    newCassandraRecordData.Phone.Extension = phone.Extension;
                }
                if (businessPartnerContactInfo.Result.AccountAddressIndependentMobilePhones.Results.Count() > 0)
                {
                    phone = businessPartnerContactInfo.Result.AccountAddressIndependentMobilePhones.Results.Last();
                    newCassandraRecordData.MobilePhone.Number    = phone.PhoneNo;
                    newCassandraRecordData.MobilePhone.Type      = PhoneType.Cell;
                    newCassandraRecordData.MobilePhone.Extension = phone.Extension;
                }
                // populating email information
                if (businessPartnerContactInfo.Result.AccountAddressIndependentEmails.Results.Count() > 0)
                {
                    GetEmailResponse email = businessPartnerContactInfo.Result.AccountAddressIndependentEmails.Results.Last();
                    newCassandraRecordData.Email = email.Email;
                }
                newCassandraRecordData.Address.City       = mcfAddressInfo.City;
                newCassandraRecordData.Address.Country    = mcfAddressInfo.CountryID;
                newCassandraRecordData.Address.PostalCode = mcfAddressInfo.PostalCode;
                // updating or inserting cassandra record with new data from SAP
                UpdateCustomerDetailsInCassandra(newCassandraRecordData, bpID);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }