Ejemplo n.º 1
0
 protected virtual void Initialize(string countryCode, int orgId, string variant)
 {
     try
     {
         template = MailTemplate.FromNameCountryAndOrg(this.BaseName + variant, countryCode, orgId);
     }
     catch
     {
         string name = this.BaseName + variant;
         if (name.EndsWith("Plain"))
         {
             try
             {
                 name     = name.Substring(0, name.Length - 5);
                 template = MailTemplate.FromNameCountryAndOrg(name, countryCode, orgId);
             }
             catch (Exception e)
             {
                 throw new Exception("Failed to create MailTemplate.FromNameCountryAndOrg(" + name + "," + countryCode + "," + orgId + ")", e);
             }
         }
         else
         {
             try
             {
                 template = MailTemplate.FromNameCountryAndOrg(name + "Plain", countryCode, orgId);
             }
             catch (Exception e)
             {
                 throw new Exception("Failed to create (plain) MailTemplate.FromNameCountryAndOrg(" + name + "," + countryCode + "," + orgId + ")", e);
             }
         }
     }
 }