Esempio n. 1
0
 public async Task <List <FrequentlyAskedQuestions> > getGeneralFAQS(SoapEntityRepository entityRepository)
 {
     try
     {
         List <FrequentlyAskedQuestions> FAQS = new List <FrequentlyAskedQuestions>();
         QueryExpression query = new QueryExpression("mzk_faqconfiguration");
         query.Criteria.AddCondition("mzk_servicespecific", ConditionOperator.Equal, false);
         query.ColumnSet = new ColumnSet("mzk_faqconfigurationid", "mzk_name", "entityimage");
         EntityCollection entitycollection = entityRepository.GetEntityCollection(query);
         foreach (Entity entity in entitycollection.Entities)
         {
             FrequentlyAskedQuestions FAQ = new FrequentlyAskedQuestions();
             if (entity.Attributes.Contains("mzk_faqconfigurationid"))
             {
                 FAQ.FAQId = entity["mzk_faqconfigurationid"].ToString();
             }
             if (entity.Attributes.Contains("mzk_name"))
             {
                 FAQ.name = entity["mzk_name"].ToString();
             }
             if (entity.Attributes.Contains("entityimage"))
             {
                 byte[] imageInBytes = (entity.Attributes["entityimage"]) as byte[];
                 FAQ.image = Convert.ToBase64String(imageInBytes);
             }
             FAQS.Add(FAQ);
         }
         return(FAQS);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        public async Task <List <FrequentlyAskedQuestions> > getContractSpecificFAQS(string patientId, SoapEntityRepository entityRepository)
        {
            try
            {
                if (!string.IsNullOrEmpty(patientId))
                {
                    List <FrequentlyAskedQuestions> FAQS = new List <FrequentlyAskedQuestions>();
                    QueryExpression query = new QueryExpression("mzk_faqconfiguration");
                    query.Criteria.AddCondition("mzk_servicespecific", ConditionOperator.Equal, true);
                    query.ColumnSet = new ColumnSet("mzk_faqconfigurationid", "mzk_name", "entityimage");
                    LinkEntity FAQContract = new LinkEntity("mzk_faqconfiguration", "mzk_faqconfigurationcontract", "mzk_faqconfigurationid", "mzk_faqconfiguration", JoinOperator.LeftOuter)
                    {
                    };
                    LinkEntity FAQContractManagement = new LinkEntity("mzk_faqconfigurationcontract", "mzk_contractmanagement", "mzk_contract", "mzk_contractmanagementid", JoinOperator.LeftOuter)
                    {
                    };
                    LinkEntity ContractReferral = new LinkEntity("mzk_contractmanagement", "opportunity", "mzk_contractmanagementid", "mzk_contract", JoinOperator.Inner)
                    {
                        LinkCriteria =
                        {
                            Conditions     =
                            {
                                new ConditionExpression("mzk_status", ConditionOperator.Equal, 275380001), //Active
                                new ConditionExpression("mzk_status", ConditionOperator.Equal, 275380004)  //Reviewed
                            },
                            FilterOperator = LogicalOperator.Or
                        },
                    };
                    LinkEntity ReferralPatient = new LinkEntity("opportunity", "contact", "parentcontactid", "contactid", JoinOperator.Inner)
                    {
                        LinkCriteria =
                        {
                            Conditions =
                            {
                                new ConditionExpression("contactid", ConditionOperator.Equal, new Guid(patientId)),
                            }
                        },
                    };

                    FAQContract.LinkEntities.Add(FAQContractManagement);
                    FAQContractManagement.LinkEntities.Add(ContractReferral);
                    ContractReferral.LinkEntities.Add(ReferralPatient);
                    query.LinkEntities.Add(FAQContract);

                    EntityCollection entitycollection = entityRepository.GetEntityCollection(query);
                    var groupedFAQS = entitycollection.Entities.GroupBy(item => (item.GetAttributeValue <Guid>("mzk_faqconfigurationid")));
                    foreach (var faqs in groupedFAQS)
                    {
                        foreach (Entity entity in faqs)
                        {
                            FrequentlyAskedQuestions FAQ = new FrequentlyAskedQuestions();
                            if (entity.Attributes.Contains("mzk_faqconfigurationid"))
                            {
                                FAQ.FAQId = entity["mzk_faqconfigurationid"].ToString();
                            }
                            if (entity.Attributes.Contains("mzk_name"))
                            {
                                FAQ.name = entity["mzk_name"].ToString();
                            }
                            if (entity.Attributes.Contains("entityimage"))
                            {
                                byte[] imageInBytes = (entity.Attributes["entityimage"]) as byte[];
                                FAQ.image = Convert.ToBase64String(imageInBytes);
                            }
                            FAQS.Add(FAQ);
                            break;
                        }
                    }
                    return(FAQS);
                }
                else
                {
                    throw new ValidationException("Patient Id missing");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }