Beispiel #1
0
        private Dictionary <string, string> getMandateDataItem(modelProjectVariation projvar, modelOrganization applicant, modelOrganization partner, modelNationalAgency agency)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("[@PROJECTVARIATION-ProjectTitle]", projvar.getProjectTitle());
            data.Add("[@PROJECTVARIATION-Acronym]", projvar.Acronym);
            data.Add("[@PROJECTVARIATION-VariationTitle]", projvar.Title);

            data.Add("[@PARTNER-acronym]", partner.Acronym);
            data.Add("[@PARTNER-legal-name]", partner.LegalName);
            data.Add("[@PARTNER-legal-representative]", partner.Representative());
            data.Add("[@PARTNER-legal-status]", partner.LegalStatus);
            data.Add("[@PARTNER-registration-no]", partner.RegistrationNumber);
            data.Add("[@PARTNER-full-address]", partner.Address);
            data.Add("[@PARTNER-city]", partner.City);
            data.Add("[@PARTNER-country]", partner.getCountry());
            data.Add("[@PARTNER-country-code]", partner.getCountryCode());
            data.Add("[@APPLICANT-legal-name]", applicant.LegalName);
            data.Add("[@APPLICANT-acronym]", applicant.Acronym);
            data.Add("[@APPLICANT-legal-status]", applicant.LegalStatus);
            data.Add("[@APPLICANT-registration-no]", applicant.RegistrationNumber);
            data.Add("[@APPLICANT-full-address]", applicant.Address);
            data.Add("[@APPLICANT-country]", applicant.getCountry());
            data.Add("[@APPLICANT-country-code]", applicant.getCountryCode());
            data.Add("[@APPLICANT-legal-representative]", applicant.Representative());
            data.Add("[@APPLICANT-city]", applicant.City);
            data.Add("[@NATIONALAGENCY-AgencyName]", agency.AgencyName);
            data.Add("[@NATIONALAGENCY-Country]", agency.getCountry());

            return(data);
        }
Beispiel #2
0
        public formMandate(modelProjectVariation projVar)
        {
            InitializeComponent();

            SetStatus("");
            projectVariation = projVar;
            prepareMandateData();
        }
Beispiel #3
0
 public void Delete(modelProjectVariation projectVariation, bool reload = true)
 {
     db.Delete("tblProjectVariation", "ID", projectVariation);
     if (reload)
     {
         LoadProjectVariations();
     }
 }
Beispiel #4
0
 public void Update(modelProjectVariation projectVariation, bool reload = true)
 {
     if (projectVariation.CreatedDate.Year < 2000)
     {
         projectVariation.CreatedDate = new DateTime(2000, 1, 1);
     }
     projectVariation.UpdatedDate = DateTime.Now;
     db.Update("tblProjectVariation", "ID", projectVariation);
     if (reload)
     {
         LoadProjectVariations();
     }
 }
Beispiel #5
0
 public void Insert(modelProjectVariation projectVariation, bool reload = true)
 {
     if (projectVariation.ID == 0)
     {
         projectVariation.ID          = Program.GData.LongID();
         projectVariation.CreatedDate = DateTime.Now;
         projectVariation.UpdatedDate = DateTime.Now;
     }
     db.Insert("tblProjectVariation", "ID", false, projectVariation);
     if (reload)
     {
         LoadProjectVariations();
     }
 }
Beispiel #6
0
        private void AddProjectVariationVariables(ref Dictionary <string, string> mailMergeVars, modelProjectVariation projvar, modelProjectVariationOrganization[] partners, string countryList)
        {
            string na        = "";
            var    natagency = Program.GData.dataLOV.getNationalAgency(projvar.NationalAgency);

            if (natagency != null)
            {
                na = natagency.AgencyName;
            }

            AddToVariablesDictionary(ref mailMergeVars, "round", projvar.Call);
            AddToVariablesDictionary(ref mailMergeVars, "project_name", projvar.Title);
            AddToVariablesDictionary(ref mailMergeVars, "project_name_acronym", projvar.Acronym);
            AddToVariablesDictionary(ref mailMergeVars, "partner_count", partners.Count().ToString());
            AddToVariablesDictionary(ref mailMergeVars, "partners_countries_list", countryList);
            AddToVariablesDictionary(ref mailMergeVars, "national_agency", na);
            AddToVariablesDictionary(ref mailMergeVars, "custom_variable1", projvar.CustomVariable1);
            AddToVariablesDictionary(ref mailMergeVars, "custom_variable2", projvar.CustomVariable2);
        }
Beispiel #7
0
        public void prepareMailMergeDataVariation(modelProjectVariation prjVariation, ref Dictionary <string, string> mailMergeVars)
        {
            modelOrganization emptyOrg = new modelOrganization();

            //modelProjectVariation projvar1 = null;
            modelProjectActivityVariation projactvar1 = null;
            //modelProjectVariation projvar2 = null;
            modelProjectActivityVariation projactvar2 = null;
            modelOrganization             applicant   = emptyOrg;
            modelOrganization             partner01   = emptyOrg;
            modelOrganization             partner02   = emptyOrg;
            modelOrganization             partner03   = emptyOrg;
            modelOrganization             partner04   = emptyOrg;
            modelOrganization             partner05   = emptyOrg;
            modelOrganization             partner06   = emptyOrg;
            modelOrganization             partner07   = emptyOrg;
            modelMobility emptyMobility = new modelMobility();

            var actvars = Program.GData.dataProject.getProjectActivityVariations.Where(c => c.ProjectVariation == prjVariation.ID).ToArray();

            if (actvars.Count() == 0)
            {
                return;
            }
            if (actvars.Count() == 1)
            {
                projactvar1          = actvars[0];
                projactvar2          = new modelProjectActivityVariation();
                projactvar2.Duration = 1;
            }
            if (actvars.Count() == 2)
            {
                projactvar1 = actvars[0];
                projactvar2 = actvars[1];
            }

            applicant = Program.GData.dataOrganization.getOrganization(prjVariation.ApplicantOrganization);
            var partners = Program.GData.dataProject.getProjectVariationOrganizations.Where(c => c.ProjectVariation == prjVariation.ID).OrderBy(d => d.OrganizationOrder).ToArray();

            if (partners.Count() > 0)
            {
                partner01 = Program.GData.dataOrganization.getOrganization(partners[0].Organization);
            }
            if (partners.Count() > 1)
            {
                partner02 = Program.GData.dataOrganization.getOrganization(partners[1].Organization);
            }
            if (partners.Count() > 2)
            {
                partner03 = Program.GData.dataOrganization.getOrganization(partners[2].Organization);
            }
            if (partners.Count() > 3)
            {
                partner04 = Program.GData.dataOrganization.getOrganization(partners[3].Organization);
            }
            if (partners.Count() > 4)
            {
                partner05 = Program.GData.dataOrganization.getOrganization(partners[4].Organization);
            }
            if (partners.Count() > 5)
            {
                partner06 = Program.GData.dataOrganization.getOrganization(partners[5].Organization);
            }
            if (partners.Count() > 6)
            {
                partner07 = Program.GData.dataOrganization.getOrganization(partners[6].Organization);
            }

            string countryList = applicant.getCountryCode() + "," + partner01.getCountryCode() + "," + partner02.getCountryCode() + "," + partner03.getCountryCode() + "," + partner04.getCountryCode() + "," + partner05.getCountryCode() + "," + partner06.getCountryCode() + "," + partner07.getCountryCode();

            while (countryList.Contains(",,"))
            {
                countryList = countryList.Replace(",,", ",");
            }
            if (countryList.Substring(countryList.Length - 1) == ",")
            {
                countryList = countryList.Substring(0, countryList.Length - 1);
            }

            var mobilities1 = Program.GData.dataActivity.getMobilities.Where(c => c.ActivityVariation == projactvar1.ID).OrderBy(c => c.MobilityOrder).ToArray();
            var mobilities2 = Program.GData.dataActivity.getMobilities.Where(c => c.ActivityVariation == projactvar2.ID).OrderBy(c => c.MobilityOrder).ToArray();

            AddProjectVariationVariables(ref mailMergeVars, prjVariation, partners, countryList);
            AddProjectActivityVariationVariables(ref mailMergeVars, projactvar1, partners, "a1_");
            AddProjectActivityVariationVariables(ref mailMergeVars, projactvar2, partners, "a2_");

            int sum1_facilitators = 0;
            int sum1_stuff        = 0;
            int sum1_gtl          = 0;
            int sum1_participants = 0;

            for (int idx = 0; idx < 8; idx++)
            {
                if (mobilities1.Count() > idx)
                {
                    AddMobilityVariables(ref mailMergeVars, mobilities1[idx], "a1_mob" + (idx + 1).ToString() + "_");
                    sum1_facilitators += mobilities1[idx].Facilitators;
                    sum1_stuff        += mobilities1[idx].Others;
                    sum1_gtl          += mobilities1[idx].GroupLeaders + mobilities1[idx].Trainers + mobilities1[idx].Facilitators;
                    sum1_participants += mobilities1[idx].Participants;
                }
                else
                {
                    AddMobilityVariables(ref mailMergeVars, emptyMobility, "a1_mob" + (idx + 1).ToString() + "_");
                }
            }
            AddMobilitySumsVariables(ref mailMergeVars, sum1_facilitators, sum1_stuff, sum1_gtl, sum1_participants, "a1_");

            int sum2_facilitators = 0;
            int sum2_stuff        = 0;
            int sum2_gtl          = 0;
            int sum2_participants = 0;

            for (int idx = 0; idx < 8; idx++)
            {
                if (mobilities2.Count() > idx)
                {
                    AddMobilityVariables(ref mailMergeVars, mobilities2[idx], "a2_mob" + (idx + 1).ToString() + "_");
                    sum2_facilitators += mobilities2[idx].Facilitators;
                    sum2_stuff        += mobilities2[idx].Others;
                    sum2_gtl          += mobilities2[idx].GroupLeaders + mobilities2[idx].Trainers + mobilities2[idx].Facilitators;
                    sum2_participants += mobilities2[idx].Participants;
                }
                else
                {
                    AddMobilityVariables(ref mailMergeVars, emptyMobility, "a2_mob" + (idx + 1).ToString() + "_");
                }
            }
            AddMobilitySumsVariables(ref mailMergeVars, sum2_facilitators, sum2_stuff, sum2_gtl, sum2_participants, "a2_");

            AddApplicantVariables(ref mailMergeVars, applicant, "applicant_");
            AddPartnerVariables(ref mailMergeVars, partner01, "partner01_");
            AddPartnerVariables(ref mailMergeVars, partner02, "partner02_");
            AddPartnerVariables(ref mailMergeVars, partner03, "partner03_");
            AddPartnerVariables(ref mailMergeVars, partner04, "partner04_");
            AddPartnerVariables(ref mailMergeVars, partner05, "partner05_");
            AddPartnerVariables(ref mailMergeVars, partner06, "partner06_");
            AddPartnerVariables(ref mailMergeVars, partner07, "partner07_");
        }