Ejemplo n.º 1
0
        public ActionResult Send(FormCollection collection)
        {
            try
            {
                string           fileid = collection.GetValue("FieldId").AttemptedValue;
                int              fileId = Convert.ToInt32(fileid);
                PubSubRepository psr    = new PubSubRepository();
                FilesRepository  fr     = new FilesRepository();

                Models.File f   = fr.GetFile(fileId);
                FileSendTo  fst = new FileSendTo();

                string email   = collection.GetValue("Email").AttemptedValue;
                string message = collection.GetValue("Message").AttemptedValue;

                fst.Link    = f.Link;
                fst.Name    = f.Name;
                fst.OwnerFk = f.OwnerFk;
                fst.Message = message;
                fst.Email   = email;

                psr.AddToEmailQueue(fst);

                psr.DownloadEmailFromQueueAndSend();

                new LoggingRepository().Logging("File: " + f.Name + " Shared With: " + email + " At: " + DateTime.Now);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                new LoggingRepository().ErrorLogging(ex);
            }
            return(View());
        }
Ejemplo n.º 2
0
        // GET: Cron
        public ActionResult RunEveryMinute()
        {
            PubSubRepository psr = new PubSubRepository();

            psr.DownloadEmailFromQueueAndSend();

            return(Content("Sent"));
        }
 // GET: Cron
 public ActionResult RunEveryMinute()
 {
     try
     {
         PubSubRepository psr = new PubSubRepository();
         psr.DownloadEmailFromQueueAndSend();
         ViewBag.Message = "Email sent";
         LogsRepository lr = new LogsRepository();
         lr.WriteLogEntry("CRON was added");
     }
     catch (Exception ex)
     {
         LogsRepository lr = new LogsRepository();
         lr.LogError(ex);
     }
     return(Content("Sent"));
 }