Exemplo n.º 1
0
        public CompletedApplicationScreening GenerateCompletedBusinessScreening(string incidentId)
        {
            string[] expand = { "customerid_account" };
            string[] select = { "customerid_account", "incidentid", "spice_applicationstatus" };
            MicrosoftDynamicsCRMincident incident = _dynamicsClient.Incidents.GetByKey(incidentId, expand: expand, select: select);

            SpiceApplicationStatus application = (SpiceApplicationStatus)incident.SpiceApplicationstatus;


            CompletedApplicationScreening screening = new CompletedApplicationScreening()
            {
                RecordIdentifier = incident.CustomeridAccount.SpiceLcrbjobid,
                Result           = SpiceApplicationStatusMapper.MapToCarlaApplicationResult((SpiceApplicationStatus)incident.SpiceApplicationstatus).ToString(),
                Associates       = new List <Associate>()
            };

            string filter = $"_parentcaseid_value eq {incident.Incidentid}";

            string[] associateExpand       = { "customerid_contact" };
            string[] associateSelect       = { "customerid_contact", "incidentid" };
            IncidentsGetResponseModel resp = _dynamicsClient.Incidents.Get(filter: filter, expand: associateExpand, select: associateSelect);

            foreach (var associate in resp.Value)
            {
                screening.Associates.Add(new Associate()
                {
                    SpdJobId   = associate.CustomeridContact.Contactid,
                    LastName   = associate.CustomeridContact.Lastname,
                    FirstName  = associate.CustomeridContact.Firstname,
                    MiddleName = associate.CustomeridContact.Middlename
                });
            }

            return(screening);
        }
Exemplo n.º 2
0
        public CompletedWorkerScreening GenerateCompletedWorkerScreening(string incidentId)
        {
            string[] expand = { "customerid_contact" };
            string[] select = { "customerid_contact", "incidentid", "spice_applicationstatus" };
            MicrosoftDynamicsCRMincident incident = _dynamicsClient.Incidents.GetByKey(incidentId, expand: expand, select: select);

            CompletedWorkerScreening screening = new CompletedWorkerScreening()
            {
                RecordIdentifier = incident.CustomeridContact.Externaluseridentifier,
                ScreeningResult  = SpiceApplicationStatusMapper.MapToCarlaWorkerResult((SpiceApplicationStatus)incident.SpiceApplicationstatus).ToString(),
                Worker           = new Lclb.Cllb.Interfaces.Models.Worker()
                {
                    FirstName  = incident.CustomeridContact.Firstname,
                    MiddleName = incident.CustomeridContact.Middlename,
                    LastName   = incident.CustomeridContact.Lastname
                }
            };

            return(screening);
        }