public ActionResult Create(int personid, string personname, int ratedBy, string ratedbyname) { PersonRating pr = new PersonRating(); pr.personid = personid; pr.ratedBy = ratedBy; ViewBag.RatedByName = ratedbyname; ViewBag.PersonName = personname; pr.startDate = DateTime.Now; pr.endDate = DateTime.Now; Person p = _personRepository.Get(x => x.id == ratedBy).First(); ViewBag.Person = p; return View(pr); }
public ActionResult Create(PersonRating pr) { PersonRating p = null; try { p = new PersonRating(); p.createdAt = DateTime.Now; p.updatedAt = DateTime.Now; p.personid = pr.personid; p.ratedBy = pr.ratedBy; p.innovation = pr.innovation; p.innovationNotes = pr.innovationNotes; p.communication = pr.communication; p.communicationNotes = pr.communicationNotes; p.performance = pr.performance; p.performanceNotes = pr.performanceNotes; p.problemSolving = pr.problemSolving; p.problemSolvingNotes = pr.problemSolvingNotes; p.productivity = pr.productivity; p.productivityNotes = pr.productivityNotes; p.startDate = pr.startDate; p.endDate = pr.endDate; p.reasonForRating = pr.reasonForRating; _personratingRepository.SaveOrUpdate(p); } catch (Exception ex) { throw ex; } Person person = new Person(); person.id = pr.ratedBy; var persons = _personRepository.Get(t => t.deleted == false && t.id == person.id && t.id > 1); if (persons.Count() == 1) { person = persons.AsQueryable().First(); } return RedirectToAction("Index", "Search",person); }
public ActionResult Create(PersonRating pr) { try { pr.updatedAt = DateTime.Now; pr.createdAt = DateTime.Now; _personratingRepository.Merge(pr); } catch (Exception ex) { throw ex; } Person person = new Person(); var persons = _personRepository.Get(t => t.deleted == false && t.id == pr.ratedBy && t.id > 1); if (persons.Count() == 1) { person = persons.AsQueryable().First(); } return PartialView("_RatingCreated"); }
private PersonRating GetRating(int ratedBy, int personid, Configuration config ) { DateTime d = _ratingPeriod.LockDate; PersonRating pr = _personratingRepository.Get(x => x.personid == personid && x.ratedBy == ratedBy && x.createdAt >= _ratingPeriod.StartDate && x.createdAt <= _ratingPeriod.LockDate).FirstOrDefault(); if (pr == null) { pr = new PersonRating(); pr.personid = personid; pr.ratedBy = ratedBy; DateTime date = DateTime.Now; pr.startDate = new DateTime(date.Year, date.Month, config.ratingStartDate) ; pr.endDate = new DateTime(date.Year, date.Month, config.ratingEndDate); int ave = (config.ratingMax - config.ratingMin) / 2 + config.ratingMin; pr.innovation = ave; pr.communication = ave; pr.problemSolving = ave; pr.performance = ave; pr.productivity = ave; } return pr; }