private EducationItemType GetItemType(string dsioEdItemType)
        {
            EducationItemType returnVal = EducationItemType.Unknown;

            switch (dsioEdItemType)
            {
            case "DISCUSSION TOPIC":
                returnVal = EducationItemType.DiscussionTopic;
                break;

            case "LINK TO MATERIAL":
                returnVal = EducationItemType.LinkToMaterial;
                break;

            case "PRINTED MATERIAL":
                returnVal = EducationItemType.PrintedMaterial;
                break;

            case "ENROLLMENT":
                returnVal = EducationItemType.Enrollment;
                break;

            case "OTHER":
                returnVal = EducationItemType.Other;
                break;
            }

            return(returnVal);
        }
        private string GetDsioItemType(EducationItemType edItemType)
        {
            //string[] edItemTypes = new string[] { "", "DISCUSSION TOPIC", "LINK TO MATERIAL", "PRINTED MATERIAL", "ENROLLMENT", "OTHER" };
            string[] edItemTypes = new string[] { "", "D", "L", "P", "E", "O" };

            return(edItemTypes[(int)edItemType]);
        }
        public EducationItemsResult GetEducationItems(string ien, string category, EducationItemType itemType, int page, int pageSize, EducationItemSort sort)
        {
            EducationItemsResult result = new EducationItemsResult();

            if (this.broker != null)
            {
                DsioGetEducationItemsCommand command = new DsioGetEducationItemsCommand(this.broker);

                string dsioItemType = GetDsioItemType(itemType);

                command.AddCommandArguments(ien, category, dsioItemType, page, pageSize, (int)sort);

                RpcResponse response = command.Execute();

                result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage);

                if (result.Success)
                {
                    if (command.EducationItems != null)
                    {
                        if (command.EducationItems.Count > 0)
                        {
                            foreach (DsioEducationItem dsioItem in command.EducationItems)
                            {
                                EducationItem item = GetItem(dsioItem);

                                result.EducationItems.Add(item);
                            }

                            result.TotalResults = command.TotalResults;
                        }
                    }
                }
            }

            return(result);
        }
        public PatientEducationItemsResult GetPatientItems(string patientDfn, string ien, DateTime fromDate, DateTime toDate, EducationItemType itemType, int page, int itemsPerPage)
        {
            PatientEducationItemsResult result = new PatientEducationItemsResult();

            if (this.broker != null)
            {
                DsioGetPatientEducationCommand command = new DsioGetPatientEducationCommand(this.broker);

                string dsioItemType = GetDsioItemType(itemType);

                string fmFromDate = Util.GetFileManDate(fromDate);
                string fmToDate   = Util.GetFileManDate(toDate);

                command.AddCommandArguments(patientDfn, ien, fmFromDate, fmToDate, dsioItemType, page, itemsPerPage);

                RpcResponse response = command.Execute();

                result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage);

                if (result.Success)
                {
                    if (command.Items != null)
                    {
                        if (command.Items.Count > 0)
                        {
                            foreach (DsioPatientEducationItem dsioItem in command.Items)
                            {
                                EducationItem item = GetItem(dsioItem);

                                PatientEducationItem patItem = new PatientEducationItem(item);

                                patItem.CompletedOn = Util.GetDateTime(dsioItem.CompletedOn);
                                patItem.CompletedBy = dsioItem.CompletedBy;

                                result.Items.Add(patItem);
                            }

                            result.TotalResults = command.TotalResults;
                        }
                    }
                }
            }

            return(result);
        }