示例#1
0
        public SendinBlueCampaignRequest FillSendinBlueRequestFromCosmos()
        {
            SendinBlueCampaignRequest request = new SendinBlueCampaignRequest();

            try
            {
                if (this.settings.Count > 0)
                {
                    foreach (var item in settings)
                    {
                        switch (item.Name)
                        {
                        case "sendinBlueApiKey":
                        {
                            request.ApiKey = item.Name.Equals("sendinBlueApiKey") ? item.Value : string.Empty;
                        }
                        break;

                        case "sendinBlueCategory":
                        {
                            request.Category = item.Name.Equals("sendinBlueCategory") ? item.Value : string.Empty;
                        }
                        break;

                        case "sendinBlueFromEmail":
                        {
                            SendinBlueManager manager = new SendinBlueManager(request.ApiKey);
                            request.FromEmail = manager.GetAccountEmail();
                        }
                        break;

                        case "sendinBlueListId":
                        {
                            string listId = item.Name.Equals("sendinBlueListId") ? item.Value : string.Empty;
                            request.ListIds = new List <int> {
                                Convert.ToInt32(listId)
                            };
                        }
                        break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string exceptionMessage = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(exceptionMessage);
            }
            return(request);
        }
示例#2
0
        public SendinBlueCampaignRequest FillSendinBlueRequest(ICollection <ProductSettingsEntity> settings)
        {
            SendinBlueCampaignRequest request = new SendinBlueCampaignRequest();

            foreach (var item in settings)
            {
                switch (item.SettingName)
                {
                case "sendinBlueApiKey":
                {
                    request.ApiKey = item.SettingName.Equals("sendinBlueApiKey") ? item.SettingValue : string.Empty;
                }
                break;

                case "sendinBlueCategory":
                {
                    request.Category = item.SettingName.Equals("sendinBlueCategory") ? item.SettingValue : string.Empty;
                }
                break;

                case "sendinBlueFromEmail":
                {
                    SendinBlueManager manager = new SendinBlueManager(request.ApiKey);
                    request.FromEmail = manager.GetAccountEmail();
                }
                break;

                case "sendinBlueListId":
                {
                    string listId = item.SettingName.Equals("sendinBlueListId") ? item.SettingValue : string.Empty;
                    request.ListIds = new List <int> {
                        Convert.ToInt32(listId)
                    };
                } break;
                }
            }
            return(request);
        }