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"))); }
public static void SendEmail(StandUpMeetingDetails meeting) { try { MailMessage mailMessage = new MailMessage(); SmtpClient client = new SmtpClient(); mailMessage.Subject = "Stand Up Meeting"; mailMessage.Body = CreateEmailHeader(meeting); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.To.Add("*****@*****.**");// [email protected] mailMessage.IsBodyHtml = true; client.Host = "email-smtp.us-east-1.amazonaws.com"; NetworkCredential authenticationinfo = new NetworkCredential("AKIAJK7TYL5LTR7EXAGQ", "AhmWUM2gmBG7jGvjY3WWLpmKjaWGm2mLUdWhAx98pPjU"); client.Port = int.Parse("587"); client.EnableSsl = true; client.UseDefaultCredentials = true; client.Credentials = authenticationinfo; client.DeliveryMethod = SmtpDeliveryMethod.Network; mailMessage.BodyEncoding = Encoding.UTF8; client.Send(mailMessage); } catch (Exception ex) { LogsLogic.InsertLog(new Log() { Message = ex.Message, StackTrace = ex.StackTrace, StoryName = "Fail to send message to " }); } }
public static StandUpMeetingDetails GetStandUpMeeting(int standUpMeetingId) { using (ManagementSystemEntities db = new ManagementSystemEntities()) { StandUpMeetingDetails standUpMeetingDetails = (from standUpMeetings in db.StandUpMeetings join userProfiles in db.UserProfiles on standUpMeetings.UserId equals userProfiles.UserId where ( standUpMeetings.Id == standUpMeetingId ) select new StandUpMeetingDetails { Date = standUpMeetings.Date, Id = standUpMeetings.Id, Name = userProfiles.UserName, Reading = standUpMeetings.Reading, Suggestion = standUpMeetings.Suggestion, TodayJob = standUpMeetings.TodayJob, UserId = standUpMeetings.UserId, YesterdayJob = standUpMeetings.YesterdayJob, YesterdayObstruction = standUpMeetings.YesterdayObstruction, Image = userProfiles.ProfilePictureUrl, TotalDegree = standUpMeetings.TotalDegree, YasterdayJobDegree = standUpMeetings.YesterdayJobDegree, TodayJobDegree = standUpMeetings.TodayJobDegree, ReadingDegree = standUpMeetings.ReadingDegree, SuggestionDegree = standUpMeetings.SuggestionDegree, StandUpEmployeePointId = standUpMeetings.StandUpEmployeePointId, SuggestionEmployeePointId = standUpMeetings.SuggestionEmployeePointId }).FirstOrDefault(); return(standUpMeetingDetails); } }
public static void EvaluateStandUpMeeting(StandUpMeetingDetails standUpMeetingDetails) { using (ManagementSystemEntities db = new ManagementSystemEntities()) { StandUpMeeting standUpMeeting = db.StandUpMeetings.SingleOrDefault(x => x.Id == standUpMeetingDetails.Id); if (standUpMeeting != null) { standUpMeeting.YesterdayJobDegree = standUpMeetingDetails.YasterdayJobDegree; standUpMeeting.TodayJobDegree = standUpMeetingDetails.TodayJobDegree; standUpMeeting.ReadingDegree = standUpMeetingDetails.ReadingDegree; standUpMeeting.SuggestionDegree = standUpMeetingDetails.SuggestionDegree; standUpMeeting.TotalDegree = standUpMeetingDetails.TotalDegree; standUpMeeting.StandUpEmployeePointId = standUpMeetingDetails.StandUpEmployeePointId; standUpMeeting.SuggestionEmployeePointId = standUpMeetingDetails.SuggestionEmployeePointId; db.SaveChanges(); } } }
public static void EvaluateStandUpMeeting(StandUpMeetingDetails standUpMeetingDetails) { ActionRate actionRateStandUp = ActionRatesRepositories.GetActionRateByName("Stand Up Meeting"); EmployeePoint standUpEmployeePoint = new EmployeePoint { ActionRateId = actionRateStandUp.Id, Date = DateTimeHelper.Today(), UserId = standUpMeetingDetails.UserId, Rate = standUpMeetingDetails.TotalDegree }; if (standUpMeetingDetails.StandUpEmployeePointId > 0) { standUpEmployeePoint.Id = standUpMeetingDetails.StandUpEmployeePointId; EmployeePointsRepositories.UpdateEmployeePoint(standUpEmployeePoint); } else { EmployeePointsRepositories.InsertNewEmployeePoint(standUpEmployeePoint); standUpMeetingDetails.StandUpEmployeePointId = standUpEmployeePoint.Id; } ActionRate actionRateSuggestion = ActionRatesRepositories.GetActionRateByName("Suggestion Bonus"); EmployeePoint suggestionEmployeePoint = new EmployeePoint { ActionRateId = actionRateSuggestion.Id, Date = DateTimeHelper.Today(), UserId = standUpMeetingDetails.UserId, Rate = standUpMeetingDetails.SuggestionDegree }; if (standUpMeetingDetails.SuggestionEmployeePointId > 0) { suggestionEmployeePoint.Id = standUpMeetingDetails.SuggestionEmployeePointId; EmployeePointsRepositories.UpdateEmployeePoint(suggestionEmployeePoint); } else { EmployeePointsRepositories.InsertNewEmployeePoint(suggestionEmployeePoint); standUpMeetingDetails.SuggestionEmployeePointId = suggestionEmployeePoint.Id; } StandUpMeetingRepository.EvaluateStandUpMeeting(standUpMeetingDetails); }
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 Details(int standUpMeetingId) { StandUpMeetingDetails standUpMeetingDetails = StandUpMeetingsLogic.GetStandUpMeeting(standUpMeetingId); return(PartialView(standUpMeetingDetails)); }
public static string CreateEmailHeader(StandUpMeetingDetails meeting) { string emailFormat = "<div class=\"col-sm-8 col-sm-offset-4 col-lg-10 col-lg-offset-2 main\"><div class=\"email\" style=\" background-color:##D3D3D3; width:70%;min-hight:500px;margin:0px auto; margin-top:30px;-webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);-moz-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);-o-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);border-radius: 5px;padding: 10px;\"><div style = \" width:80%;margin:0px auto;\"><!-- email header --><h4 style = \" float:left;\"> " + meeting.Name + " </h4><span style = \" float:right;font-weight: bold;\">" + meeting.Date.Value.ToShortDateString() + "</span></div><br/><br/><div style = \"width:90%;margin:0px auto;\"><!-- email body --><div><br /><br /><label> Yesterday Job : </label> <span> " + meeting.YesterdayJob + "</span><br/><label> Today Job : </label> <span> " + meeting.TodayJob + "</span><br/><label> Problem : </label> <span> " + meeting.YesterdayObstruction + "</span><br/><label> Reading : </label> <span> " + meeting.Reading + "</span><br/><label> Suggestion : </label> <span> " + meeting.Suggestion + "</span></div></div></div></div> "; return(emailFormat); }