public async Task <CoreServiceDevReference.ServiceValidationResult> SendMailMessage(Message message, string emailMessageType)
        {
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var customerEmail = await coreServiceClient.SendMailMessageAsync(message, emailMessageType, "", null, null, null);

            return(customerEmail);
        }
Пример #2
0
        public async Task <IEnumerable <EmailTemplate> > GetEmailTemplateByUserAsync()
        {
            var loggedInUserID = _userService.GetCurrentUserId();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var emailTemplate = await coreServiceClient.GetEmailTemplatesByUserAsync(int.Parse(loggedInUserID));

            return(emailTemplate);
        }
Пример #3
0
        public async Task <bool> SendEmailMessage(Message message, string emailMessageType, int clientAssessmentKey)
        {
            var loggedInUserID = _userService.GetCurrentUserId();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var emailTemplate = await coreServiceClient.GetEmailTemplatesByUserAsync(int.Parse(loggedInUserID));

            return(true);
        }
        private static AssessmentForm get_assessment_form_for_class_id(string desktop_class_id)
        {
            ///TODO: Fix this core service function
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            return(null);

            //var core_accessor = new CoreServiceAccessor();
            // return core_accessor.GetAssessmentFormByDesktopClass(desktop_class_id);
        }
Пример #5
0
        public async Task <CoreServiceDevReference.Client> SaveOrUpdate(CoreServiceDevReference.Client client, CoreServiceDevReference.ClientGroup clientGroup)
        {
            var loggedInUserID   = _userService.GetCurrentUserId();
            var loggedInUserName = _userService.GetCurrentUserName();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientResult = await coreServiceClient.SaveOrUpdateClientAsync(client, int.Parse(loggedInUserID), clientGroup, loggedInUserName);

            return(clientResult);
        }
Пример #6
0
        public async Task <EmailTemplate> SaveOrUpdateEmailTemplateAsync(EmailTemplate emailTemplate)
        {
            var loggedInUserID = _userService.GetCurrentUserId();

            emailTemplate.OrgUserMappingKey = int.Parse(loggedInUserID);
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var result = await coreServiceClient.SaveOrUpdateEmailTemplateAsync(emailTemplate);

            return(result);
        }
        public async Task <ClientAssessment> SaveClientAssessmentDemographics(ClientAssessment clientAssessment)
        {
            var loggedInUserID   = _userService.GetCurrentUserId();
            var loggedInUserName = _userService.GetCurrentUserName();

            clientAssessment.OrgUserMappingKey = int.Parse(loggedInUserID);
            clientAssessment.TestDate          = DateTime.Now;
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientAssessmentResult = await coreServiceClient.SaveClientAssessmentDemographicsAsync(int.Parse(loggedInUserID), clientAssessment, loggedInUserID);     //.SaveOrUpdateClientAsync(client, int.Parse(loggedInUserID), clientGroup, loggedInUserName);

            return(clientAssessmentResult);
        }
Пример #8
0
        public void Execute()
        {
            //string url = _httpContextAccessor.HttpContext.Request.Scheme + _httpContextAccessor.HttpContext.Request.Host + _httpContextAccessor.HttpContext.Request.Path;
            //+ VirtualPathUtility.ToAbsolute(AdminURLHelper.BuildAdminURL(_clientAssessment, _assessmentForm));
            string url = "http://devwww.pariconnect.com/Instruments/CfgAssessment.aspx?arg=" + AdminURLHelper.BuildAdminURL(_clientAssessment, _assessmentForm);
            var    sb  = new StringBuilder();

            sb.AppendLine(_args.Body);

            if (_assessmentForm != null)
            {
                CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
                var assessment = coreServiceClient.GetAssessmentByKeyAsync(_assessmentForm.AssessmentKey).Result;
                if (_args.IncludeProduct)
                {
                    sb.AppendFormat("<p>Assessment: {0}</p>", assessment.Name);
                }
                if (_args.IncludeAssessmentTime &&
                    _assessmentForm.EstimatedTime != null)
                {
                    sb.AppendFormat("<p>Time (minutes): {0}</p>", _assessmentForm.EstimatedTime);
                }
                if (_args.IncludeExpiration &&
                    _args.ExpirationDays != null)
                {
                    sb.AppendFormat("<p>Expiration: {0} days.</p>", _args.ExpirationDays);
                }
                if (_args.IncludeProduct)
                {
                    sb.AppendFormat("<p>Use this link to launch the Assessment: <a href=\"{0}\">Launch {1}</a></p>", url, assessment.Name);
                }
                else
                {
                    sb.AppendFormat("<p>Use this link to launch the Assessment: <a href=\"{0}\">Launch</a></p>", url);
                }
                var message = new Message
                {
                    Body    = sb.ToString(),
                    Format  = Format.Html,
                    Subject = _args.Subject,
                    From    = new Recipient {
                        Address = "*****@*****.**"
                    },                                                         //ApplicationConfigurationHelper.EMailAdminLinkSender ?? "*****@*****.**" },
                    //ReplyTo = new Recipient[] { new Recipient { Address = _args.OrgUserEmailAddress } },
                    To = new[] { new Recipient {
                                     Address = _args.RaterEmail
                                 } }                                            //, _args.RaterEmail } }
                };

                var sentMessage = coreServiceClient.SendMailMessageAsync(message, EmailMessageType.RemoteAdminAssigned.ToString(), _clientAssessment.OrgUserMappingKey.ToString(), _clientAssessment.ClientAssessmentKey, _clientAssessment.OrgUserMappingKey, null);
            }
        }
Пример #9
0
        public async Task <IEnumerable <Models.Report> > GetClientReportsAsync(int clientKey, int clientAssessmentKey)
        {
            var loggedInUserID = _userService.GetCurrentUserId();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientReportsSummary = await coreServiceClient.GetClientReportSummaryAsync(clientKey);

            var reports = clientReportsSummary.Items.Where(c => c.ClientAssessmentKey == clientAssessmentKey).Select(x => new Models.Report
            {
                ReportKey   = x.ReportKey,
                ReportName  = x.ReportFormName,
                CreatedDate = x.CreatedDateTime
            });

            return(reports);
        }
Пример #10
0
        public async Task <Models.Client> GetByKeyAsync(int id)
        {
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientRef = await coreServiceClient.GetClientByKeyAsync(id);

            var client = new Models.Client();

            client.ClientKey    = clientRef.ClientKey;
            client.ClientId     = clientRef.ClientID;
            client.ClientName   = clientRef.FirstName + " " + clientRef.LastName;
            client.DateOfBirth  = (clientRef.DateOfBirth.HasValue) ? clientRef.DateOfBirth.Value.ToShortDateString() : "---";
            client.DateCreated  = clientRef.CreatedDateTime.ToShortDateString();
            client.Gender       = (clientRef.Gender.HasValue) ? clientRef.Gender.Value.ToString() : "---";
            client.PrimaryEmail = clientRef.PrimaryEmail;
            client.GroupName    = "---";

            client.Age = GetAgeFromDOBCalculated(clientRef.DateOfBirth, clientRef.DateOfBirthComputed);
            return(client);
        }
Пример #11
0
        public async Task <IEnumerable <Models.Client> > GetClientsByKeysAsync(int[] keys)
        {
            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientsRef = await coreServiceClient.GetClientByKeysAsync(keys);

            var clients = clientsRef.Select(x => new Models.Client
            {
                ClientKey   = x.ClientKey,
                ClientId    = x.ClientID,
                ClientName  = x.FirstName + " " + x.LastName,
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                DateOfBirth = (x.DateOfBirth.HasValue) ? x.DateOfBirth.Value.ToShortDateString() : "---",
                DateCreated = x.CreatedDateTime.ToShortDateString(),
                Gender      = (x.Gender.HasValue) ? x.Gender.Value.ToString() : "---",
                //GenderId = x.,
                PrimaryEmail = (string.IsNullOrEmpty(x.PrimaryEmail)) ? "---" : x.PrimaryEmail,
                Age          = GetAgeFromDOBCalculated(x.DateOfBirth, x.DateOfBirthComputed)
            });

            return(clients);
        }
Пример #12
0
        public async Task <IEnumerable <Models.Client> > GetClientGroupListAsync()
        {
            var loggedInUserID   = _userService.GetCurrentUserId();
            var loggedInUserName = _userService.GetCurrentUserName();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientListingForUser = await coreServiceClient.GetClientListingForUserAsync(int.Parse(loggedInUserID));

            var clientGroupList = new List <Models.Client>();

            foreach (var clientList in clientListingForUser.Clients)
            {
                var client = new Models.Client();
                client.ClientKey   = clientList.ClientKey;
                client.ClientId    = clientList.ClientID;
                client.ClientName  = clientList.FirstName + " " + clientList.LastName;
                client.DateCreated = clientList.CreatedDateTime.ToShortDateString();
                client.Email       = clientList.PrimaryEmail;
                client.Clinician   = loggedInUserName;
                client.ClinicianId = loggedInUserID;
                client.IsGroup     = false;
                clientGroupList.Add(client);
            }

            foreach (var groupList in clientListingForUser.ClientGroups)
            {
                var client = new Models.Client();
                client.GroupKey    = groupList.ClientGroupKey;
                client.GroupName   = groupList.Name;
                client.DateCreated = groupList.CreatedDateTime.ToShortDateString();

                client.IsGroup = true;
                clientGroupList.Add(client);
            }

            return(clientGroupList);
        }
Пример #13
0
        public async Task <IEnumerable <Models.Client> > GetListAsync()
        {
            var loggedInUserID = _userService.GetCurrentUserId();

            CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
            var clientListingForUser = await coreServiceClient.GetClientListingForUserAsync(int.Parse(loggedInUserID));

            var clinicians = await coreServiceClient.GetClinicianListingsForUserAsync(int.Parse(loggedInUserID));

            //var user = clinicians.Where(x=>x.OrgUserMappingKey == int.Parse(loggedInUserID)).Select(c => c.Name).SingleOrDefault();


            var clientListing = clientListingForUser.Clients
                                .Select(x => new Models.Client
            {
                ClientKey   = x.ClientKey,
                ClientId    = x.ClientID,
                ClientName  = x.FirstName + " " + x.LastName,
                DateCreated = x.CreatedDateTime.ToShortDateString(),
                Email       = x.PrimaryEmail
                ,
                Clinician = _userService.GetCurrentUserName()
                ,
                ClinicianId = loggedInUserID
                ,
                IsUser = true
            }).ToList();

            foreach (var clinicianClientGroup in clientListingForUser.ClientGroups)
            {
                foreach (var clinicianClientGroupClient in clinicianClientGroup.Clients)
                {
                    var client = new Models.Client();
                    client.ClientKey   = clinicianClientGroupClient.ClientKey;
                    client.Clinician   = _userService.GetCurrentUserName();
                    client.ClinicianId = loggedInUserID;
                    client.DateCreated = clinicianClientGroup.CreatedDateTime.ToShortDateString();
                    client.Email       = clinicianClientGroupClient.PrimaryEmail;
                    client.ClientId    = clinicianClientGroupClient.ClientID;
                    client.ClientName  = string.Format("{0} {1}", clinicianClientGroupClient.FirstName, clinicianClientGroupClient.LastName);
                    client.GroupId     = clinicianClientGroup.ClientGroupKey.ToString();
                    client.GroupName   = clinicianClientGroup.Name;
                    client.IsUser      = true;
                    clientListing.Add(client);
                }
            }

            foreach (var clinician in clinicians)
            {
                var clinicianClients = await coreServiceClient.GetClientListingForUserAsync(clinician.OrgUserMappingKey);

                foreach (var clinicianClient in clinicianClients.Clients)
                {
                    var client = new Models.Client();
                    client.ClientKey   = clinicianClient.ClientKey;
                    client.Clinician   = clinician.Name;
                    client.ClinicianId = clinician.OrgUserMappingKey.ToString();
                    client.Email       = clinicianClient.PrimaryEmail;
                    client.DateCreated = clinicianClient.CreatedDateTime.ToShortDateString();
                    client.ClientId    = clinicianClient.ClientID;
                    client.ClientName  = string.Format("{0} {1}", clinicianClient.FirstName, clinicianClient.LastName);
                    clientListing.Add(client);
                }
                foreach (var clinicianClientGroup in clinicianClients.ClientGroups)
                {
                    foreach (var clinicianClientGroupClient in clinicianClientGroup.Clients)
                    {
                        var client = new Models.Client();
                        client.ClientKey   = clinicianClientGroupClient.ClientKey;
                        client.Clinician   = clinician.Name;
                        client.ClinicianId = clinician.OrgUserMappingKey.ToString();
                        client.Email       = clinicianClientGroupClient.PrimaryEmail;
                        client.ClientId    = clinicianClientGroupClient.ClientID;
                        client.DateCreated = clinicianClientGroupClient.CreatedDateTime.ToShortDateString();
                        client.ClientName  = string.Format("{0} {1}", clinicianClientGroupClient.FirstName, clinicianClientGroupClient.LastName);
                        client.GroupId     = clinicianClientGroup.ClientGroupKey.ToString();
                        clientListing.Add(client);
                    }
                }
            }
            return(clientListing);
        }
 private static AssessmentForm GetAssessmentForm(int assessmentFormKey)
 {
     CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient();
     return(coreServiceClient.GetAssessmentFormByKeyAsync(assessmentFormKey).Result);
 }