public BaseController(ISystemConfigurationService systemConfigurationService, ICategoryService categoryService) { _systemConfigurationService = systemConfigurationService; _categoryService = categoryService; if (_systemConfigurationService != null) { ViewBag.CouncilTitle = _systemConfigurationService.GetSystemConfigurations().CouncilName;//ConfigurationManager.AppSettings["CouncilName"]; ViewBag.CouncilUrl = _systemConfigurationService.GetSystemConfigurations().CouncilUrl; ViewBag.AnalyticsTrackingRef = _systemConfigurationService.GetSystemConfigurations().AnalyticsTrackingRef; } }
public static DataTable AppendBody(this DataTable table, ISystemConfigurationService systemConfigurationService) { var bodyName = String.Format("'{0}'", systemConfigurationService.GetSystemConfigurations().CouncilName); var bodyUri = String.Format("'{0}'", systemConfigurationService.GetSystemConfigurations().CouncilUri); table = table ?? new DataTable(); var colBody = table.Columns.Add("PublisherLabel", typeof(String), bodyName); colBody.SetOrdinal(0); var colUri = table.Columns.Add("PublisherURI", typeof(String), bodyUri); colUri.SetOrdinal(1); return(table); }
public ViewControllerData VisualiseSchemaAsMap(IList <FilterCriteria> filter, DataSetSchema schema) { var data = _dataSetDetailSqlRepo.ExecuteQueryVisualiseSchemaMap(_repository.DbConnectionString, filter, schema); return(new ViewControllerData { Data = data.Tables[0], Count = Convert.ToInt32(data.Tables[1].Rows[0].ItemArray[0]), MapCentreLatitude = Convert.ToDouble(_systemConfigurationService.GetSystemConfigurations().MapCentreLatitude), MapCentreLongitude = Convert.ToDouble(_systemConfigurationService.GetSystemConfigurations().MapCentreLongitude), MapDefaultZoom = Convert.ToInt16(_systemConfigurationService.GetSystemConfigurations().MapDefaultZoom), SpatialGeographyUri = _systemConfigurationService.GetSystemConfigurations().CouncilSpatialUri }); }
// // GET: /Admin/SystemConfig/ public ActionResult Index() { var model = new SystemConfigurationViewModel() { ConfigurationObject = _systemConfigurationService.GetSystemConfigurations() }; return(View(model)); }
public string SendEmail(string recipientemail, string subject, string body, string returnemail) { var client = new SmtpClient { DeliveryMethod = SmtpDeliveryMethod.Network }; var systemObject = _systemConfigurationService.GetSystemConfigurations(); if (!string.IsNullOrEmpty(systemObject.SmtpServer)) { client.Host = systemObject.SmtpServer; } if (string.IsNullOrEmpty(systemObject.SmtpUsername) && string.IsNullOrEmpty(systemObject.SmtpPassword)) { var oCredential = new NetworkCredential("", ""); client.UseDefaultCredentials = false; client.Credentials = oCredential; } else { client.Credentials = new NetworkCredential(systemObject.SmtpUsername, systemObject.SmtpPassword); } ////if (attachments != null && attachments.Count > 0) ////{ //// foreach (var a in attachments) //// { //// message.Attachments.Add(a); //// } ////} try { var message = new MailMessage(returnemail, recipientemail, subject, body) { IsBodyHtml = true, }; client.Send(message); return("Email sent!"); } catch (Exception ex) { Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex)); return(ex.Message); } }
private string FormatAndSendContact(Contact contact) { if (_systemConfigService == null) { return(""); } var recipientEmail = _systemConfigService.GetSystemConfigurations().SendEmailForFeedback; if (string.IsNullOrEmpty(recipientEmail)) { return(""); } var sb = new StringBuilder(); sb.Append("The following message was submitted from the DataShare Contact us page\r\n<br/>"); sb.Append("From: " + contact.FromEmail + "\r\n<br/>"); sb.Append("Name: " + contact.FromName + "\r\n<br/>"); sb.Append("Message: \r\n<br/><p>" + contact.Message + "</p>\r\n<br/>"); return(_emailService.SendEmail(recipientEmail, "DataShare Feedback", sb.ToString(), contact.FromEmail)); }