public ActionResult Evaluate(int standUpMeetingId, int standUpMeetingUserId, int yasterdayJobDegree, int todayJobDegree, int readingDegree, int suggestionDegree)
 {
     try
     {
         yasterdayJobDegree = yasterdayJobDegree > 0 ? yasterdayJobDegree : 0;
         todayJobDegree     = todayJobDegree > 0 ? todayJobDegree : 0;
         readingDegree      = readingDegree > 0 ? readingDegree : 0;
         suggestionDegree   = suggestionDegree > 0 ? suggestionDegree : 0;
         StandUpMeetingDetails standUpMeetingDetails = new StandUpMeetingDetails()
         {
             UserId             = standUpMeetingUserId,
             Id                 = standUpMeetingId,
             YasterdayJobDegree = yasterdayJobDegree,
             TodayJobDegree     = todayJobDegree,
             ReadingDegree      = readingDegree,
             SuggestionDegree   = suggestionDegree,
             TotalDegree        = yasterdayJobDegree + todayJobDegree + readingDegree
         };
         StandUpMeetingsLogic.EvaluateStandUpMeeting(standUpMeetingDetails);
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Evaluate/History"
         });
     }
     return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/StandUpMeet/Index")));
 }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            try
            {
                if (SessionData.UserRole == UserRoles.Employee)
                {
                    Attendance attendance = AttendancesLogic.GetLastSignByUserId(SessionData.UserId);
                    if (attendance == null)
                    {
                        DateTime serverTime = DateTimeHelper.Today();
                        if (serverTime.Hour >= 12)
                        {
                            return(RedirectToAction("Index", "Employees"));
                        }
                        else
                        {
                            return(RedirectToAction("UserSign", "Attendances"));
                        }
                    }
                    List <StandUpMeetingDetails> model = StandUpMeetingsLogic.GetTodayStandUpMeeting(SessionData.UserId);
                    if (model.Count == 0)
                    {
                        return(RedirectToAction("Create", "StandUpMeet"));
                    }
                    return(RedirectToAction("Index", "Employees"));
                }
                else
                {
                    HomeIndexModel model = new HomeIndexModel();
                    model.Projects = ProjectsLogic.GetProjectlist();

                    List <Sprint> sprints = SprintsLogic.GetAllSprints();
                    model.PreviousSprint = sprints.FindLast(a => a.PreviousSprint);
                    model.CurrentSprint  = sprints.Find(a => a.CurrentSprint);
                    model.FutureSprint   = sprints.Find(a => a.FutureSprint);

                    model.CanCreateSprint = !sprints.Any(a => a.FutureSprint);
                    return(View(model));
                }
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Projects/GetProjectlist",
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }
        }
        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 History()
        {
            //Story mm = new Story();
            StandUpMeetingMonthlyHistoryModel model = new StandUpMeetingMonthlyHistoryModel();

            try
            {
                model = StandUpMeetingsLogic.GetMonthlyHistory(SessionData.UserId);
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/StandUpMeeting/History"
                });
            }
            return(View(model));
        }
        public ActionResult MissedStandUpMeetings()
        {
            List <StandUpMeetingDetails> model = new List <StandUpMeetingDetails>();

            try
            {
                model = StandUpMeetingsLogic.GetMissedStandUpMeetingList();
                List <StandUpMeetingDetails> helperList = model.Where(x => x.TotalDegree < 0).ToList();
                helperList.AddRange(model.Where(x => x.TotalDegree >= 0).OrderByDescending(x => x.TotalDegree).ToList());
                model = helperList;
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/StandUpMeeting/Index"
                });
            }
            return(View(model));
        }
        public ActionResult MonthlyStandUpMeetings(int userId)
        {
            StandUpMeetingMonthlyHistoryModel model = new StandUpMeetingMonthlyHistoryModel();

            try
            {
                UserProfile user = UserProfilesLogic.GetUserById(userId);
                model.StandUpMeetingDetailsList = StandUpMeetingsLogic.GetStandUpMeetingList(userId);
                model.FirstName = user.FirstName;
                model.LastName  = user.LastName;
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/StandUpMeeting/MonthlyStandUpMeetings"
                });
            }
            return(View(model));
        }
        public ActionResult SignIn(string latitude = "", string longitude = "")
        {
            try
            {
                Attendance attendancee = new Attendance();

                DateTime signInDate = DateTimeHelper.Today();
                if (signInDate != null)
                {
                    signInDate = DateTimeHelper.Today();
                }
                else
                {
                    return(RedirectToAction("UserSign", "Attendances", new { ErrorMessage = "Error in Time Server Connection", parameter = "" }));
                }

                if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude) && signInDate.Hour < 12)
                {
                    Attendance attendance = new Attendance()
                    {
                        EmpUserId  = SessionData.UserId,
                        SignInDate = signInDate,
                        Latitude   = latitude,
                        Longitude  = longitude
                    };
                    AttendancesLogic.InsertNewAttendance(attendance);
                    ActionRate actionRate = ActionRatesLogic.GetActionRateByName("Sign In");
                    EmployeePointsLogic.InsertNewEmployeePoint(new EmployeePoint()
                    {
                        ActionRateId = actionRate.Id,
                        Date         = DateTime.Now,
                        UserId       = attendance.EmpUserId,
                        Rate         = actionRate.MaxRate
                    });
                }
                else if (signInDate.Hour >= 12)
                {
                    LogsLogic.InsertLog(new Log()
                    {
                        Message    = "this User breake the client side validation and try to signin within not correct time or maybe change his system time by mistck",
                        StackTrace = "",
                        Parameters = "user id = " + SessionData.UserId + " and username = "******"ManagementProject/Attendances/SignIn"
                    });
                    return(RedirectToAction("UserSign", "Attendances", new { errorMessage = "Your Time System is not Correct!" }));
                }
                else if (string.IsNullOrEmpty(latitude) || string.IsNullOrEmpty(longitude))
                {
                    LogsLogic.InsertLog(new Log()
                    {
                        Message    = "this User breake the client side validation and try to signin within not correct geoLocation or maybe something was wrong happened!",
                        StackTrace = "",
                        Parameters = "user id = " + SessionData.UserId + " and username = "******"SignIn"
                    });
                    return(RedirectToAction("UserSign", "Attendances", new { errorMessage = "Please check Location Permissions to allow to Signin!" }));
                }
                List <StandUpMeetingDetails> model = StandUpMeetingsLogic.GetTodayStandUpMeeting(SessionData.UserId);
                if (model.Count == 0)
                {
                    return(RedirectToAction("Create", "StandUpMeet"));
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception e)
            {
                LogsLogic.InsertLog(new Log()
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    StoryName  = "ManagementProject/Attendances/SignIn"
                });
                return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond }));
            }
        }
        public ActionResult Details(int standUpMeetingId)
        {
            StandUpMeetingDetails standUpMeetingDetails = StandUpMeetingsLogic.GetStandUpMeeting(standUpMeetingId);

            return(PartialView(standUpMeetingDetails));
        }