public ActionResult TestSms(SmsClickatellModel model) { try { if (String.IsNullOrEmpty(model.TestMessage)) { model.TestSmsResult = "Enter test message"; } else { var smsProvider = _smsService.LoadSmsProviderBySystemName("Mobile.SMS.Clickatell"); if (!smsProvider.SendSms(model.TestMessage)) { model.TestSmsResult = _localizationService.GetResource("Plugins.Sms.Clickatell.TestFailed"); } else { model.TestSmsResult = _localizationService.GetResource("Plugins.Sms.Clickatell.TestSuccess"); } } } catch(Exception exc) { model.TestSmsResult = exc.ToString(); } return View("Nop.Plugin.SMS.Clickatell.Views.SmsClickatell.Configure", model); }
public ActionResult TestSms(SmsClickatellModel model) { try { if (String.IsNullOrEmpty(model.TestMessage)) { model.TestSmsResult = "Enter test message"; } else { var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName("Mobile.SMS.Clickatell"); if (pluginDescriptor == null) throw new Exception("Cannot load the plugin"); var plugin = pluginDescriptor.Instance() as ClickatellSmsProvider; if (plugin == null) throw new Exception("Cannot load the plugin"); if (!plugin.SendSms(model.TestMessage)) { model.TestSmsResult = _localizationService.GetResource("Plugins.Sms.Clickatell.TestFailed"); } else { model.TestSmsResult = _localizationService.GetResource("Plugins.Sms.Clickatell.TestSuccess"); } } } catch(Exception exc) { model.TestSmsResult = exc.ToString(); } return View("Nop.Plugin.SMS.Clickatell.Views.SmsClickatell.Configure", model); }
public ActionResult Configure() { var model = new SmsClickatellModel(); model.PhoneNumber = _clickatellSettings.PhoneNumber; model.ApiId = _clickatellSettings.ApiId; model.Username = _clickatellSettings.Username; model.Password = _clickatellSettings.Password; return View("Nop.Plugin.SMS.Clickatell.Views.SmsClickatell.Configure", model); }
public ActionResult ConfigurePOST(SmsClickatellModel model) { if (!ModelState.IsValid) { return Configure(); } //save settings _clickatellSettings.PhoneNumber = model.PhoneNumber; _clickatellSettings.ApiId = model.ApiId; _clickatellSettings.Username = model.Username; _clickatellSettings.Password = model.Password; _settingService.SaveSetting(_clickatellSettings); return View("Nop.Plugin.SMS.Clickatell.Views.SmsClickatell.Configure", model); }