public ActionResult Create(Suggestion suggestion)
 {
     try
     {
         suggestion.SuggestByUserId = SessionData.UserId;
         SuggestionsLogic.InsertNewSuggestion(suggestion);
         if (SessionData.UserRole == UserRoles.Employee)
         {
             return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Employees/Index")));
         }
         else
         {
             return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Suggestions/Index")));
         }
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Suggestions/Create(Post)",
             Parameters = new JavaScriptSerializer().Serialize(suggestion)
         });
         return(PartialView("CreatePartial", suggestion));
     }
 }
 public ActionResult Suggest(CreateSuggestionModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             model.Suggestion.SuggestByUserId = SessionData.UserId;
             SuggestionsLogic.InsertNewSuggestion(model.Suggestion);
             return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Developer/Index")));
         }
         CreateSuggestionModel SuggestionModel = SuggestionsLogic.UpdateProjectsList(model);
         return(PartialView("SuggestPartial", SuggestionModel));
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Suggestions/Suggest(Post)",
             Parameters = new JavaScriptSerializer().Serialize(model)
         });
         return(PartialView("SuggestPartial", model));
     }
 }
 public ActionResult Delete(int id)
 {
     try
     {
         SuggestionsLogic.DeleteSuggestion(id);
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Suggestions/Delete",
             Parameters = "id=" + id
         });
         return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Create(StandUpMeetingDetails standUpMeetingDetails)
        {
            if (ModelState.IsValid)
            {
                StandUpMeeting model      = new StandUpMeeting();
                Suggestion     suggestion = new Suggestion();
                try
                {
                    standUpMeetingDetails.Name = SessionData.UserName;
                    model.Reading              = standUpMeetingDetails.Reading;
                    model.Suggestion           = standUpMeetingDetails.Suggestion;
                    model.TodayJob             = standUpMeetingDetails.TodayJob;
                    model.UserId               = SessionData.UserId;
                    model.YesterdayJob         = standUpMeetingDetails.YesterdayJob;
                    model.YesterdayObstruction = standUpMeetingDetails.YesterdayObstruction;
                    standUpMeetingDetails.Date = DateTimeHelper.Today();
                    StandUpMeetingsLogic.InsertNewStandUpMeeting(model);
                    EmailHelper.SendEmail(standUpMeetingDetails);

                    if (!string.IsNullOrWhiteSpace(model.Suggestion))
                    {
                        suggestion.CreateDate      = DateTimeHelper.Today();
                        suggestion.SuggestByUserId = SessionData.UserId;
                        suggestion.Title           = SessionData.UserName;
                        suggestion.Description     = model.Suggestion;
                        SuggestionsLogic.InsertNewSuggestion(suggestion);
                    }
                }
                catch (Exception e)
                {
                    LogsLogic.InsertLog(new Log()
                    {
                        Message    = e.Message,
                        StackTrace = e.StackTrace,
                        StoryName  = "ManagementProject/StandUpMeeting/Create"
                    });
                }

                return(RedirectToAction("Index"));
            }
            return(View(standUpMeetingDetails));
        }
        public ActionResult Suggest()
        {
            CreateSuggestionModel model = new CreateSuggestionModel();

            try
            {
                model = SuggestionsLogic.GetCreateSuggestionModel();
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Suggestions/Suggest",
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }

            return(PartialView("SuggestPartial", model));
        }
        public ActionResult SuggestionsList(int?pageNo)
        {
            var page = pageNo ?? 0;
            List <SuggestionUserDetails> model = new List <SuggestionUserDetails>();

            try
            {
                model = SuggestionsLogic.GetSuggestionsList(page);
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Suggestions/SuggestionsList",
                    Parameters = "& pageNo=" + page
                });
            }

            return(PartialView(model));
        }
        public ActionResult Details(int id)
        {
            Suggestion model = new Suggestion();

            try
            {
                model = SuggestionsLogic.GetSuggestionById(id);
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Suggestions/Details",
                    Parameters = "id=" + id
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }

            return(PartialView("DetailsPartial", model));
        }