Exemple #1
0
        public IHttpActionResult AddBulksendRequest(BulksendRequestViewModel bulksendRequestViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bulksendRequestViewModel.BulksendRequestId         = 1;
            bulksendRequestViewModel.EmailSendScheduleDatetime = DateTime.Now;

            var fileRequest = new FileRequest()
            {
                BatchId                          = bulksendRequestViewModel.BatchId,
                BulkSendId                       = bulksendRequestViewModel.BulksendId,
                ContentId                        = bulksendRequestViewModel.EmailContentId,
                FilePath                         = System.Web.Hosting.HostingEnvironment.MapPath("~/datafiles/") + bulksendRequestViewModel.BulksendInputDataFile,
                TenantAccountId                  = bulksendRequestViewModel.TenantAccountId,
                BulkSendEmailType                = bulksendRequestViewModel.EmailClassification ? BulkSendEmailType.Promotional : BulkSendEmailType.Transactional,
                IsSendInvoke                     = bulksendRequestViewModel.IsEmailSendInvoke,
                IsDynamicDataExtension           = bulksendRequestViewModel.BulksendApproach,
                IsOverrideConfiguration          = true,
                DataImportType                   = bulksendRequestViewModel.DataImportType ? DataImportType.Overwrite : DataImportType.AddAndUpdate,
                DynamicDataExtensionTemplateName = bulksendRequestViewModel.DataExtensionTemplateName
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(CreatedAtRoute("EiRequestsApi", null, filesendResult));
        }
        /// <summary>
        /// Test Method for BulkSend
        /// </summary>
        /// <returns></returns>
        private static string BulkSend()
        {
            var fileRequest = new FileRequest()
            {
                BatchId                          = "1008",
                BulkSendId                       = "1",
                ContentId                        = 312182,
                FilePath                         = @"D:\Usr\Krishna\EI_HCP_Team_Input_File_003.tsv",
                TenantAccountId                  = "10460681",
                BulkSendEmailType                = BulkSendEmailType.Promotional,
                IsSendInvoke                     = true,
                IsDynamicDataExtension           = true,
                IsOverrideConfiguration          = true,
                DataImportType                   = DataImportType.Overwrite,
                DynamicDataExtensionTemplateName = "ITPROTEMPLATEv2"
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(filesendResult.Result + "; EI ID: '" + filesendResult.EmailInterchangeId + "'");
        }
        /// <summary>
        /// Test Method for BulkSend
        /// </summary>
        /// <returns></returns>
        private static string BulkSend(string batchId, string bulkSendId, int contentId, string filePath, string tenantAccountId, BulkSendEmailType bulkSendEmailType, bool isSendInvoke, bool isDynamicDataExtension, bool isOverrideConfiguration, DataImportType dataImportType, string dynamicDataExtensionTemplateName)
        {
            //"b480ee7d-2444-4f37-ba6d-db279b87b60a","b480ee7d-2444-4f37-ba6d-db279b87b60a",@"D:\Usr\ShankarBaradwaj\MslMailerBulkSendList-20150313-255746814.tsv","10290011",BulkSendEmailType.Transactional,true, true,true,DataImportType.AddAndUpdate,"MSL Email Campaigns DE"
            var fileRequest = new FileRequest()
            {
                BatchId                          = batchId,
                BulkSendId                       = bulkSendId,
                ContentId                        = contentId,
                FilePath                         = filePath,
                TenantAccountId                  = tenantAccountId,
                BulkSendEmailType                = bulkSendEmailType,
                IsSendInvoke                     = isSendInvoke,
                IsDynamicDataExtension           = isDynamicDataExtension,
                IsOverrideConfiguration          = isOverrideConfiguration,
                DataImportType                   = dataImportType,
                DynamicDataExtensionTemplateName = dynamicDataExtensionTemplateName
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(filesendResult.Result + "; EI ID: '" + filesendResult.EmailInterchangeId + "'");
        }