public void ChangeStatus(Daf item, Daf.Statuses newStatus) { var now = DateTime.Now; item.UpdateAt = now; item.UpdatedBy = Permissions.User.Id; switch (newStatus) { case Daf.Statuses.Completed: item.EffectiveDate = now; item.ReviewedAt = now; item.ReviewedBy = this.Permissions.User.Id; item.FunctionalityScore = new FunctionalityScore { ClientId = item.ClientId, DiagnosticScore = item.TotlaScore.Value, StartDate = item.EffectiveDate, UpdatedAt = now, UpdatedBy = item.UpdatedBy.Value, FunctionalityLevelId = db.FunctionalityLevels .Where(f => item.TotlaScore >= f.MinScore && item.TotlaScore <= f.MaxScore) .Select(f => f.Id) .FirstOrDefault() }; break; case Daf.Statuses.EvaluatorSigned: item.SignedAt = now; item.SignedBy = this.Permissions.User.Id; break; } item.Status = newStatus; var entry = db.ObjectStateManager.GetObjectStateEntry(item); foreach (var h in Changeset(entry)) { db.Histories.AddObject(h); } db.SaveChanges(); }
public override bool CanDeleteDaf(Daf.Statuses item) { return(true); }
public virtual bool CanDeleteDaf(Daf.Statuses item) { return(false); }
public override bool CanDeleteDaf(Daf.Statuses item) { return(item == Daf.Statuses.Open); }