Exemplo n.º 1
0
        public IEnumerable <AppointmentInfo> GetAppointmentEntitiesFromId(int appointmentId, string ticket,
                                                                          string contextIdentifier, string netserverUrl, Dictionary <string, WishlistElement> infoWishList)
        {
            using (SoDatabaseContext.EnterDatabaseContext(contextIdentifier))
            {
                ConfigFile.WebServices.RemoteBaseURL = netserverUrl;
                using (SoSession.Authenticate(new SoCredentials(ticket)))
                    using (var appAgent = new AppointmentAgent())
                        //using (new AssociateAgent())
                        using (var personAgent = new PersonAgent())
                        {
                            var               appEnts = new List <AppointmentInfo>();
                            AppointmentInfo   appInfo;
                            AppointmentEntity appEntity;
                            do
                            {
                                appEntity = appAgent.GetAppointmentEntity(appointmentId);
                                if (appEntity?.Associate == null)
                                {
                                    continue;
                                }

                                var associatePerson   = personAgent.GetPersonEntity(appEntity.Associate.PersonId);
                                var appointmentPerson = personAgent.GetPersonEntity(appEntity.Person.PersonId);

                                appInfo = new AppointmentInfo
                                {
                                    AppointmentId      = appEntity.AppointmentId,
                                    EmailReceiver      = appointmentPerson.Emails.FirstOrDefault()?.Value,
                                    MessageDescription = appEntity.Description,
                                    Receptionist       = associatePerson.FullName,
                                    RecepTitle         = associatePerson.Title,
                                    SmsPhoneNumber     = appointmentPerson.MobilePhones.FirstOrDefault()?.Value,
                                    CustWantsCallBack  = ResolveVariableInfo(appEntity,
                                                                             infoWishList.FirstOrDefault(k => k.Key == "CustWantsCallBack").Value),
                                    SendSms = ResolveVariableInfo(appointmentPerson,
                                                                  infoWishList.FirstOrDefault(k => k.Key == "SendSms").Value),
                                    CustCallsBack = ResolveVariableInfo(appEntity,
                                                                        infoWishList.FirstOrDefault(k => k.Key == "CustCallsBack").Value),
                                    CustomerHighPriority = ResolveVariableInfo(appEntity,
                                                                               infoWishList.FirstOrDefault(k => k.Key == "CustomerHighPriority").Value),
                                    Customer = ResolveVariableInfo(appEntity,
                                                                   infoWishList.FirstOrDefault(k => k.Key == "Customer").Value),
                                    CustomerContact = ResolveVariableInfo(appEntity,
                                                                          infoWishList.FirstOrDefault(k => k.Key == "CustomerContact").Value),
                                    CustomerContactPhone = ResolveVariableInfo(appEntity,
                                                                               infoWishList.FirstOrDefault(k => k.Key == "CustomerContactPhone").Value),
                                };

                                appEnts.Add(appInfo);
                                appointmentId++;
                                Debug.WriteLine($"AppEntity desc {appInfo.MessageDescription} with ID {appointmentId}");
                            } while (appEntity != null);

                            return(appEnts);
                        }
            }
        }
Exemplo n.º 2
0
        public PersonSelectDialogViewModel()
        {
            this.personList = new ObservableCollection <PersonalInformation>(PersonAgent.GetAllPersons().OrderBy(p => p.Code.Value));

            this.Persons = this.personList.ToReadOnlyReactiveCollection(p => new PersonItemViewModel(p))
                           .AddTo(this.disposables);

            this.OkCommand = new ReactiveCommand()
                             .WithSubscribe(() => this.onOk())
                             .AddTo(this.disposables);
        }
Exemplo n.º 3
0
        public void ServiceAgent_TestF()
        {
            Console.WriteLine($"Start: {DateTime.Now.ToString("HH:mm:ss.ffffff")} [{System.Threading.Thread.CurrentThread.ManagedThreadId}]");
            var m = TestSetUp.CreateMock <IPersonServiceAgent>();

            m.Setup(x => x.GetAsync(It.IsAny <Guid>(), null)).ReturnsWebApiAgentResultAsync(new Person {
                FirstName = "F"
            });

            System.Threading.Thread.Sleep(100);
            Assert.AreSame(m.Object, Factory.Create <IPersonServiceAgent>());

            var v = new PersonAgent().GetAsync(1.ToGuid()).Result.Value;

            Console.WriteLine($"Stopping: {DateTime.Now.ToString("HH:mm:ss.ffffff")} [{System.Threading.Thread.CurrentThread.ManagedThreadId}]");
            Assert.AreEqual("F", v.FirstName);
        }
 public override void Initialize(System.Xml.XmlNode config, string id)
 {
     foreach (System.Xml.XmlNode item in config.ChildNodes)
     {
         if (item.Name == PERSON_DATA_SOURCE)
         {
             PersonDataSourceName = item.InnerText;
         }
         elseif(item.Name == PERSON_UDF_PROG_ID)
         UDFieldProgId = item.InnerText;
         elseif(item.Name == PERSON_UDF_LIST_ID)
         UDListId = item.InnerText;
     }
     base.Initialize(config, id);
     _personAgent = new PersonAgent();
     this._dataCarriers.Add(PERSONAL_COLOR, null);
     this._dataCarriers.Add(COLOR_LIST, null);
     this._dataCarriers.Add(PERSON_CARRIER, null);
 }
        private async Task <PersonEntity> GetPersonEntityAsync(int personId, Tenant tenant)
        {
            // maybe the tenant canceled their subscription...
            // make sure the tenant is running (not off-line or in backup or maintenance mode)

            var tenantStatus = GetTenantStatus(tenant);

            if (tenantStatus.IsRunning)
            {
                var config = new WebApiOptions(tenant.WebApiUrl);
                config.Authorization = GetAccessTokenAuthorization();


                var personAgent = new PersonAgent(config);
                return(await personAgent.GetPersonEntityAsync(personId));
            }

            return(null);
        }