Beispiel #1
0
    public static string PopulateRowEOM(string body)
    {
        for (int x = 0; x <= Data.ExplainListOtherMarketingList.GetUpperBound(0); x++)
        {
            Data.CountriesList ELOM = new Data.CountriesList();
            ELOM.id       = Data.ExplainListOtherMarketingList[x, 0];
            ELOM.Title    = Data.ExplainListOtherMarketingList[x, 1];
            ELOM.Country1 = null;
            ELOM.Country2 = null;
            ELOM.Country3 = null;
            explainOtherMarketingList.Add(ELOM);
        }


        if (entryForm != null)
        {
            string[] ELOMG = entryForm.ExplainListOtherMarketing.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            List <Data.CountriesList> explainOtherMarketingListTemp = new List <Data.CountriesList>();

            if (ELOMG.Count() != 0)
            {
                for (int i = 0; i < ELOMG.Length; i++)
                {
                    string[] Datas = ELOMG[i].Split(new string[] { Delimiter[1] }, System.StringSplitOptions.RemoveEmptyEntries);

                    string[] count1 = Datas[0].Split(':');
                    string[] count2 = Datas[1].Split(':');
                    string[] count3 = Datas[2].Split(':');

                    if (count1[0] == "000")
                    {
                        // body = body.Replace("###MCCountryA###", count1[1]);
                        // body = body.Replace("###MCCountryB###", count2[1]);
                        // body = body.Replace("###MCCountryC###", count3[1]);
                    }
                    else if (count1[0] == "998")
                    {
                        body = body.Replace("###OtherMCA###", count1[1]);
                        body = body.Replace("###OtherMCB###", (count2[1] == "True") ? check() : "");
                        body = body.Replace("###OtherMCC###", (count3[1] == "True") ? check() : "");
                        if (Datas[3].Split(':')[0] == "999")
                        {
                            body = body.Replace("###OtherMCD###", (Datas[3].Split(':')[1] == "True") ? check() : "");
                        }
                    }
                    else
                    {
                        try
                        {
                            Data.CountriesList ELOM = explainOtherMarketingList.FirstOrDefault(x => x.id == count1[0]);

                            ELOM.Country1 = Datas[0].Split(':')[1];
                            ELOM.Country2 = Datas[1].Split(':')[1];
                            ELOM.Country3 = Datas[2].Split(':')[1];

                            body = body.Replace("###MCTitle" + count1[0] + "###", ELOM.Title);
                            body = body.Replace("###MCDataA" + count1[0] + "###", (ELOM.Country1 == "True") ? check() : "");
                            body = body.Replace("###MCDataB" + count1[0] + "###", (ELOM.Country2 == "True") ? check() : "");
                            body = body.Replace("###MCDataC" + count1[0] + "###", (ELOM.Country3 == "True") ? check() : "");

                            explainOtherMarketingListTemp.Add(ELOM);
                        }
                        catch
                        {
                            //TODO
                        }
                    }
                }
            }
        }

        return(body);
    }
Beispiel #2
0
    public static string PopulateRowPME(string body)
    {
        for (int x = 0; x <= Data.PaidMediaExpendituresPart1.GetUpperBound(0); x++)
        {
            Data.CountriesList PME = new Data.CountriesList();
            PME.id       = Data.PaidMediaExpendituresPart1[x, 0];
            PME.Title    = Data.PaidMediaExpendituresPart1[x, 1];
            PME.Country1 = null;
            PME.Country2 = null;
            PME.Country3 = null;
            PaidMediaExpendituresListPart1.Add(PME);
        }

        for (int x = 0; x <= Data.PaidMediaExpendituresPart2.GetUpperBound(0); x++)
        {
            Data.CountriesList PME = new Data.CountriesList();
            PME.id       = Data.PaidMediaExpendituresPart2[x, 0];
            PME.Title    = Data.PaidMediaExpendituresPart2[x, 1];
            PME.Country1 = null;
            PME.Country2 = null;
            PME.Country3 = null;
            PaidMediaExpendituresListPart2.Add(PME);
        }

        if (entryForm != null)
        {
            string[] PMECPart1 = { };
            string[] PMECPart2 = { };
            string[] PMECPart  = entryForm.PaidMediaExpendituresCheck.Split(new string[] { Delimiter[2] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (PMECPart.Count() != 0)
            {
                if (PMECPart[0].Count() != 0)
                {
                    PMECPart1 = PMECPart[0].Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
                }
                if (PMECPart[1].Count() != 0)
                {
                    PMECPart2 = PMECPart[1].Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
                }
            }

            List <Data.CountriesList> PaidMediaExpendituresListTempPart1 = new List <Data.CountriesList>();
            List <Data.CountriesList> PaidMediaExpendituresListTempPart2 = new List <Data.CountriesList>();

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            if (PMECPart1.Count() != 0)
            {
                for (int i = 0; i < PMECPart1.Length; i++)
                {
                    string[] Datas = PMECPart1[i].Split(new string[] { Delimiter[1] }, System.StringSplitOptions.RemoveEmptyEntries);

                    string[] count1 = Datas[0].Split(':');
                    string[] count2 = Datas[1].Split(':');
                    string[] count3 = Datas[2].Split(':');

                    if (count1[0] == "000")
                    {
                        // body = body.Replace("###PMECountryA###", count1[1]);
                        // body = body.Replace("###PMECountryB###", count2[1]);
                        // body = body.Replace("###PMECountryC###", count3[1]);
                    }
                    else
                    {
                        try
                        {
                            Data.CountriesList PME = PaidMediaExpendituresListPart1.FirstOrDefault(x => x.id == count1[0]);



                            PME.Country1 = Datas[0].Split(':')[1];
                            PME.Country2 = Datas[1].Split(':')[1];
                            PME.Country3 = Datas[2].Split(':')[1];

                            body = body.Replace("###PMETitleAPart1" + count1[0] + "###", PME.Title);

                            body = body.Replace("###PMECountryAPart1" + count1[0] + "###", PME.Country1);
                            body = body.Replace("###PMECountryBPart1" + count1[0] + "###", PME.Country2);
                            body = body.Replace("###PMECountryCPart1" + count1[0] + "###", PME.Country3);

                            PaidMediaExpendituresListTempPart1.Add(PME);
                        }
                        catch
                        {
                            //TODO
                        }
                    }
                }
            }
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


            if (PMECPart2.Count() != 0)
            {
                for (int i = 0; i < PMECPart2.Length; i++)
                {
                    string[] Datas = PMECPart2[i].Split(new string[] { Delimiter[1] }, System.StringSplitOptions.RemoveEmptyEntries);

                    string[] count1 = Datas[0].Split(':');
                    string[] count2 = Datas[1].Split(':');
                    string[] count3 = Datas[2].Split(':');

                    if (count1[0] == "000")
                    {
                        //body = body.Replace("###PMECountryPart2A###", count1[1]);
                        //body = body.Replace("###PMECountryPart2B###", count2[1]);
                        //body = body.Replace("###PMECountryPart2C###", count3[1]);
                    }
                    else
                    {
                        try
                        {
                            Data.CountriesList PME = PaidMediaExpendituresListPart2.FirstOrDefault(x => x.id == count1[0]);

                            PME.Country1 = Datas[0].Split(':')[1];
                            PME.Country2 = Datas[1].Split(':')[1];
                            PME.Country3 = Datas[2].Split(':')[1];

                            body = body.Replace("###PMETitleAPart2" + count1[0] + "###", PME.Title);

                            body = body.Replace("###PMECountryAPart2" + count1[0] + "###", GetMoreLess(PME.Country1));
                            body = body.Replace("###PMECountryBPart2" + count1[0] + "###", GetMoreLess(PME.Country2));
                            body = body.Replace("###PMECountryCPart2" + count1[0] + "###", GetMoreLess(PME.Country3));
                        }
                        catch
                        {
                            //TODO
                        }
                    }
                }
            }
        }

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



        return(body);
    }