Ejemplo n.º 1
0
 private void MapInput(IServiceInput serviceInput)
 {
     if (_activeDataList.ActiveDataList != null)
     {
         MapInputToActiveDatalist(serviceInput);
     }
 }
Ejemplo n.º 2
0
        private static async Task <PopulationResult> CallService(IService <IServiceInput, IServiceOutput> focusedService,
                                                                 IServiceInput serviceInput, string expandableKey = null)
        {
            IServiceOutput output = null;

            switch (focusedService.Type)
            {
            case ServiceType.DatabaseCall:
                break;

            case ServiceType.HttpCall:

                if (!(focusedService is HttpService service))
                {
                    throw new Exception($"Invalid HttpService defined for service {focusedService.ServiceName}");
                }

                output = await service.InvokeAsync(serviceInput as HttpServiceOptions);

                if (expandableKey != null)
                {
                    output.KeyPrefix = expandableKey;
                }

                break;
            }

            return(output.PopulationResult);
        }
 private static void MapInput(IServiceInput serviceInput)
 {
     if (DataListSingleton.ActiveDataList != null)
     {
         MapInputToActiveDatalist(serviceInput);
     }
 }
Ejemplo n.º 4
0
 private void MapInputToActiveDatalist(IServiceInput serviceInput)
 {
     if (!serviceInput.IsObject)
     {
         MapToScalar(serviceInput);
     }
     else
     {
         MapToObject(serviceInput);
     }
 }
Ejemplo n.º 5
0
 private void MapToScalar(IServiceInput serviceInput)
 {
     if (_activeDataList.ActiveDataList.ScalarCollection != null)
     {
         var value = serviceInput.Name;
         if (value != null)
         {
             var variable = DataListUtil.AddBracketsToValueIfNotExist(value.Split('(').First().TrimEnd(' '));
             serviceInput.Value = variable;
         }
     }
 }
Ejemplo n.º 6
0
        public IServiceResult Update(IServiceInput input)
        {
            var vm = input as UpdatePatientVM;

            // map patient
            var patient = UpdatePatientVMMapper.MapToPatient(vm);

            // call core method
            var retval = Update(patient);

            // return mapped result
            return(PatientMapper.MapToUpdatePatientVM(retval));
        }
Ejemplo n.º 7
0
        public IServiceResult Search(IServiceInput input)
        {
            var vm = input as SearchForPatientVM;

            // map patient
            var patient = SearchForPatientVMMapper.MapToPatient(vm);

            // call core method
            var retval = Retrieve(patient);

            //return mapped result
            return(PatientMapper.MapToSearchForPatientVM(retval));
        }
Ejemplo n.º 8
0
        public IServiceResult Create(IServiceInput input)
        {
            var vm = input as CreatePatientVM;

            // map patient
            Patient patient = CreatePatientVMMapper.MapToPatient(vm);

            // call core method
            CreatePatientResult retval = Create(patient, vm.DepartmentID);

            // return mapped result
            return(PatientMapper.MapToCreatePatientVM(patient, retval));
        }
Ejemplo n.º 9
0
 private void MapToObject(IServiceInput serviceInput)
 {
     if (_activeDataList.ActiveDataList.ComplexObjectCollection != null)
     {
         var value = serviceInput.Name;
         if (value != null)
         {
             value = value.Split('(').First().TrimEnd(' ');
             var objectName = "@" + value;
             var variable   = DataListUtil.AddBracketsToValueIfNotExist(objectName);
             serviceInput.Value = variable;
         }
     }
 }
Ejemplo n.º 10
0
 private void AddWarewolfAtomResults(List <IDebugItem> results, IServiceInput serviceInput, CommonFunctions.WarewolfEvalResult tmpEntry, DebugItem itemToAdd)
 {
     if (tmpEntry is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult warewolfAtomResult)
     {
         var variableName = serviceInput.Value;
         if (DataListUtil.IsEvaluated(variableName))
         {
             AddDebugItem(new DebugItemWarewolfAtomResult(warewolfAtomResult.Item.ToString(), DataListUtil.AddBracketsToValueIfNotExist(variableName), ""), itemToAdd);
         }
         else
         {
             AddDebugItem(new DebugItemStaticDataParams(warewolfAtomResult.Item.ToString(), ""), itemToAdd);
         }
     }
     results.Add(itemToAdd);
 }
Ejemplo n.º 11
0
 private void AddWarewolfAtomListResults(List <IDebugItem> results, IServiceInput serviceInput, CommonFunctions.WarewolfEvalResult tmpEntry, DebugItem itemToAdd)
 {
     if (tmpEntry is CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult warewolfAtomListResult)
     {
         var variableName = serviceInput.Value;
         if (DataListUtil.IsValueRecordset(variableName))
         {
             AddDebugItem(new DebugItemWarewolfAtomListResult(warewolfAtomListResult, "", "", DataListUtil.AddBracketsToValueIfNotExist(variableName), "", "", "="), itemToAdd);
         }
         else
         {
             var warewolfAtom = warewolfAtomListResult.Item.Last();
             AddDebugItem(new DebugItemWarewolfAtomResult(warewolfAtom.ToString(), DataListUtil.AddBracketsToValueIfNotExist(variableName), ""), itemToAdd);
         }
     }
     results.Add(itemToAdd);
 }
        public IServiceResult Create(IServiceInput input)
        {
            var vm = input as CreateAppointmentVM;

            //var providers = providerService.Search(new ProviderSearchInput());

            //TODO: pass in provider ID


            var apptReasons = GetAppointmentReasons(vm.ProviderID);
            //var apptSlots = GetAppointmentSlots();

            // map patient
            Appointment appointment = CreateAppointmentVMMapper.MapToAppointment(vm);

            // call core method
            CreateAppointmentResult retval = Create(appointment, vm.DepartmentID);

            // return mapped result
            return(AppointmentMapper.MapToCreateAppointmentVM(appointment, retval));
        }
Ejemplo n.º 13
0
 void ViewObjectsResultForParameterInput(IServiceInput input)
 {
     JsonObjectsView?.ShowJsonString(JSONUtils.Format(input.Dev2ReturnType));
 }
Ejemplo n.º 14
0
        void AddInput(int update, IWarewolfListIterator itrCollection, ICollection <IWarewolfIterator> itrs, IServiceInput sai)
        {
            var    val      = sai.Name;
            string toInject = null;

            if (val != null)
            {
                toInject = sai.Value;
            }
            else
            {
                if (!sai.EmptyIsNull)
                {
                    toInject = "";
                }
            }
            var paramIterator = new WarewolfIterator(DataObj.Environment.Eval(toInject, update));

            itrCollection.AddVariableToIterateOn(paramIterator);
            itrs.Add(paramIterator);
        }
Ejemplo n.º 15
0
 public IServiceResult Update(IServiceInput input)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 16
0
        public IServiceResult Search(IServiceInput input)
        {
            JToken providers = GetProviders();

            return(ProviderMapper.MapJTokenToProviderSearchResult(providers));
        }
Ejemplo n.º 17
0
        public static async Task <PopulationResultCollection> CollectData <T>(AnalyticalObject <T> focusedObject,
                                                                              IServiceInput serviceInput)
        {
            if (focusedObject.ServiceName == null)
            {
                throw new Exception("Root analyzer object must have a service defined.");
            }

            if (!FluentOlapConfiguration.ServiceDefinitions.ContainsKey(focusedObject.ServiceName))
            {
                throw new Exception($"Service {focusedObject.ServiceName} not defined.");
            }

            IService <IServiceInput, IServiceOutput> focusedService = FluentOlapConfiguration.ServiceDefinitions[focusedObject.ServiceName];
            PopulationResultCollection results = new PopulationResultCollection();

            PopulationResult rootResult = await CallService(focusedService, serviceInput);

            results.Add(rootResult);

            foreach (var expandable in focusedObject.ExpandableChildren)
            {
                if (expandable.Value.ServiceName == null)
                {
                    throw new Exception("Child analyzer object must have a service defined.");
                }

                if (!FluentOlapConfiguration.ServiceDefinitions.ContainsKey(expandable.Value.ServiceName))
                {
                    throw new Exception($"Service {expandable.Value.ServiceName} not defined.");
                }

                IService <IServiceInput, IServiceOutput> expandableService = FluentOlapConfiguration.ServiceDefinitions[expandable.Value.ServiceName];

                IServiceInput input = null;

                switch (expandableService.Type)
                {
                case ServiceType.HttpCall:
                    HttpService expandableHttpService       = expandableService as HttpService;
                    IDictionary <string, string> parameters = new Dictionary <string, string>();
                    foreach (string innerParam in expandableHttpService.GetRequiredParameters())
                    {
                        JToken parsedRoot = JToken.Parse(rootResult.Raw);
                        parameters.Add(innerParam, parsedRoot[innerParam].Value <string>());
                    }

                    input = new HttpServiceOptions
                    {
                        PrefixKey  = expandable.Value.NodeName,
                        Parameters = parameters
                    };

                    await expandableHttpService.InvokeAsync((HttpServiceOptions)input);

                    break;
                }

                results.Add(await CallService(expandableService, input));
            }

            return(results);
        }
Ejemplo n.º 18
0
 private void ViewJsonObjects(IServiceInput input)
 {
     JsonObjectsView?.ShowJsonString(JSONUtils.Format(JSONUtils.Format(input.Dev2ReturnType)));
 }