protected void AcceptClicked(object o, EventArgs e) { var g = new HRR.Core.Domain.Goal(); g = CurrentGoal; g.IsAccepted = true; new GoalServices().Save(g); //lbAccept.Visible = false; Response.Redirect(SecurityContextManager.Current.CurrentURL); }
protected void SaveGoal() { var g = new HRR.Core.Domain.Goal(); string emails = ""; if (g.Managers.Count > 0) { foreach (var m in g.Managers) { emails += m.PersonRef.Email + ","; } } if (CurrentGoal == null) { var r = new ReviewServices().GetEmployeeActiveReview(CurrentProfile.ID); g.DateCreated = DateTime.Now; g.Description = tbDescription.Text; g.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID; g.DueDate = (DateTime)tbDueDate.SelectedDate; g.EnteredBy = SecurityContextManager.Current.CurrentUser.ID; g.EnteredFor = CurrentProfile.ID; g.GoalType = 3; g.ReviewID = r.ID; g.Score = Convert.ToInt16(rsQuestion.SelectedValue); g.StatusID = (int)GoalStatus.ACCEPTED; g.Progress = CalculateProgress(); g.IsAccepted = true; g.IsApproved = true; g.Title = tbTitle.Text; new GoalServices().Save(g); var a = new Activity(); a.AccountID = CurrentProfile.AccountID; a.URL = "/Goals/" + g.ID.ToString(); a.ActivityType = (int)ActivityType.NEW_GOAL; a.DateCreated = DateTime.Now; a.PerformedBy = SecurityContextManager.Current.CurrentUser.ID; a.PerformedFor = CurrentProfile.ID; new ActivityServices().Save(a); EmailHelper.SendNewGoalNotification(g, emails); } else { g = CurrentGoal; g.Description = tbDescription.Text; g.DueDate = (DateTime)tbDueDate.SelectedDate; g.Score = Convert.ToInt16(rsQuestion.SelectedValue); g.Progress = CalculateProgress(); g.Title = tbTitle.Text; g.GoalType = 3; g.Weight = Convert.ToInt16(tbWeight.Text); new GoalServices().Save(g); var a = new Activity(); a.AccountID = CurrentProfile.AccountID; a.ActivityType = (int)ActivityType.GOAL_UPDATED; a.DateCreated = DateTime.Now; a.URL = "/Goals/" + g.ID.ToString(); a.PerformedBy = SecurityContextManager.Current.CurrentUser.ID; a.PerformedFor = CurrentProfile.ID; new ActivityServices().Save(a); EmailHelper.SendGoalUpdateNotification(g, emails); } Response.Redirect("/Goals/" + g.ID.ToString()); }