/// <summary> /// /// </summary> /// <param name="FileName"></param> /// <returns></returns> public static EventStatus DeleteFile(string FileName) { if (FileExists(FileName)) { try { File.Delete(FileName); return(EventStatus.Empty()); } catch (IOException ex) { return(new EventStatus(ex));// We couldn't delete the file. } } return(new EventStatus(new FileNotFoundException("File not found!"))); // file doesn't exist }
/// <summary> /// /// </summary> /// <param name="fromPath"></param> /// <param name="toPath"></param> /// <returns></returns> public static EventStatus CopyFile(string fromPath, string toPath) { if (FileExists(fromPath)) { try { File.Copy(fromPath, toPath, true); return(EventStatus.Empty()); } catch (IOException ex) { return(new EventStatus(ex));// We couldn't copy the file. } } return(new EventStatus(new FileNotFoundException("File not found!"))); // file doesn't exist }
/// <summary> /// Send email... /// </summary> /// <param name="message"></param> /// <param name="confirmationToken"></param> /// <returns></returns> public static EventStatus SendMail(MailMessage message) { message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; SmtpClient mailClient = new SmtpClient(); try { mailClient.Send(message); } catch (Exception ex) { return new EventStatus(ex); } return EventStatus.Empty(); }