Beispiel #1
0
        private async Task <bool> ProspectWasConverted(ProspectFollowup followup)
        {
            Prospect prospect = await _prospectsController.GetByIdAsync(followup.ProspectId);

            if (prospect == null)
            {
                return(true);
            }

            return(prospect.Converted);
        }
        void InitializeData()
        {
            if (null != Intent)
            {
                Bundle extras = Intent.Extras;
                _originalProspect = extras != null?JsonConvert.DeserializeObject <ProspectItem>(extras.GetString(ExistingProspectId)) : null;

                _modifiedProspect = _originalProspect;
                bool exited = AsyncHelper.RunSync(async() => await ExitIfConverted());
                if (exited)
                {
                    return;
                }

                string origin = extras == null ? string.Empty : extras.GetString(ProspectDetailsOrigin);

                if (!string.IsNullOrEmpty(origin))
                {
                    Enum.TryParse(origin, out this._origin);
                }

                Task.Run
                (
                    async() =>
                {
                    {
                        if (_originalProspect.SearchResult.ReminderTime != default(DateTime))
                        {
                            CriteriaBuilder criteriaBuilder = new CriteriaBuilder();

                            ProspectFollowup followup = await new ProspectFollowUpsController()

                                                        .GetSingleByCriteria
                                                        (
                                criteriaBuilder
                                .Add("ProspectId", _originalProspect.SearchResult.Id)
                                .AddDateCriterion("ReminderTime", _originalProspect.SearchResult.ReminderTime)
                                                        );


                            if (followup != null && followup.Id != default(Guid))
                            {
                                await
                                new NotificationsCoreService().SetSingleNotificationViewed(
                                    followup.TableName,
                                    followup.Id.ToString());
                            }
                        }
                    }
                }
                );
            }
        }
Beispiel #3
0
        // [Test] Todo Test completely broken ILog not bound to real implementatio, cannot be resolved
        public async void SaveFollowupAsyncTest()
        {
            const string phone    = "0727650004";
            Prospect     prospect = new Prospect
            {
                DsrPhone = phone
                ,
                LastName = "User"
                ,
                FirstName = "Test"
                ,
                Phone = phone
                ,
                Authority = true
                ,
                Need = false
                ,
                Money = true
            };
            SaveResponse <Prospect> prospectResponse = await prospectsController.SaveAsync(prospect);

            if (prospectResponse.SavedModel.Id == default(Guid))
            {
                throw new Exception("Could not save prospect");
            }


            ProspectFollowup followUp = new ProspectFollowup
            {
                ReminderTime = DateTime.Now.AddSeconds(30)
                ,
                ProspectId = prospect.Id
            };



            await FollowUpsController.SaveAsync
            (
                followUp
            );

            await FollowUpsController.DeleteAsync(followUp);

            await prospectsController.DeleteAsync(prospect);

            Assert.AreNotEqual(followUp.Id, default(Guid));
        }
Beispiel #4
0
        public async Task SetFollowup(Guid prospectId)
        {
            string sql = "SELECT * FROM ProspectFollowup pf WHERE pf.ProspectId='" + prospectId + "'";
            List <ProspectFollowup> followUps = await new QueryRunner().RunQuery <ProspectFollowup>(sql);

            this._followup = (followUps != null && followUps.Count > 0) ? followUps.ElementAt(0) : null;
            if (_followup == null)
            {
                _followup = new ProspectFollowup
                {
                    ReminderTime = DateTime.Now,
                    ProspectId   = prospectId
                };
            }
            SetDate(_followup.ReminderTime);
            SetTime(_followup.ReminderTime);
        }