public void AddContactMessage(ContactUs contact) { if (contact != null) { EmailNotification email = new EmailNotification(); email._name_user = contact.Name; email._email_user = contact.Email; email._body = contact.Message; email._subject = "Автостоп"; new Task(() => email.SendEmail()).Start(); contact.Date = DateTime.Now; db.Contact.Add(contact); db.SaveChanges(); } }
private static void ParserCore() { Log log = new Log(); try { log.LogDate = DateTime.Now; log.FileName = Path.GetFileName(file); xEmp = XElement.Load(file); ns = xEmp.GetDefaultNamespace(); log.FileName += " (Size:" + new FileInfo(file).Length / 1024 + "KB)"; var analogs = ANet.InsertAnalogToDb(GetAnalogFromXml()); log.Message = analogs; var parts = ANet.InsertPartToDb(GetPartsFromXml()); log.Message += parts; GetExchangeRateFromXml(); } catch (Exception ex) { log.Message += ex.Message; EmailNotification email = new EmailNotification(); email._name_user = "******"; email._body = ex.Message; email._subject = "Автостоп"; new Task(() => email.SendEmail()).Start(); } finally { isStart = false; try { db = new WorkWithData(); db.AddLog(log); }catch (Exception ex) { log.Message = ex.Message; } } }