Exemplo n.º 1
0
        private static SendGridTemplate ConstructMessage(string email, string name, string qrCode, DefinitionConstants.EmailTemplates template)
        {
            SendTo[] recipient =
            {
                new SendTo()
                {
                    Name  = name,
                    Email = email
                }
            };

            Personalizations[] personalizations =
            {
                new Personalizations()
                {
                    To           = recipient,
                    Subject      = DefinitionConstants.EmailSubjects[template],
                    TemplateData = new TemplateData()
                    {
                        CompanyName = name
                    }
                }
            };

            Attachment[] attachments =
            {
                new Attachment()
                {
                    Content  = qrCode,
                    FileName = $"{name}.png",
                    Type     = _png
                }
            };

            var from = new SentFrom()
            {
                Name  = _configuration.GetValue <string>("SendgridCredentials:From"),
                Email = _configuration.GetValue <string>("SendgridCredentials:FromAddress")
            };

            return(new SendGridTemplate()
            {
                Personalizations = personalizations,
                TemplateId = DefinitionConstants.TemplateIds[template],
                Attachments = attachments,
                From = from
            });
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (sentFrom_ != null)
            {
                hash ^= SentFrom.GetHashCode();
            }
            if (sentTo_ != null)
            {
                hash ^= SentTo.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 3
0
 public void MergeFrom(ValidityPeriod other)
 {
     if (other == null)
     {
         return;
     }
     if (other.sentFrom_ != null)
     {
         if (sentFrom_ == null)
         {
             SentFrom = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         SentFrom.MergeFrom(other.SentFrom);
     }
     if (other.sentTo_ != null)
     {
         if (sentTo_ == null)
         {
             SentTo = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         SentTo.MergeFrom(other.SentTo);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }