コード例 #1
0
        public static VJChartModel GetVJChartListBS(VJChartInput input)
        {
            VJChartModel response = new VJChartModel();

            input.lstAreaId    = input.AreaId.Split(',').ToList();
            input.lstCountryId = input.CountryId.Split(',').ToList();
            input.lstProductId = input.ProductId.Split(',').ToList();

            response = ChartListDSForPJ.GetVJChartListDS(input);
            return(response);
        }
コード例 #2
0
        public static VJChartModel GetVJChartListDS(VJChartInput input)
        {
            VJChartModel response = new VJChartModel();
            string       countryName = "";
            string       productName = "";
            int          productID, countryID = 0;

            using (PJEntities entity = new PJEntities())
            {
                var countryData                   = from r in entity.Country_Master select r;
                var productData                   = from r in entity.Brand_Master select r;
                var patientJourneyData            = from r in entity.Patient_Journey select r;
                var patientJourneyStagesData      = from r in entity.Patient_Journey_Stages.OrderBy(x => x.Stage_Display_Order) select r;
                var patientJourneyTransactionData = from r in entity.Patient_Journey_Transactions select r;

                List <PatientJourneyData> patientJourneyDataList = new List <PatientJourneyData>();
                List <SelectedProduct>    FproductListWithData   = new List <SelectedProduct>();

                for (int k = 0; k < input.lstProductId.Count; k++)
                {
                    SelectedProduct selectedProduct = new BusinessModel.SelectedProduct();
                    int             productIDs      = Convert.ToInt32(input.lstProductId[k]);

                    List <SelectedCountry> FcountryListWithData = new List <SelectedCountry>();

                    for (int i = 0; i < input.lstCountryId.Count; i++)
                    {
                        SelectedCountry selectedCountry = new BusinessModel.SelectedCountry();
                        int             countryIds      = Convert.ToInt32(input.lstCountryId[i]);

                        int patientJourneyId = 0;

                        patientJourneyId = patientJourneyData.Where(x => x.Brand_Master_Id == productIDs && x.Country_Master_Id == countryIds && x.Year == input.Year && x.Status_Master_Id == 3)
                                           .Select(x => x.Patient_Journey_Id).FirstOrDefault();

                        if (patientJourneyId == 0)
                        {
                            patientJourneyId = patientJourneyData.Where(x => x.Brand_Master_Id == productIDs && x.Country_Master_Id == countryIds && x.Year == input.Year && x.Status_Master_Id == 7)
                                               .Select(x => x.Patient_Journey_Id).FirstOrDefault();
                        }

                        var stagesId = patientJourneyStagesData.Where(x => x.Patient_Journey_Id == patientJourneyId).Select(x => x.Patient_Journey_Stages_Id).ToList();

                        List <PJTransactionList> PJTransactionListData = new List <PJTransactionList>();

                        for (int j = 0; j < stagesId.Count; j++)
                        {
                            int stagesID      = Convert.ToInt32(stagesId[j]);
                            var transactionId = patientJourneyTransactionData.Where(x => x.Patient_Journey_Id == patientJourneyId &&
                                                                                    x.Patient_Journey_Stages_Id == stagesID).Select(x => x.Patient_Journey_Transactions_Id).ToList();

                            for (int n = 0; n < transactionId.Count; n++)
                            {
                                int TransactionId = Convert.ToInt32(transactionId[n]);

                                response.pjTransactionList = (from kd in patientJourneyTransactionData
                                                              where kd.Patient_Journey_Id == patientJourneyId
                                                              where kd.Patient_Journey_Stages_Id == stagesID
                                                              where kd.Patient_Journey_Transactions_Id == TransactionId
                                                              join kq in patientJourneyStagesData on kd.Patient_Journey_Stages_Id equals kq.Patient_Journey_Stages_Id
                                                              select new PJTransactionList()
                                {
                                    PatientJourneyId = patientJourneyId,
                                    PatientJourneyStagesId = stagesID,
                                    PatientJourneyTransactionId = TransactionId,
                                    Transaction_Title = kd.Transaction_Title,
                                    Stage_Title = kq.Stage_Title,
                                    Patient_Rating = kd.Patient_Rating,
                                    HCP_Rating = kd.HCP_Rating,
                                    Payer_Rating = kd.Payer_Rating
                                                   //,
                                                   //Feasibility_Rating = kd.Feasibility_Rating,
                                                   //Viability_Rating = kd.Viability_Rating
                                }).ToList();

                                PJTransactionListData.AddRange(response.pjTransactionList);
                            }
                        }

                        countryName = countryData.FirstOrDefault(ci => ci.Country_Master_Id == countryIds).Country_Name;

                        selectedCountry.CountryName       = countryName;
                        selectedCountry.CountryID         = countryIds;
                        selectedCountry.pjTransactionList = PJTransactionListData;
                        FcountryListWithData.Add(selectedCountry);
                    }

                    productName = productData.FirstOrDefault(ci => ci.Brand_Master_Id == productIDs).Brand_Name;
                    selectedProduct.ProductName         = productName;
                    selectedProduct.ProductId           = productIDs;
                    selectedProduct.selectedCountryList = FcountryListWithData;
                    FproductListWithData.Add(selectedProduct);
                }

                List <CountryColourVJ> countryColourLists = new List <CountryColourVJ>();
                string[] coloursArry = new string[] { "#84BD00", "#6699C9", "#F49D45", "#996699", "#F2594B" };
                for (int i = 0; i < input.lstCountryId.Count; i++)
                {
                    CountryColourVJ countryColour = new CountryColourVJ();
                    countryColour.Colours = coloursArry[i];
                    int countryIDColour = Convert.ToInt32(input.lstCountryId[i]);
                    countryColour.CountryIDs = countryIDColour;
                    countryName = countryData.FirstOrDefault(ci => ci.Country_Master_Id == countryIDColour).Country_Name;
                    countryColour.CountryNames = countryName;
                    countryColourLists.Add(countryColour);
                }


                response.countryColourLists  = countryColourLists;
                response.SelectedProductList = FproductListWithData;
            }
            return(response);
        }