public static int AddToEmailQueue(string storeURI, string fromName, string fromEmail, string toName, string toEmail, string cc, string bcc, string subject, string body) { try { var dataContext = new TurnKeyBrokerSignUp.WebUI.Models.TurnKeyBrokerSignUpDataContext(); var _emailLog = new TurnKeyBrokerSignUp.WebUI.Models.EmailLog(); _emailLog.StoreURI = storeURI; _emailLog.FromName = fromName; _emailLog.FromEmail = fromEmail; _emailLog.ToName = toName; _emailLog.ToEmail = toEmail; _emailLog.CCEmail = cc; _emailLog.BCCEmail = bcc; _emailLog.Subject = subject; _emailLog.Body = body; _emailLog.isSent = false; _emailLog.date_created = DateTime.Now; dataContext.EmailLogs.InsertOnSubmit(_emailLog); dataContext.SubmitChanges(); dataContext.Dispose(); return(_emailLog.EmailLogID); } catch { } return(0); }
public static void UpdateEmailQueueStatus(int EmailLogID, bool isSent, string message) { try { var dataContext = new TurnKeyBrokerSignUp.WebUI.Models.TurnKeyBrokerSignUpDataContext(); var _emailLog = dataContext.EmailLogs.Where(em => em.EmailLogID == EmailLogID).FirstOrDefault(); if (_emailLog != null) { _emailLog.isSent = isSent; _emailLog.message = message; _emailLog.date_sent = DateTime.Now; dataContext.SubmitChanges(); } dataContext.Dispose(); } catch { } }