Exemplo n.º 1
0
        public ActionResult PostToCoWorkerStream(Guid id, FormCollection formCollection)
        {
            if (string.IsNullOrEmpty(formCollection["StreamDetails"]))
            {
                TempData["errorMessage"] = "Yikes! Seems like you forgot to provide us with your valuable thoughts in the comments field. How about you try again?";
                return(RedirectToAction("Profile", "Home", new { id = id }));
            }

            StreamRepository streamRepository = new StreamRepository();
            Stream           stream           = new Stream();

            stream.StreamType                 = "WALLPOST";
            stream.StreamTargetUserId         = id;
            stream.StreamDetails              = formCollection["StreamDetails"];
            stream.StreamCreatorUserId        = UserHelpers.GetUserId(User.Identity.Name);
            stream.StreamCreatorFullName      = UserHelpers.GetUserFullName(User.Identity.Name);
            stream.StreamLastUpdatedTimeStamp = DateTime.UtcNow;
            stream.StreamCreatedTimeStamp     = DateTime.UtcNow;

            streamRepository.Add(stream);
            streamRepository.Save();

            new EmailNotificationHelpers().CoWorkerWallPostEmail(User.Identity.Name, id, stream.StreamId, stream.StreamDetails);

            //  TempData["message"] = "Your input was posted to " + stream.StreamCreatorFullName + " wall. We even went as far as notifiying the appropiate parties!.";
            return(RedirectToAction("Profile", "Home", new { id = id }));
        }
Exemplo n.º 2
0
        public ActionResult PostStatusStream(FormCollection formCollection)
        {
            if (string.IsNullOrEmpty(formCollection["StreamDetails"]))
            {
                TempData["errorMessage"] = "Yikes! Seems like you forgot to provide us with your valuable thoughts in the comments field. How about you try again?";
                return(RedirectToAction("Wall", "Home"));
            }

            StreamRepository streamRepository = new StreamRepository();
            Stream           stream           = new Stream();

            stream.StreamType                 = "STATUS";
            stream.StreamDetails              = formCollection["StreamDetails"];
            stream.StreamCreatorUserId        = UserHelpers.GetUserId(User.Identity.Name);
            stream.StreamCreatorFullName      = UserHelpers.GetUserFullName(User.Identity.Name);
            stream.StreamLastUpdatedTimeStamp = DateTime.UtcNow;
            stream.StreamCreatedTimeStamp     = DateTime.UtcNow;

            streamRepository.Add(stream);
            streamRepository.Save();

            // inform the poster friends of what has been posted
            new EmailNotificationHelpers().StatusPost(User.Identity.Name, stream.StreamId, stream.StreamDetails);

            return(RedirectToAction("Wall", "Home"));
        }
        public ActionResult Edit(int id, FormCollection formCollection)
        {
            Ticket ticket = ticketRepository.GetTicket(id);

            ticket.TicketStatus = "NEW";

            try
            {
                UpdateModel(ticket);
                ticketRepository.Save();


                StreamRepository streamRepository = new StreamRepository();
                Stream           stream           = new Stream();

                stream.StreamType                 = "STATUS";
                stream.StreamDetails              = ticket.TicketSubject;
                stream.StreamCreatorUserId        = UserHelpers.GetUserId(User.Identity.Name);
                stream.StreamCreatorFullName      = UserHelpers.GetUserFullName(User.Identity.Name);
                stream.StreamCreatedTimeStamp     = DateTime.UtcNow;
                stream.StreamLastUpdatedTimeStamp = DateTime.UtcNow;

                streamRepository.Add(stream);
                streamRepository.Save();

                // ActivityFeed got replaced by Stream

                //// Share this activity with your peers (abstract this code to the activityFeedRepository if possible)
                //ActivityFeedRepository activityFeedRepository = new ActivityFeedRepository();
                //ActivityFeed activityFeed = new ActivityFeed();

                //activityFeed.FeedActionCreatorUserId = UserHelpers.GetUserId(User.Identity.Name);
                //activityFeed.FeedActionDescription = "Updated ticket #" + ticket.TicketId;

                //int stringLenth = ticket.TicketDescription.Length;
                //if (stringLenth > 180) { activityFeed.FeedActionDetails = ticketRepository.GetTicket(id).TicketDescription.Substring(0, 179); }
                //else { activityFeed.FeedActionDetails = ticketRepository.GetTicket(id).TicketDescription.Substring(0, stringLenth); }


                //activityFeed.FeedActionTimeStamp = DateTime.UtcNow;

                ////TODO: Update code below to dynamically determine the Url
                //activityFeed.FeedMoreUrl = "/BetterTaskList/Tickets/Ticket/Details/" + ticket.TicketId;

                //activityFeedRepository.Add(activityFeed);
                //activityFeedRepository.Save();

                TempData["message"] = "Ticket #" + ticket.TicketId + " changes have been successfully saved. We also went ahead and notified the proper parties involved.";
                return(RedirectToAction("ByCreators", "Ticket"));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void ShareNewTicketStream(Ticket ticket)
        {
            StreamRepository streamRepository = new StreamRepository();
            Stream           stream           = new Stream();

            stream.StreamType                 = "STATUS";
            stream.StreamDetails              = "Submitted Ticket #" + ticket.TicketId + ": " + ticket.TicketSubject;
            stream.StreamCreatorUserId        = UserHelpers.GetUserId(HttpContext.Current.User.Identity.Name);
            stream.StreamCreatorFullName      = UserHelpers.GetUserFullName(HttpContext.Current.User.Identity.Name);
            stream.StreamCreatedTimeStamp     = DateTime.UtcNow;
            stream.StreamLastUpdatedTimeStamp = DateTime.UtcNow;

            streamRepository.Add(stream);
            streamRepository.Save();
        }