new public Recurrent Get(long id) { var entity = Connection.Query <Recurrent>(String.Format("SELECT * FROM {0} where Id = @id", EntityTableSchema), new { id }).SingleOrDefault(); if (entity == null) { return(null); } entity.Goal = _goalRepository.Get(entity.Id, GoalEntityType.Recurrent); return(entity); }
new public Saving Get(long id) { var entity = Connection.Query <Saving>(String.Format("SELECT * FROM {0} where Id = @id", EntityTableSchema), new { id }).SingleOrDefault(); if (entity == null) { return(null); } entity.Goal = _goalRepository.Get(entity.Id, GoalEntityType.Saving); //var reason = _catalogRepository.Get(Catalogs.SAVING_TYPE, entity.ReasonTypeId); return(entity); }
public IEnumerable <ValidationResult> CanAddGoal(Goal newGoal, IUpdateService updateService) { Goal goal; if (newGoal.GoalId == 0) { goal = _goalRepository.Get(g => g.GoalName == newGoal.GoalName); } else { goal = _goalRepository.Get(g => g.GoalName == newGoal.GoalName && g.GoalId != newGoal.GoalId); } if (goal != null) { yield return(new ValidationResult("GoalName", Resources.GoalExists)); } if (newGoal.StartDate.Subtract(newGoal.EndDate).TotalSeconds > 0) { yield return(new ValidationResult("EndDate", Resources.EndDate)); } int flag = 0; int status = 0; if (newGoal.GoalId != 0) { var updates = updateService.GetUpdatesByGoal(newGoal.GoalId).OrderByDescending(g => g.UpdateDate).ToList(); if (updates.Any()) { if ((updates[0].UpdateDate.Subtract(newGoal.EndDate).TotalSeconds > 0)) { flag = 1; } if ((newGoal.StartDate.Subtract(updates[0].UpdateDate).TotalSeconds > 0)) { status = 1; } if (flag == 1) { yield return(new ValidationResult("EndDate", Resources.EndDateNotValid + " " + updates[0].UpdateDate.ToString("dd-MMM-yyyy"))); } else if (status == 1) { yield return(new ValidationResult("StartDate", Resources.StartDate + " " + updates[0].UpdateDate.ToString("dd-MMM-yyyy"))); } } } }
public ActionResult Patch(Goal goal) { if (goal == null) { return(NotFound()); } if (_goalRepository.Get(goal.Id) == null) { return(NotFound(goal.Id)); } _goalRepository.Update(goal); return(Created("Goals", goal)); }
private void UpdateGoalStatus(ReportGoalView reportGoal, int companyId) { var goal = _goalRepository.Get(reportGoal.Id); goal.CompanyId = companyId; goal.Status = reportGoal.Status; _goalRepository.Update(goal); }
public ActionResult Update(int Id) { var goal = goalRepository.Get(Id); ViewBag.ActionName = "Update"; ViewBag.Title = "Edit Goal"; return(View("EditGoal", goal)); }
public void UpdateGoal(long id, GoalRequest goalRequest) { try { var goal = _goalRepository.Get(id); var goalUpdated = new Goal() { GoalId = goal.GoalId, JobId = goal.JobId, LocationId = goal.LocationId, Status = goalRequest.Status, }; _goalRepository.Update(goal, goalUpdated); } catch (Exception e) { throw new Exception(e.ToString()); } }
public Goal Get(int id) { var goal = _goalRepository.Get(id); return(goal); }
public Goal Get(Guid id) { return(_repository.Get(id)); }
public Goal Get(long id) { return(Repo.Get(id)); }