public bool Update(SystemSettingsExt model, ref string Msg, ref string MsgCss, Controller ctrl) { bool status = true; try { //TODO: Map to DB Object var dbmodel = db.SystemSettings.FirstOrDefault(m => m.SystemSettingID == model.SystemSettingID); //TODO: Update DB Changes MapForUpdate(ref dbmodel, model); SaveDBChanges(); //TOD: Add to Audit Log AuditLog("Updated System Settings", ctrl); //To get here, everything must be OK, so commit the transaction Msg = "System Settings updated Successfully"; MsgCss = "alert alert-success"; } catch (System.Exception ex) { Msg = "Unexpected Error occurred: Error = " + ex.Message; MsgCss = "alert alert-danger"; } return(status); }
private SystemSettingsExt Map(SystemSettings model) { SystemSettingsExt m = new SystemSettingsExt() { SystemSettingID = model.SystemSettingID, EmailsEnabled = model.EmailsEnabled, SendTempEmail = model.SendTempEmail, SupportEmailAddress = model.SupportEmailAddress, TempEmailAddress = model.TempEmailAddress, CurrentDomain = model.CurrentDomain, AdminEmailAddress = model.AdminEmailAddress, GoCardless_Mode = model.GoCardless_Mode, GoCardless_APIUrlLive = model.GoCardless_APIUrlLive, GoCardless_TokenUrlLive = model.GoCardless_TokenUrlLive, GoCardless_ClientIDLive = model.GoCardless_ClientIDLive, GoCardless_ClientSecretLive = model.GoCardless_ClientSecretLive, GoCardless_TokenLive = model.GoCardless_TokenLive, GoCardless_APIUrlSandbox = model.GoCardless_APIUrlSandbox, GoCardless_TokenUrlSandbox = model.GoCardless_TokenUrlSandbox, GoCardless_ClientIDSandbox = model.GoCardless_ClientIDSandbox, GoCardless_ClientSecretSandbox = model.GoCardless_ClientSecretSandbox, GoCardless_TokenSandbox = model.GoCardless_TokenSandbox, GoCardless_WebhookIDSandbox = model.GoCardless_WebhookIDSandbox, GoCardless_WebhookIDLive = model.GoCardless_WebhookIDLive, RegFeeWithBook = model.RegFeeWithBook, RegFeeWithoutBook = model.RegFeeWithoutBook, PayPal_Mode = model.PayPal_Mode, PayPalServerURL_Live = model.PayPalServerURL_Live, BusinessEmail_Live = model.BusinessEmail_Live, NotifyURL_IPN_Live = model.NotifyURL_IPN_Live, ReturnURL_Live = model.ReturnURL_Live, PayPalServerURL_SandBox = model.PayPalServerURL_SandBox, BusinessEmail_SandBox = model.BusinessEmail_SandBox, NotifyURL_IPN_SandBox = model.NotifyURL_IPN_SandBox, ReturnURL_SandBox = model.ReturnURL_SandBox, ResetLeagueWeightLoss = model.ResetLeagueWeightLoss, DownForMaintenance = model.DownForMaintenance, DownForMaintenance_Timer = model.DownForMaintenance_Timer, ReferralCandy_AccessID = model.ReferralCandy_AccessID, ReferralCandy_SecreteKey = model.ReferralCandy_SecreteKey, PremiumDashboardFee = model.PremiumDashboardFee, Enable_MobileVerification = model.Enable_MobileVerification }; return(m); }
public string GenerateHtml_EmergencyContactDetails(SystemSettingsExt sys, PlayersExt player) { string html = ""; if (string.IsNullOrEmpty(player.Emergency_ContactName) || string.IsNullOrEmpty(player.Emergency_ContactPhone)) { string EncryptedEmail = SecurityUtils.EncryptText(player.EmailAddress); string _EmergencyContactPageLink = sys.CurrentDomain + "/Home/EmergencyContact?p=" + EncryptedEmail; html = "<h2 style='color:red;'>Emergency Contact Details:</h2>" + "<p> As agreed in your terms and conditions all players are required to provide a contact in case of illness or injury. Fill in the form at" + "<a target = '_blank' href = '" + _EmergencyContactPageLink + "'> this link </a> and hit Submit to enable us to finalise your registration. Please ignore this if you've already submitted your Emergency Contact Details.</p>"; } return(html); }
private void MapForUpdate(ref SystemSettings dbmodel, SystemSettingsExt model) { dbmodel.SystemSettingID = model.SystemSettingID; dbmodel.EmailsEnabled = model.EmailsEnabled; dbmodel.SendTempEmail = model.SendTempEmail; dbmodel.SupportEmailAddress = model.SupportEmailAddress; dbmodel.TempEmailAddress = model.TempEmailAddress; dbmodel.CurrentDomain = model.CurrentDomain; dbmodel.AdminEmailAddress = model.AdminEmailAddress; dbmodel.GoCardless_Mode = model.GoCardless_Mode; dbmodel.GoCardless_APIUrlLive = model.GoCardless_APIUrlLive; dbmodel.GoCardless_TokenUrlLive = model.GoCardless_TokenUrlLive; dbmodel.GoCardless_ClientIDLive = model.GoCardless_ClientIDLive; dbmodel.GoCardless_ClientSecretLive = model.GoCardless_ClientSecretLive; dbmodel.GoCardless_APIUrlSandbox = model.GoCardless_APIUrlSandbox; dbmodel.GoCardless_TokenUrlSandbox = model.GoCardless_TokenUrlSandbox; dbmodel.GoCardless_ClientIDSandbox = model.GoCardless_ClientIDSandbox; dbmodel.GoCardless_ClientSecretSandbox = model.GoCardless_ClientSecretSandbox; dbmodel.GoCardless_TokenLive = model.GoCardless_TokenLive; dbmodel.GoCardless_TokenSandbox = model.GoCardless_TokenSandbox; dbmodel.GoCardless_WebhookIDSandbox = model.GoCardless_WebhookIDSandbox; dbmodel.GoCardless_WebhookIDLive = model.GoCardless_WebhookIDLive; dbmodel.RegFeeWithBook = model.RegFeeWithBook; dbmodel.RegFeeWithoutBook = model.RegFeeWithoutBook; dbmodel.PremiumDashboardFee = model.PremiumDashboardFee; dbmodel.PayPal_Mode = model.PayPal_Mode; dbmodel.PayPalServerURL_Live = model.PayPalServerURL_Live; dbmodel.BusinessEmail_Live = model.BusinessEmail_Live; dbmodel.NotifyURL_IPN_Live = model.NotifyURL_IPN_Live; dbmodel.ReturnURL_Live = model.ReturnURL_Live; dbmodel.PayPalServerURL_SandBox = model.PayPalServerURL_SandBox; dbmodel.BusinessEmail_SandBox = model.BusinessEmail_SandBox; dbmodel.NotifyURL_IPN_SandBox = model.NotifyURL_IPN_SandBox; dbmodel.ReturnURL_SandBox = model.ReturnURL_SandBox; dbmodel.ResetLeagueWeightLoss = model.ResetLeagueWeightLoss; dbmodel.DownForMaintenance = model.DownForMaintenance; dbmodel.DownForMaintenance_Timer = model.DownForMaintenance_Timer; dbmodel.ReferralCandy_AccessID = model.ReferralCandy_AccessID; dbmodel.ReferralCandy_SecreteKey = model.ReferralCandy_SecreteKey; }
//Red/Amber Flag Alert Emails private MandrillError SendMessage(dynamic sendParams, SystemSettingsExt sys) { if (sys.EmailsEnabled) { sendParams.key = "LMPoi1kWRMJJQMWCHFsJIQ"; //"Z46-URL8pJppuh8Hv5Ff3A"; sendParams.message.from_email = sys.AdminEmailAddress; // "*****@*****.**"; sendParams.message.from_name = "MANvFAT Football"; if (sys.SendTempEmail) { sendParams.message.to[0].email = sys.TempEmailAddress; sendParams.message.to[0].name = "MVFF Test Email"; } ILog _log = log4net.LogManager.GetLogger("Mandrill/SendMessage"); string url = MandrillBaseUrl + "/messages/send-template.json"; var http = new HttpClient { Request = { Accept = HttpContentTypes.ApplicationJson } }; EasyHttp.Http.HttpResponse response; try { response = http.Post(url, sendParams, HttpContentTypes.ApplicationJson); } catch (WebException ex) { ErrorHandling.HandleException(ex); _log.ErrorFormat("Error: WebException - {0}", ex.Message); return(MandrillError.WebException); } if (response.StatusCode != HttpStatusCode.OK) { _log.InfoFormat("Response = {0} - {1}", response.StatusCode, response.StatusDescription); _log.Info(response.RawText); SecurityUtils.AddAuditLog("Mandrill Email Error", "Rejected: " + response.RawText); return(MandrillError.HttpNotOk); } dynamic rv = response.DynamicBody; string msgResponse = string.Format("email: {0}, status: {1}", rv[0].email, rv[0].status); _log.InfoFormat(msgResponse); SecurityUtils.AddAuditLog("Mandrill Email Info", "Info: " + msgResponse); string send_status = rv[0].status; if (send_status == "sent" || send_status == "queued") { //SecurityUtils.AddAuditLog("Mandrill Email Success", "send_status = " + send_status); return(MandrillError.OK); } // otherwise, it should be "rejected" or "invalid" if (send_status == "invalid") { return(MandrillError.Invalid); } if (send_status == "rejected") { return(MandrillError.Rejected); } // unexpected... return(MandrillError.Unknown); } else { SecurityUtils.AddAuditLog("Mandrill Email Failed", "Emails are Disabled from System Settings"); return(MandrillError.Unknown); } }