public JsonResult GetTemplatesFromMailChimp(string ApiToken) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var Templates = viewModel.GetTemplatesFromMailChimp(ApiToken); return(Json(Templates, JsonRequestBehavior.AllowGet)); }
public bool AddAudienceChannel(AudienceChannelViewModel model) { bool result = false; collectionName = CosmosCollections.AudienceChannel.ToString(); try { model.channel.Id = Guid.NewGuid().ToString(); context.AddDocument <AudienceChannelDocument>(databaseName, collectionName, model.channel); if (model.listQuestions != null && model.listQuestions.Any()) { foreach (var question in model.listQuestions) { question.AudienceChannelId = model.channel.Id; context.AddDocument <QuestionAskToAudienceChannelDocument>(databaseName, questionCollectionName, question); } } result = true; } catch (Exception e) { var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name); telemetria.Critical(messageException); } return(result); }
public JsonResult GetNumberSubsSendGrid(string ApiToken, string ListId) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var subscribers = viewModel.GetSubscribersSendGrid(ApiToken, ListId); return(Json(new { CountSubscribers = subscribers })); }
public JsonResult GetAppsFromOneSignal(string ApiToken) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var apps = viewModel.GetAppsFromOneSignal(ApiToken); return(Json(apps, JsonRequestBehavior.AllowGet)); }
public JsonResult GetFoldersFromSendinBlue(string ApiToken) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var folders = viewModel.GetFoldersFromSendinBlue(ApiToken); return(Json(folders, JsonRequestBehavior.AllowGet)); }
//public string GetProductName(AudienceChannelViewModel viewModel) //{ // string Name = string.Empty; // if (viewModel.EmailProviderSelected != null && viewModel.EmailProviderSelected != string.Empty) // { // switch (viewModel.EmailProviderSelected) // { // case ChannelProvider.SendinBlueId: // { // Name = viewModel.emailProductForm.sendinBlueForm.Name; // } // break; // case ChannelProvider.SendGridId: // { // Name = viewModel.emailProductForm.sendGridForm.Name; // } // break; // case ChannelProvider.MailChimpId: // { // Name = viewModel.emailProductForm.mailChimpForm.Name; // } // break; // case ChannelProvider.AweberId: // { // Name = viewModel.emailProductForm.aweberForm.Name; // } // break; // case ChannelProvider.GetResponseId: // { // Name = viewModel.emailProductForm.getResponseForm.Name; // } // break; // case ChannelProvider.CampaignMonitorId: // { // Name = viewModel.emailProductForm.campaignMonitorForm.Name; // } // break; // case ChannelProvider.ActiveCampaignId: // { // Name = viewModel.emailProductForm.activeCampaignForm.Name; // } // break; // case ChannelProvider.MailJetId: // { // Name = viewModel.emailProductForm.mailJetForm.Name; // } // break; // case ChannelProvider.IContactId: // { // Name = viewModel.emailProductForm.icontactForm.Name; // } // break; // } // } // if (viewModel.PushProviderSelected != null && viewModel.PushProviderSelected != string.Empty) // { // switch (viewModel.PushProviderSelected) // { // case ChannelProvider.OneSignalId: // { // Name = viewModel.pushProductForm.oneSignalForm.Name; // } // break; // case ChannelProvider.PushCrewId: // { // Name = viewModel.pushProductForm.pushCrewForm.Name; // } // break; // case ChannelProvider.PushEngageId: // { // Name = viewModel.pushProductForm.pushEnagageForm.Name; // } // break; // case ChannelProvider.SubscribersId: // { // Name = viewModel.pushProductForm.subscribersForm.Name; // } // break; // } // } // if (viewModel.WebSpaceProviderSelected != null && viewModel.WebSpaceProviderSelected != string.Empty) // { // } // return Name; //} public string GetProductProviderId(AudienceChannelViewModel viewModel) { string ProviderId = string.Empty; ProviderId = viewModel.EmailProviderSelected; return(ProviderId); }
public JsonResult GetFromFieldsFromGetResponse(string ApiToken) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var fromFields = viewModel.GetFromFieldsFromGetResponse(ApiToken); return(Json(fromFields, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSegmentsFromMailJet(string ApiToken, string SecretKey) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var segments = viewModel.GetSegmentsFromMailJet(ApiToken, SecretKey); return(Json(segments, JsonRequestBehavior.AllowGet)); }
public JsonResult GetListSendGrid(string ApiToken) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var list = viewModel.GetListsSendGrid(ApiToken); return(Json(list, JsonRequestBehavior.AllowGet)); }
public PartialViewResult GetProviderForm(string emailChannelProvider) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); string path = _audienceChannelManager.GetPartialPathFromPartnerId(emailChannelProvider); return(PartialView(path, viewModel)); }
public JsonResult GetListFromSendinBlue(string ApiToken, string FolderId) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var listas = viewModel.GetListFromSendinBlue(ApiToken, FolderId); return(Json(listas, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSubscribersFromList(string ApiToken, string listName) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var subscribers = viewModel.GetSubscribersMailChimp(ApiToken, listName); return(Json(new { subsCount = subscribers })); }
private void BindQuestionsImageDescriptionAudienceChannelModel(AudienceChannelViewModel model) { var audience = audienceManager.GetAudienceById(TempData["tdIdAudience"].ToString()); model.channel.AudienceId = audience.Id; model.listQuestions = (List <QuestionAskToAudienceChannelDocument>)TempData["vdListQuestions"]; model.channel.ImageUrl = model.channel.IsDefaultImage ? audience.ImageUrl : BindFile(model); model.channel.Description = model.channel.IsDefaultDescription ? audience.Description : Negocio.Utilerias.StringUtilities.RemoveNewLineInString(model.channel.Description); }
public JsonResult GetListAweber() { var AweberApiToken = (ProviderAWeberApiResult)TempData["AweberApiTokenData"]; AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); var listas = viewModel.GetListAweber(AweberApiToken); TempData["AweberApiTokenData"] = AweberApiToken; return(Json(listas, JsonRequestBehavior.AllowGet)); }
public PartialViewResult RemoveExistingQuestion(string audienceChannelId, string questionId) { _audienceChannelManager.DeleteQuestion(questionId); AudienceChannelViewModel model = new AudienceChannelViewModel(); model.listQuestions = _audienceChannelManager.GetQuestions(audienceChannelId); return(PartialView("_TableEditQuestionChannel", model)); }
public PartialViewResult SaveNewQuestion(string audienceChannelId, string question) { QuestionAskToAudienceChannelDocument newQuestion = new QuestionAskToAudienceChannelDocument { AudienceChannelId = audienceChannelId, Question = question }; _audienceChannelManager.AddQuestion(newQuestion); AudienceChannelViewModel model = new AudienceChannelViewModel(); model.listQuestions = _audienceChannelManager.GetQuestions(audienceChannelId); return(PartialView("_TableEditQuestionChannel", model)); }
public PartialViewResult GetChannelForm(string channelId, string audienceId) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); AudienceDocument audience = audienceManager.GetAudienceById(audienceId); ViewBag.IsPremium = audience.IsPremium; ViewBag.visibility = audience.Visibility; string path = _audienceChannelManager.GetChannelPathFromPartnerId(channelId); viewModel.channel.IsDefaultDescription = true; viewModel.channel.IsDefaultImage = true; return(PartialView(path, viewModel)); }
public JsonResult GetNumberSubsAweber(string ListId) { var AweberApiToken = (ProviderAWeberApiResult)TempData["AweberApiTokenData"]; int NoSubscribers = 0; if (!string.IsNullOrEmpty(ListId)) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); NoSubscribers = Convert.ToInt16(viewModel.GetSubscribersAweber(AweberApiToken, ListId)); } TempData["AweberApiTokenData"] = AweberApiToken; return(Json(new { CountSubscribers = NoSubscribers })); }
public PartialViewResult RemoveQuestion(AudienceChannelViewModel model, string question) { listQuestions = (List <QuestionAskToAudienceChannelDocument>)TempData["vdListQuestions"]; if (listQuestions == null) { listQuestions = new List <QuestionAskToAudienceChannelDocument>(); } listQuestions.RemoveAll(l => l.Id == question); TempData["vdListQuestions"] = listQuestions; model.listQuestions = listQuestions; model.ValidationQuestion = ValidateQuestions(listQuestions); return(PartialView("_TableQuestionChannel", model)); }
public PartialViewResult GetAudienceChannelEditForm(string audienceChannelId) { AudienceChannelViewModel viewModel = this._audienceChannelManager.FindAudienceChannelById(audienceChannelId); AudienceChannelDocument audienceChannel = _audienceChannelManager.GetAudienceChannelById(audienceChannelId); AudienceDocument audience = audienceManager.GetAudienceById(audienceChannel.AudienceId); viewModel.listQuestions = audienceManager.GetQuestionsByAudienceChannelId(audienceChannelId); ViewBag.IsPremium = audience.IsPremium; ViewBag.visibility = audience.Visibility; ViewBag.ImageSrcPreview = audience.ImageUrl; ViewBag.descriptionPreview = audience.Description; string path = _audienceChannelManager.GetEditChannelPathFromPartnerId(audienceChannel.ChannelId); return(PartialView(path, viewModel)); }
public bool AddPushProduct(AudienceChannelViewModel viewModel, string audienceChannelId, string settingId, string productId, string detail) { bool result = false; PushProductDocument product = new PushProductDocument(); //product.Name = GetProductName(viewModel); product.PushProductProviderId = GetProductProviderId(viewModel); product.AudiencePropertieId = audienceChannelId; product.SettingId = settingId; product.Id = productId; product.Detail = detail; product.LastDetailUpdated = product.GetMexicanDateTime(); collectionName = CosmosCollections.PushProduct.ToString(); context.AddDocument <PushProductDocument>(databaseName, collectionName, product); return(result); }
public bool AddEmailProductSettings(string audienceUrlSite, AudienceChannelViewModel viewModel, string productId) { bool result = false; var settings = GetProductListSettings(audienceUrlSite, viewModel, productId); collectionName = CosmosCollections.EmailProductSetting.ToString(); foreach (var setting in settings) { var aux = new EmailProductSettingDocument() { Name = setting.Name, Value = setting.Value, ProductId = productId }; context.AddDocument <EmailProductSettingDocument>(databaseName, collectionName, aux); } return(result); }
public void UpdateAudienceChannel(AudienceChannelViewModel channel) { string query = $"SELECT * FROM {CosmosCollections.AudienceChannel.ToString()} WHERE {CosmosCollections.AudienceChannel.ToString()}.id='{channel.channel.Id}'"; context.ExecuteQuery <AudienceChannelDocument>(this.databaseName, CosmosCollections.AudienceChannel.ToString(), query); context.UpsertDocument <AudienceChannelDocument>(this.databaseName, CosmosCollections.AudienceChannel.ToString(), channel.channel); if (channel.listQuestions != null && channel.listQuestions.Any()) { foreach (var question in channel.listQuestions) { question.AudienceChannelId = channel.channel.Id; context.AddDocument <QuestionAskToAudienceChannelDocument>(databaseName, CosmosCollections.QuestionAskToAudienceChannel.ToString(), question); } } }
public ActionResult CreateChannel([FromBody] string audienceId) { audienceManager.audienceId = audienceId; AudienceDocument audience = audienceManager.GetAudienceById(audienceManager.audienceId); TempData["tdIdAudience"] = audienceManager.audienceId; ViewBag.ImageSrcPreview = audience.ImageUrl; ViewBag.descriptionPreview = audience.Description; ViewBag.site = audience.WebSiteUrl; AudienceChannelViewModel model = new AudienceChannelViewModel(); if (!string.IsNullOrEmpty(audienceId)) { TempData["tdIdAudience"] = audienceId; } return(View(model)); }
public PartialViewResult AddQuestion(AudienceChannelViewModel model, string question) { listQuestions = (List <QuestionAskToAudienceChannelDocument>)TempData["vdListQuestions"]; if (listQuestions == null) { listQuestions = new List <QuestionAskToAudienceChannelDocument>(); } if (!string.IsNullOrEmpty(question) && !question.Equals("__QUESTION__")) { listQuestions.Add(new QuestionAskToAudienceChannelDocument(question)); } TempData["vdListQuestions"] = listQuestions; model.listQuestions = listQuestions; model.ValidationQuestion = ValidateQuestions(listQuestions); return(PartialView("_TableQuestionChannel", model)); }
private string BindFile(AudienceChannelViewModel model) { // create Id Guid profileId = Guid.NewGuid(); // get images and urls List <Models.Core.FileUpload> images = GetFiles(); Dictionary <string, string> urls = GetUrls(images, 480, 320); // check if Img is uploaded string value = string.Empty; urls.TryGetValue("fileupImg", out value); if (!string.IsNullOrEmpty(value)) { return(value); } else { return(string.Empty); } //if (!string.IsNullOrEmpty(value)) { // return value; //} //else { // if (advertiser != null) { // viewModel.profile.PhotoUrl = advertiser.profile.PhotoUrl; // } // else { // viewModel.profile.PhotoUrl = string.Empty; // } //} }
public ActionResult CreateChannel([FromBody] AudienceChannelViewModel model) { string audienceId = TempData["tdIdAudience"].ToString(); Guid productId = Guid.NewGuid(); Guid audienceChannelId = Guid.NewGuid(); Guid settingId = Guid.NewGuid(); AudienceDocument audience = _audienceChannelManager.getAudienceById(audienceId); (string channelTypeId, string channelTypeName)channelType = ("", ""); string detail = string.Empty; if (model.EmailProviderSelected != string.Empty && model.EmailProviderSelected != null) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); if (model.EmailProviderSelected == ChannelProvider.MailChimpId) { detail = viewModel.GetSubscribersMailChimp(model.emailProductForm.mailChimpForm.ApiToken, model.emailProductForm.mailChimpForm.ListId); } else if (model.EmailProviderSelected == ChannelProvider.CampaignMonitorId) { detail = viewModel.GetSubscribersCampaignMonitor(model.emailProductForm.campaignMonitorForm.ApiToken, model.emailProductForm.campaignMonitorForm.ListId); } else if (model.EmailProviderSelected == ChannelProvider.SendGridId) { detail = viewModel.GetSubscribersSendGrid(model.emailProductForm.sendGridForm.ApiToken, model.emailProductForm.sendGridForm.ListId); } else if (model.EmailProviderSelected == ChannelProvider.AweberId) { detail = viewModel.GetSubscribersAweber((ProviderAWeberApiResult)TempData["AweberApiTokenData"], model.emailProductForm.aweberForm.ListId); } channelType = KindAds.Comun.Structures.SChannelType.Email; model.channel.ChannelId = channelType.channelTypeId; _audienceChannelManager.AddEmailProduct(model, audienceChannelId.ToString(), settingId.ToString(), productId.ToString(), detail); model.channel.Id = audienceChannelId.ToString(); model.channel.ProductId = productId.ToString(); _audienceChannelManager.AddEmailProductSettings(audience.WebSiteUrl, model, productId.ToString()); } if (model.PushProviderSelected != string.Empty && model.PushProviderSelected != null) { channelType = KindAds.Comun.Structures.SChannelType.PushNotification; model.channel.ChannelId = channelType.channelTypeId; _audienceChannelManager.AddPushProduct(model, audienceChannelId.ToString(), settingId.ToString(), productId.ToString(), string.Empty); model.channel.Id = audienceChannelId.ToString(); model.channel.ProductId = productId.ToString(); _audienceChannelManager.AddPushProductSettings(audience.WebSiteUrl, model, productId.ToString()); detail = ""; } if (model.WebSpaceProviderSelected != string.Empty) { channelType = KindAds.Comun.Structures.SChannelType.WebsiteAdSpace; //todo } string productProviderId = _audienceChannelManager.GetProductProviderId(model); // add AudienceChannelDocument and Questions var selectedCat = audienceManager.GetIndustrieById(audience.CategoryId); BindQuestionsImageDescriptionAudienceChannelModel(model); model.channel.AudienceId = audienceId; model.channel.Visibility = audience.Visibility ? model.channel.Visibility : audience.Visibility; model.channel.IsActive = audience.Verified; model.channel.Detail = detail; model.channel.LastProviderDataUpdated = DateUtils.GetMexicanDateTimeNow(); model.channel.Category = selectedCat.Name; model.channel.SubCategory = selectedCat.SubIndustries.Where(s => s.Id == audience.SubCategoryId).SingleOrDefault().Name; model.channel.AudienceName = audience.Title; model.channel.ChannelType = channelType.channelTypeName; model.channel.providerName = SChannelProvider.Providers.SingleOrDefault(p => p.providerId == productProviderId).description; model.channel.ProductProviderId = productProviderId; model.channel.Rating = string.Empty; model.channel.Score = string.Empty; var operationResult = _audienceChannelManager.AddAudienceChannel(model); return(operationResult ? Json(new { success = true, message = "Audience Channel created successfully" }) : Json(new { error = "Error creating Audience Channel" })); }
public ActionResult Channel([FromBody] AudienceChannelViewModel model) { try { model.channel.Description = Negocio.Utilerias.StringUtilities.RemoveNewLineInString(model.channel.Description); //List<QuestionAskToAudienceChannelDocument> newQuestions = (List<QuestionAskToAudienceChannelDocument>)TempData["vdListQuestions"]; AudienceChannelDocument audienceChannelSaved = this._audienceChannelManager.GetAudienceChannelById(model.channel.Id); bool changeImage = model.channel.IsDefaultImage != audienceChannelSaved.IsDefaultImage; bool changeDescription = model.channel.IsDefaultDescription != audienceChannelSaved.IsDefaultDescription; string newImageUrl = string.Empty; string newDescription = string.Empty; AudienceDocument audience = null; if (changeImage) { if (model.channel.IsDefaultImage) { audience = this.audienceManager.GetAudienceById(audienceChannelSaved.AudienceId); newImageUrl = audience.ImageUrl; } else { //Si la imagen es seleccionada por el usuario newImageUrl = BindFile(model); if (string.IsNullOrEmpty(newImageUrl)) { newImageUrl = audienceChannelSaved.ImageUrl; } } } else { if (model.channel.IsDefaultImage) { newImageUrl = audienceChannelSaved.ImageUrl; } else { //Si la imagen es seleccionada por el usuario newImageUrl = BindFile(model); if (string.IsNullOrEmpty(newImageUrl)) { if (string.IsNullOrEmpty(audienceChannelSaved.ImageUrl)) { audience = this.audienceManager.GetAudienceById(audienceChannelSaved.AudienceId); newImageUrl = audience.ImageUrl; } else { newImageUrl = audienceChannelSaved.ImageUrl; } } } } if (changeDescription) { if (model.channel.IsDefaultDescription) { audience = audience == null?this.audienceManager.GetAudienceById(audienceChannelSaved.AudienceId) : audience; newDescription = audience.Description; } } audienceChannelSaved.Price = model.channel.Price; audienceChannelSaved.Name = model.channel.Name; audienceChannelSaved.TagLine = model.channel.TagLine; audienceChannelSaved.ImageUrl = newImageUrl; audienceChannelSaved.Description = changeDescription ? (model.channel.IsDefaultDescription ? newDescription : Negocio.Utilerias.StringUtilities.RemoveNewLineInString(model.channel.Description)) : audienceChannelSaved.Description; audienceChannelSaved.IsDefaultImage = model.channel.IsDefaultImage; audienceChannelSaved.IsDefaultDescription = model.channel.IsDefaultDescription; audienceChannelSaved.Visibility = model.channel.Visibility; model.channel = audienceChannelSaved; //model.listQuestions = newQuestions; this._audienceChannelManager.UpdateAudienceChannel(model); return(Json(new { success = true, message = "Audience Channel edited successfully" })); } catch { return(Json(new { error = "Error creating Audience Channel" })); } }
public PartialViewResult GetProviderDetail(string emailChannelProvider, string emailproductId) { AudienceChannelViewModel viewModel = new AudienceChannelViewModel(); IEnumerable <EmailProductSettingDocument> settings = this._audienceChannelManager.GetProductSettingsByProductId(emailproductId); switch (emailChannelProvider) { case ChannelProvider.ActiveCampaignId: viewModel.emailProductForm = new EmailProductForms { activeCampaignForm = new ActiveCampaignForm() }; break; case ChannelProvider.AweberId: viewModel.emailProductForm = new EmailProductForms { aweberForm = new AweberForm() }; break; case ChannelProvider.CampaignMonitorId: viewModel.emailProductForm = new EmailProductForms { campaignMonitorForm = new CampaignMonitorForm() }; viewModel.emailProductForm.campaignMonitorForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.campaignMonitorApiToken.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.campaignMonitorForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.campaignMonitorList.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.campaignMonitorForm.SegmentId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.campaignMonitorSegment.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.campaignMonitorForm.ClientId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.campaignMonitorClient.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.GetResponseId: viewModel.emailProductForm = new EmailProductForms { getResponseForm = new GetResponseForm() }; viewModel.emailProductForm.getResponseForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.getResponseApiToken.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.getResponseForm.FromFieldId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.getResponseFromField.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.getResponseForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.getResponseList.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.IContactId: break; case ChannelProvider.MailChimpId: viewModel.emailProductForm = new EmailProductForms { mailChimpForm = new MailChimpForm() }; viewModel.emailProductForm.mailChimpForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailChimpApiToken.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.mailChimpForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailChimpList.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.mailChimpForm.TemplateId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailChimpTemplate.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.MailJetId: viewModel.emailProductForm = new EmailProductForms { mailJetForm = new MailJet() }; viewModel.emailProductForm.mailJetForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailJetApiKey.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.mailJetForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailJetList.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.mailJetForm.SecretKey = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailJetSecretKey.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.mailJetForm.Segment = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.mailJetSegment.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.OneSignalId: break; case ChannelProvider.PushCrewId: break; case ChannelProvider.PushEngageId: break; case ChannelProvider.SendGridId: viewModel.emailProductForm.sendGridForm = new SendGridForm(); viewModel.emailProductForm.sendGridForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendGridApiToken.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.sendGridForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendGridList.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.SendinBlueId: viewModel.emailProductForm = new EmailProductForms { sendinBlueForm = new SendinBlueForm() }; viewModel.emailProductForm.sendinBlueForm.ApiToken = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendinBlueApiKey.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.sendinBlueForm.ListId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendinBlueListId.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.sendinBlueForm.FolderId = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendinBlueFolder.ToString() && s.ProductId == emailproductId).Value; viewModel.emailProductForm.sendinBlueForm.Category = settings.SingleOrDefault(s => s.Name == SettingsEmailProvidersEnum.sendinBlueCategory.ToString() && s.ProductId == emailproductId).Value; break; case ChannelProvider.SubscribersId: break; } EmailProductDocument product = _audienceChannelManager.FindEmailProduct(viewModel.channel.ProductId); ViewBag.lastUpdated = product == null ? "" : (product.LastDetailUpdated != null ? ((DateTime)product.LastDetailUpdated.Value).ToShortTimeString() : ""); string path = _audienceChannelManager.GetPartialPathFromPartnerId(emailChannelProvider, true); return(PartialView(path, viewModel)); }
public IList <AudiencePropertieSetting> GetProductListSettings(string audienceUrlSite, AudienceChannelViewModel viewModel, string productId) { IList <AudiencePropertieSetting> settings = new List <AudiencePropertieSetting>(); string Value = string.Empty; if (viewModel.EmailProviderSelected != null && viewModel.EmailProviderSelected != string.Empty) { switch (viewModel.EmailProviderSelected) { case ChannelProvider.SendinBlueId: { Value = viewModel.emailProductForm.sendinBlueForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "sendinBlueApiKey", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.sendinBlueForm.FolderId; settings.Add(new AudiencePropertieSetting { Name = "sendinBlueFolder", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.sendinBlueForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "sendinBlueListId", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.sendinBlueForm.Category; settings.Add(new AudiencePropertieSetting { Name = "sendinBlueCategory", Value = Value, ProductId = productId }); } break; case ChannelProvider.SendGridId: { Value = viewModel.emailProductForm.sendGridForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "sendGridApiToken", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.sendGridForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "sendGridList", Value = Value, ProductId = productId }); } break; case ChannelProvider.MailChimpId: { Value = viewModel.emailProductForm.mailChimpForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "mailChimpApiToken", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.mailChimpForm.TemplateId; settings.Add(new AudiencePropertieSetting { Name = "mailChimpTemplate", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.mailChimpForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "mailChimpList", Value = Value, ProductId = productId }); } break; case ChannelProvider.MailJetId: { Value = viewModel.emailProductForm.mailJetForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "mailJetApiKey", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.mailJetForm.SecretKey; settings.Add(new AudiencePropertieSetting { Name = "mailJetSecretKey", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.mailJetForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "mailJetList", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.mailJetForm.Segment; settings.Add(new AudiencePropertieSetting { Name = "mailJetSegment", Value = Value, ProductId = productId }); } break; // push notifications case ChannelProvider.OneSignalId: { //todo Value = viewModel.pushProductForm.oneSignalForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "oneSignalApiKey", Value = Value, ProductId = productId }); Value = viewModel.pushProductForm.oneSignalForm.AppId; settings.Add(new AudiencePropertieSetting { Name = "oneSignalAppId", Value = Value, ProductId = productId }); } break; case ChannelProvider.PushCrewId: { Value = viewModel.pushProductForm.pushCrewForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "pushApiToken", Value = Value, ProductId = productId }); Value = audienceUrlSite; settings.Add(new AudiencePropertieSetting { Name = "pushNotifUrl", Value = Value, ProductId = productId }); } break; case ChannelProvider.PushEngageId: { Value = viewModel.pushProductForm.pushEnagageForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "pushApiToken", Value = Value, ProductId = productId }); } break; case ChannelProvider.SubscribersId: { Value = viewModel.pushProductForm.subscribersForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "pushApiToken", Value = Value, ProductId = productId }); Value = audienceUrlSite; settings.Add(new AudiencePropertieSetting { Name = "pushNotifUrl", Value = Value, ProductId = productId }); } break; case ChannelProvider.GetResponseId: { Value = viewModel.emailProductForm.getResponseForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "getResponseApiToken", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.getResponseForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "getResponseList", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.getResponseForm.FromFieldId; settings.Add(new AudiencePropertieSetting { Name = "getResponseFromField", Value = Value, ProductId = productId }); } break; case ChannelProvider.CampaignMonitorId: { Value = viewModel.emailProductForm.campaignMonitorForm.ApiToken; settings.Add(new AudiencePropertieSetting { Name = "campaignMonitorApiToken", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.campaignMonitorForm.ListId; settings.Add(new AudiencePropertieSetting { Name = "campaignMonitorList", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.campaignMonitorForm.ClientId; settings.Add(new AudiencePropertieSetting { Name = "campaignMonitorClient", Value = Value, ProductId = productId }); Value = viewModel.emailProductForm.campaignMonitorForm.SegmentId; settings.Add(new AudiencePropertieSetting { Name = "campaignMonitorSegment", Value = Value, ProductId = productId }); } break; } } if (viewModel.PushProviderSelected != null && viewModel.PushProviderSelected != string.Empty) { } if (viewModel.WebSpaceProviderSelected != null && viewModel.WebSpaceProviderSelected != string.Empty) { } return(settings); }