Esempio n. 1
0
    public static string PopulateRow(string body)
    {
        body = body.Replace("###Title###", "Entry Form");
        body = body.Replace("###Logo###", WebURL + "images/logo-apaceffie-high.png");
        body = body.Replace("###HeaderLogo###", WebURL + "images/Header-logo-pdf.png");
        body = body.Replace("###IconList###", WebURL + "images/icon-list.png");
        body = body.Replace("###DesTotalOfCountries###", entryForm.DesTotalOfCountries);

        body = body.Replace("###Product###", entry.ProductClassification);
        body = body.Replace("###BrandName###", entry.Brand);
        body = body.Replace("###ProductServiceClassification###", entry.Client);
        body = body.Replace("###EntryTitle###", entry.Campaign);

        /////////////////////////////////
        body = body.Replace("###ComparedOtherCompetitorsCheck###", GetMoreLess(entryForm.ComparedOtherCompetitorsCheck));
        body = body.Replace("###ComparedOverallSpendCheck###", GetMoreLess(entryForm.ComparedOverallSpendCheck));
        /////////////////////////////////

        body = body.Replace("###SectionD###", GeneralFunctionEntryForm.CheckTextfield(entryForm.ListAndExplainOtherMarketingText));

        if (entryForm.ComparedOtherCompetitorsCheck != "" && entryForm.ComparedOtherCompetitorsCheck != null)
        {
            string[] ComparedOtherCompetitorsCheck = entryForm.ComparedOtherCompetitorsCheck.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ComparedOtherCompetitorsCheck.Length != 0)
            {
                try
                {
                    body = body.Replace("###CompareATitleA###", ((ComparedOtherCompetitorsCheck[0].Replace(" ", "") == "True") ? check() : "" + " "));
                    body = body.Replace("###CompareATitleB###", ((ComparedOtherCompetitorsCheck[1].Replace(" ", "") == "True") ? check() : "" + " "));
                    body = body.Replace("###CompareATitleC###", ((ComparedOtherCompetitorsCheck[2].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareATitleD###", ((ComparedOtherCompetitorsCheck[3].Replace(" ", "") == "True") ? check("center") : "" + " "));
                }
                catch { }
            }
        }


        if (entryForm.PaidMediaExpendituresCheck != "" && entryForm.PaidMediaExpendituresCheck != null)
        {
            string[] PME = entryForm.PaidMediaExpendituresCheck.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (PME.Length != 0)
            {
                //body = body.Replace("###PaidMediaExpendituresCurrent###", "<p style=\"color: #fff;\">-</p>");
                //body = body.Replace("###PaidMediaExpendituresPrior###", "<p style=\"color: #fff;\">-</p>");
                try
                {
                    body = body.Replace("###CurrentYear###", PME[0].Replace("  ", ""));
                    body = body.Replace("###YearPrior###", PME[1].Replace("  ", ""));

                    body = body.Replace("###PaidMediaExpendituresCurrent###", PME[2].Replace("  ", ""));
                    body = body.Replace("###PaidMediaExpendituresPrior###", PME[3].Replace("  ", ""));
                }
                catch
                {
                }
            }
        }

        if (entryForm.ComparedOverallSpendCheck != "" && entryForm.ComparedOverallSpendCheck != null)
        {
            string[] ComparedOverallSpendCheck = entryForm.ComparedOverallSpendCheck.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ComparedOverallSpendCheck.Length != 0)
            {
                try
                {
                    body = body.Replace("###CompareBTitleA###", ((ComparedOverallSpendCheck[0].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleB###", ((ComparedOverallSpendCheck[1].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleC###", ((ComparedOverallSpendCheck[2].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleD###", ((ComparedOverallSpendCheck[3].Replace(" ", "") == "True") ? check("center") : "" + " "));
                }
                catch { }
            }
        }

        body = body.Replace("###EntryTitle###", entry.Brand);
        body = body.Replace("###EntryID###", entry.Serial);

        body = body.Replace("###YouEnteringInto###", Data.GetCategoryMarket(entry.CategoryMarket));
        body = body.Replace("###EntryCategory###", entry.CategoryPSDetail);
        body = body.Replace("###CountryHeader###", entry.Effectiveness);
        body = body.Replace("###StartDate###", entry.DateCampaignStart.ToString("dd MMM yyyy"));
        body = body.Replace("###EndDate###", entry.DateCampaignEnd.ToString("dd MMM yyyy"));

        try
        {
            string countries = "";
            foreach (string country in entry.CaseData.Split('|'))
            {
                countries += country + ", ";
            }

            body = body.Replace("###Totalnumber###", (entry.CaseData.Split('|').Count() - 1).ToString());
            body = body.Replace("###CountriesList###", countries.Substring(0, countries.Length - 4) + ".");
        }
        catch
        {
            body = body.Replace("###Totalnumber###", "0");
            body = body.Replace("###CountriesList###", "No Country Selected.");
        }

        body = body.Replace("###ExecutiveSummary###", GeneralFunctionEntryForm.CheckTextfield(entryForm.ExecutiveSummary));
        body = body.Replace("###DescribeMarketBackground###", GeneralFunctionEntryForm.CheckTextfield(entryForm.DescribeMarket));

        if (entryForm.StrategicChallengeObjectives != "" && entryForm.StrategicChallengeObjectives != null)
        {
            string[] StrategicChallengeObjectivesList = entryForm.StrategicChallengeObjectives.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (StrategicChallengeObjectivesList.Length != 0)
            {
                try
                {
                    body = body.Replace("###StrategicChallengeObjectivesA###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[0]));
                    body = body.Replace("###StrategicChallengeObjectivesB###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[1]));
                    body = body.Replace("###StrategicChallengeObjectivesC###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[2]));
                    body = body.Replace("###StrategicChallengeObjectivesD###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[3]));
                    body = body.Replace("###StrategicChallengeObjectivesE###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[4]));
                    body = body.Replace("###StrategicChallengeObjectivesF###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[5]));
                }
                catch { }
            }
        }

        if (entryForm.Ideas != "" && entryForm.Ideas != null)
        {
            string[] IdeasList = entryForm.Ideas.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (IdeasList.Length != 0)
            {
                try {
                    body = body.Replace("###IdeaA###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[0]));
                    body = body.Replace("###IdeaB###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[1]));
                    body = body.Replace("###IdeaC###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[2]));
                }
                catch { }
            }
        }

        body = body.Replace("###BringIdeaA###", GeneralFunctionEntryForm.CheckTextfield(entryForm.BringingIdea));

        body = body.Replace("###ExplainSelected###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Other));
        body = body.Replace("###Elaborate###", GeneralFunctionEntryForm.CheckTextfield(entryForm.PaidMediaExpendituresText));
        body = body.Replace("###OwnedMedia###", GeneralFunctionEntryForm.CheckTextfield(entryForm.OwnedMedia));
        body = body.Replace("###Sponsorship###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Sponsorship));

        if (entryForm.ExplainWorked != "" && entryForm.ExplainWorked != null)
        {
            string[] ExplainWorked = entryForm.ExplainWorked.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ExplainWorked.Length != 0)
            {
                try
                {
                    body = body.Replace("###HowWorkedA###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[0]));
                    body = body.Replace("###HowWorkedB###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[1]));
                    body = body.Replace("###HowWorkedC###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[2]));
                }
                catch { }
            }
        }

        body = body.Replace("###Anything###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Anything));

        body = PopulateRowPTC(body);
        body = PopulateRowEOM(body);
        body = PopulateImages(body);

        return(body);
    }
Esempio n. 2
0
    public static string PopulateRow(string body)
    {
        body = body.Replace("###Title###", "Entry Form");
        body = body.Replace("###Logo###", WebURL + "images/logo-apaceffie-high.png");
        body = body.Replace("###HeaderLogo###", WebURL + "images/Header-logo-pdf.png");
        body = body.Replace("###IconList###", WebURL + "images/icon-list.png");
        body = body.Replace("###DesTotalOfCountries###", entryForm.DesTotalOfCountries);

        body = body.Replace("###Product###", entry.ProductClassification);
        body = body.Replace("###BrandName###", entry.Brand);
        body = body.Replace("###ProductServiceClassification###", entry.Client);
        body = body.Replace("###EntryTitle###", entry.Campaign);

        body = body.Replace("###EntryID###", entry.Serial);
        body = body.Replace("###ExecutiveSummary###", GeneralFunctionEntryForm.CheckTextfield(entryForm.ExecutiveSummary));
        body = body.Replace("###DescribeMarket###", GeneralFunctionEntryForm.CheckTextfield(entryForm.DescribeMarket));
        body = body.Replace("###ExplainListOtherMarketing###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Other));
        body = body.Replace("###PaidMediaExpendituresText###", GeneralFunctionEntryForm.CheckTextfield(entryForm.PaidMediaExpendituresText));

        body = body.Replace("###ExplainCriteria###", GeneralFunctionEntryForm.CheckTextfield(entryForm.ExplainCriteria));
        body = body.Replace("###BrandName###", entry.Campaign);
        body = body.Replace("###ProductServiceClassification###", entry.Client);
        body = body.Replace("###EntryTitle###", entry.Brand);

        body = body.Replace("###YouEnteringInto###", Data.GetCategoryMarket(entry.CategoryMarket));
        body = body.Replace("###EntryCategory###", entry.CategoryPSDetail);
        try
        {
            string countries = "";
            foreach (string country in entry.Effectiveness.Split('|'))
            {
                countries += country + ", ";
            }

            body = body.Replace("###CountryHeader###", countries.Substring(0, countries.Length - 4) + ".");

            body = body.Replace("###PMECountryA###", entry.Effectiveness.Split('|')[0].ToString());
            body = body.Replace("###PMECountryB###", entry.Effectiveness.Split('|')[1].ToString());
            body = body.Replace("###PMECountryC###", entry.Effectiveness.Split('|')[2].ToString());

            body = body.Replace("###MCCountryA###", entry.Effectiveness.Split('|')[0].ToString());
            body = body.Replace("###MCCountryB###", entry.Effectiveness.Split('|')[1].ToString());
            body = body.Replace("###MCCountryC###", entry.Effectiveness.Split('|')[2].ToString());

            body = body.Replace("###Country1###", entry.Effectiveness.Split('|')[0].ToString());
            body = body.Replace("###Country2###", entry.Effectiveness.Split('|')[1].ToString());
            body = body.Replace("###Country3###", entry.Effectiveness.Split('|')[2].ToString());
        }
        catch
        {
            body = body.Replace("###CountryHeader###", "No Country Selected.");
        }

        body = body.Replace("###StartDate###", entry.DateCampaignStart.ToString("dd MMM yyyy"));
        body = body.Replace("###EndDate###", entry.DateCampaignEnd.ToString("dd MMM yyyy"));

        body = body.Replace("###Elaborate###", GeneralFunctionEntryForm.CheckTextfield(entryForm.PaidMediaExpendituresText));
        body = body.Replace("###OwnedMedia###", GeneralFunctionEntryForm.CheckTextfield(entryForm.OwnedMedia));
        body = body.Replace("###Sponsorship###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Sponsorship));

        if (entryForm.BringingIdea != "" && entryForm.BringingIdea != null)
        {
            string[] BringingIdea = entryForm.BringingIdea.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (BringingIdea.Length != 0)
            {
                try {
                    body = body.Replace("###BringingIdeaA###", GeneralFunctionEntryForm.CheckTextfield(BringingIdea[0]));
                    body = body.Replace("###BringingIdeaB###", GeneralFunctionEntryForm.CheckTextfield(BringingIdea[1]));
                }
                catch { }
            }
        }

        body = body.Replace("###BudgetElaboration###", GeneralFunctionEntryForm.CheckTextfield(entryForm.PaidMediaExpendituresIndicate));

        if (entryForm.PaidMediaExpendituresAstimates != "" && entryForm.PaidMediaExpendituresAstimates != null)
        {
            string[] PaidMediaExpendituresAstimates = entryForm.PaidMediaExpendituresAstimates.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (PaidMediaExpendituresAstimates.Length != 0)
            {
                try {
                    body = body.Replace("###MediaBudgetA###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresAstimates[0]));
                    body = body.Replace("###MediaBudgetB###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresAstimates[1]));
                    body = body.Replace("###MediaBudgetC###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresAstimates[2]));
                }
                catch { }
            }
        }

        if (entryForm.PaidMediaExpendituresAveregeAnnual != "" && entryForm.PaidMediaExpendituresAveregeAnnual != null)
        {
            string[] PaidMediaExpendituresAveregeAnnual = entryForm.PaidMediaExpendituresAveregeAnnual.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (PaidMediaExpendituresAveregeAnnual.Length != 0)
            {
                try {
                    body = body.Replace("###AnualBadgeA###", string.IsNullOrEmpty(PaidMediaExpendituresAveregeAnnual[0]) ? "" : PaidMediaExpendituresAveregeAnnual[0]);
                    body = body.Replace("###AnualBadgeB###", string.IsNullOrEmpty(PaidMediaExpendituresAveregeAnnual[1]) ? "" : PaidMediaExpendituresAveregeAnnual[1]);
                    body = body.Replace("###AnualBadgeC###", string.IsNullOrEmpty(PaidMediaExpendituresAveregeAnnual[2]) ? "" : PaidMediaExpendituresAveregeAnnual[2]);
                }
                catch { }
            }
        }

        if (entryForm.PaidMediaExpendituresTotalBudget != "" && entryForm.PaidMediaExpendituresTotalBudget != null)
        {
            string[] PaidMediaExpendituresTotalBudget = entryForm.PaidMediaExpendituresTotalBudget.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (PaidMediaExpendituresTotalBudget.Length != 0)
            {
                try {
                    body = body.Replace("###ApproximateBudgetA###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresTotalBudget[0]));
                    body = body.Replace("###ApproximateBudgetB###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresTotalBudget[1]));
                    body = body.Replace("###ApproximateBudgetC###", GeneralFunctionEntryForm.CheckTextfield(PaidMediaExpendituresTotalBudget[2]));
                }
                catch { }
            }
        }

        try
        {
            string countries = "";
            foreach (string country in entry.CaseData.Split('|'))
            {
                countries += country + ", ";
            }

            body = body.Replace("###Totalnumber###", (entry.CaseData.Split('|').Count() - 1).ToString());
            body = body.Replace("###CountriesList###", countries.Substring(0, countries.Length - 4) + ".");
        }
        catch
        {
            body = body.Replace("###Totalnumber###", "0");
            body = body.Replace("###CountriesList###", "No Country Selected.");
        }

        if (entryForm.StrategicChallengeObjectives != "" && entryForm.StrategicChallengeObjectives != null)
        {
            string[] StrategicChallengeObjectivesList = entryForm.StrategicChallengeObjectives.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (StrategicChallengeObjectivesList.Length != 0)
            {
                try
                {
                    body = body.Replace("###StrategicChallengeObjectivesA###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[0]));
                    body = body.Replace("###StrategicChallengeObjectivesB###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[1]));
                    body = body.Replace("###StrategicChallengeObjectivesC###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[2]));
                    body = body.Replace("###StrategicChallengeObjectivesD###", GeneralFunctionEntryForm.CheckTextfield(StrategicChallengeObjectivesList[3]));
                }
                catch { }
            }
        }

        if (entryForm.Ideas != "" && entryForm.Ideas != null)
        {
            string[] IdeasList = entryForm.Ideas.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (IdeasList.Length != 0)
            {
                try
                {
                    body = body.Replace("###IdeasA###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[0]));
                    body = body.Replace("###IdeasB###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[1]));
                    body = body.Replace("###IdeasC###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[2]));
                    body = body.Replace("###IdeasD###", GeneralFunctionEntryForm.CheckTextfield(IdeasList[3]));
                }
                catch { }
            }
        }


        if (entryForm.ComparedOtherCompetitorsCheck != "" && entryForm.ComparedOtherCompetitorsCheck != null)
        {
            string[] ComparedOtherCompetitorsCheck = entryForm.ComparedOtherCompetitorsCheck.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ComparedOtherCompetitorsCheck.Length != 0)
            {
                try
                {
                    body = body.Replace("###CompareATitleA###", ((ComparedOtherCompetitorsCheck[0].Replace(" ", "") == "True") ? check() : "" + " "));
                    body = body.Replace("###CompareATitleB###", ((ComparedOtherCompetitorsCheck[1].Replace(" ", "") == "True") ? check() : "" + " "));
                    body = body.Replace("###CompareATitleC###", ((ComparedOtherCompetitorsCheck[2].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareATitleD###", ((ComparedOtherCompetitorsCheck[3].Replace(" ", "") == "True") ? check("center") : "" + " "));
                }
                catch { }
            }
        }

        if (entryForm.ComparedOverallSpendCheck != "" && entryForm.ComparedOverallSpendCheck != null)
        {
            string[] ComparedOverallSpendCheck = entryForm.ComparedOverallSpendCheck.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ComparedOverallSpendCheck.Length != 0)
            {
                try {
                    body = body.Replace("###CompareBTitleA###", ((ComparedOverallSpendCheck[0].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleB###", ((ComparedOverallSpendCheck[1].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleC###", ((ComparedOverallSpendCheck[2].Replace(" ", "") == "True") ? check("center") : "" + " "));
                    body = body.Replace("###CompareBTitleD###", ((ComparedOverallSpendCheck[3].Replace(" ", "") == "True") ? check("center") : "" + " "));
                }
                catch { }
            }
        }

        if (entryForm.ExplainWorked != "" && entryForm.ExplainWorked != null)
        {
            string[] ExplainWorked = entryForm.ExplainWorked.Split(new string[] { Delimiter[0] }, System.StringSplitOptions.RemoveEmptyEntries);
            if (ExplainWorked.Length != 0)
            {
                try
                {
                    body = body.Replace("###HowWorkedA###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[0]));
                    body = body.Replace("###HowWorkedB###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[1]));
                    body = body.Replace("###HowWorkedC###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[2]));
                    body = body.Replace("###HowWorkedD###", GeneralFunctionEntryForm.CheckTextfield(ExplainWorked[3]));
                }
                catch { }
            }
        }

        body = body.Replace("###Anything###", GeneralFunctionEntryForm.CheckTextfield(entryForm.Anything));

        body = PopulateRowPTC(body);
        body = PopulateRowEOM(body);
        body = PopulateRowPME(body);
        body = PopulateImages(body);

        return(body);
    }