예제 #1
0
        public ActionResult UploadResult()
        {
            UploadStatus status     = SlickUpload.GetUploadStatus();
            decimal      totalCount = (decimal)status.GetUploadedFiles().Count;

            if (status != null && status.State == UploadState.Complete && 0 < totalCount)
            {
                //Post Processing Step: Update Screen to 0% Done
                UpdateProgressBarOnScreen(status, 0, false);

                //At this point, we know the file has been uploaded to the server
                //I think we can just kick off an async process to do the rest.
                ProcessTask processTask = new ProcessTask(this.PostProcessVideo);
                processTask.BeginInvoke(status, totalCount, null, processTask);

                UpdateProgressBarOnScreen(status, COMPLETE_PERCENTAGE, true);
            }
            else
            {
                ErrorLogRepository errorRepos = new ErrorLogRepository();
                errorRepos.SaveErrorToDB(null, "Video upload had issues. Upload Status = " + status.State.ToString() + " totalCount = " + totalCount.ToString() + ": " + Environment.NewLine + status.Reason + Environment.NewLine + status.ErrorMessage, User.Identity.Name);

                return(View("UploadFiles", new VideoUploadFilesViewModel(User.Identity.Name, status)));
            }

            return(RedirectToAction("UploadPending", new { contentLength = status.ContentLength }));
        }
예제 #2
0
        public override void OnException(ExceptionContext filterContext)
        {
            Exception          ex = filterContext.Exception;
            ErrorLogRepository errorRepository = new ErrorLogRepository();

            errorRepository.SaveErrorToDB(ex, ex.Message + (ex.InnerException != null ? Environment.NewLine + ex.InnerException.Message : ""), filterContext.HttpContext.User.Identity.Name);

            base.OnException(filterContext);
        }
예제 #3
0
        internal static MailMessage GenerateMessageEmail(MessageRecipient msgRecip)
        {
            Console.WriteLine(String.Format("Sending an e-mail to {0} at {1}{2}", msgRecip.Profile.FirstName, msgRecip.Profile.Email, Environment.NewLine));

            try
            {
                MailMessage mail = new MailMessage();

                string firstName = msgRecip.Message.AppUser.Profile.FirstName;
                string lastName  = msgRecip.Message.AppUser.Profile.LastName;
                if (!String.IsNullOrEmpty(firstName) && !String.IsNullOrEmpty(lastName))
                {
                    mail.From = new MailAddress("*****@*****.**", string.Format("{0} {1}", firstName, lastName));
                }

                if (!string.IsNullOrEmpty(msgRecip.Profile.Email))
                {
                    mail.To.Add(msgRecip.Profile.Email);
                }
                if (!string.IsNullOrEmpty(msgRecip.Profile.EmailAlternate))
                {
                    mail.To.Add(msgRecip.Profile.EmailAlternate);
                }
                mail.Subject    = "You Have a Viternus Message Waiting for You";
                mail.IsBodyHtml = false;

                StringBuilder body = new StringBuilder();
                body.Append("Dear ");
                body.Append(String.IsNullOrEmpty(msgRecip.Profile.FirstName) ? "Recipient" : msgRecip.Profile.FirstName);
                body.Append(",");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("A message awaits you on the Viternus website, at the link below:");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("(Click the link to view the message)");
                body.Append(Environment.NewLine);
                body.Append(@"http://www.Viternus.com/Message/ViewMessageFromUrl/" + msgRecip.Id);
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);

                body.Append("This message has been sent by ");
                if (String.IsNullOrEmpty(firstName) && String.IsNullOrEmpty(lastName))
                {
                    body.Append(msgRecip.Message.AppUser.UserName);
                }
                else
                {
                    body.Append(firstName);
                    body.Append(" ");
                    body.Append(lastName);
                }
                body.Append(".  The message is not urgent, but he/she requests you view it at your earliest convenience.  If you are not ");
                if (String.IsNullOrEmpty(msgRecip.Profile.FirstName) && String.IsNullOrEmpty(msgRecip.Profile.LastName))
                {
                    body.Append("the owner of this email address");
                }
                else
                {
                    body.Append(msgRecip.Profile.FirstName);
                    body.Append(" ");
                    body.Append(msgRecip.Profile.LastName);
                }
                body.Append(", then please disregard this message.");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("Thank you,");
                body.Append(Environment.NewLine);
                body.Append("Viternus Webmaster");

                mail.Body = body.ToString();
                return(mail);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
                ErrorLogRepository errorRepos = new ErrorLogRepository();
                errorRepos.SaveErrorToDB(ex, "GenerateMessageMail failed", String.Empty);
                return(null);
            }
        }
예제 #4
0
        internal static MailMessage GenerateInnerCircleRequestEmail(InnerCircle trustee)
        {
            Console.WriteLine(String.Format("Sending an e-mail to {0} at {1}{2}", trustee.Profile.FirstName, trustee.Profile.Email, Environment.NewLine));

            try
            {
                MailMessage mail = new MailMessage();

                string firstName = trustee.AppUser.Profile.FirstName;
                string lastName  = trustee.AppUser.Profile.LastName;
                if (!String.IsNullOrEmpty(firstName) && !String.IsNullOrEmpty(lastName))
                {
                    mail.From = new MailAddress("*****@*****.**", string.Format("{0} {1}", firstName, lastName));
                }

                if (!string.IsNullOrEmpty(trustee.Profile.Email))
                {
                    mail.To.Add(trustee.Profile.Email);
                }
                if (!string.IsNullOrEmpty(trustee.Profile.EmailAlternate))
                {
                    mail.To.Add(trustee.Profile.EmailAlternate);
                }
                mail.Subject    = "You have been designated as a trustee";
                mail.IsBodyHtml = false;

                StringBuilder body = new StringBuilder();
                body.Append("Dear ");
                body.Append(String.IsNullOrEmpty(trustee.Profile.FirstName) ? "Trustee" : trustee.Profile.FirstName);
                body.Append(",");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append(firstName);
                body.Append(" ");
                body.Append(lastName);
                body.Append(" listed you as a Trustee in the Inner Circle.");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("With this designation comes the following responsibility:");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("- Immediate Action Required: Create your free account on Viternus.com");
                body.Append(Environment.NewLine);
                body.Append("- Immediate Action Required: Accept the responsiblity of being a trustee");
                body.Append(Environment.NewLine);
                body.Append("- Future Action Required: Should something happen to " + firstName + ", such as incapacitation or death, log in and notify Viternus via the 'I am a Trustee' link.");
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);

                //TODO: Right now we always assume the Inner Circle member needs a new account
                body.Append("To fulfill your responsibility, click the link below and create your account:");
                body.Append(Environment.NewLine);
                body.Append(@"http://www.Viternus.com/Account/Register?email=" + trustee.Profile.Email + "&userName="******"&ReturnUrl=%2fInnerCircle%2fMember");

                body.Append(Environment.NewLine);
                body.Append(Environment.NewLine);
                body.Append("Thank you,");
                body.Append(Environment.NewLine);
                body.Append("Viternus Webmaster");


                mail.Body = body.ToString();
                return(mail);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
                ErrorLogRepository errorRepos = new ErrorLogRepository();
                errorRepos.SaveErrorToDB(ex, "GenerateInnerCircleRequestEmail failed", String.Empty);
                return(null);
            }
        }