public static bool CanSaveObject(Hour hour) { if (Csla.ApplicationContext.User.IsInRole(Role.FullControl.ToString()) || (Csla.ApplicationContext.User.IsInRole(Role.Contribute.ToString()) && hour.UserId == BusinessPrincipal.GetCurrentIdentity().UserId && !hour.IsArchived)) { return true; } return false; }
public static bool HourDelete(Hour hour) { Hour.DeleteHour( new HourCriteria { HourId = hour.HourId }); FeedService.FeedAdd("Deleted", hour); return true; }
public static Feed FeedAdd(string action, Hour hour) { var feed = FeedService.FeedNew(); feed.Type = "Hour"; feed.Data = string.Format( "Action={0}|HourId={1}|Date={2:d}|TaskId={3}|ProjectId={4}|ProjectName={5}|Text={6}", action, hour.HourId, hour.Date, hour.TaskId, hour.ProjectId, hour.ProjectName, hour.Notes); feed = FeedService.FeedSave(feed); return(feed); }
internal static void FeedAdd(string action, Hour hour) { var feed = FeedRepository.FeedNew(action, SourceType.Hour, hour.HourId); if (action == FeedAction.Edited) { feed.Description = hour.Auditor.Audit(hour); } else { feed.Description = hour.Notes; } feed.Sources.Add(SourceType.Project, hour.ProjectId); feed.Sources.Add(SourceType.Story, hour.StoryId); feed.Sources.Add(SourceType.User, hour.UserId); feed.Save(); }
public static Hour HourSave(Hour hour) { if (!hour.IsValid) { return(hour); } Hour result; if (hour.IsNew) { result = HourRepository.HourInsert(hour); } else { result = HourRepository.HourUpdate(hour); } StoryRepository.StoryUpdateDuration(hour.StoryId); return(result); }
public static Hour HourNew() { var hour = Hour.NewHour(); return(hour); }
public HourFormModel Map(Hour hour, HourFormModel model, bool ignoreBrokenRules) { Csla.Data.DataMapper.Map(hour, model, true); model.Tab = "Hour"; model.FindText = string.Empty; model.FindCategory = "Hour"; model.Users = DataHelper.GetUserList(); model.Projects = DataHelper.GetProjectList(); model.IsNew = hour.IsNew; model.IsValid = hour.IsValid; if (!ignoreBrokenRules) { foreach (var brokenRule in hour.BrokenRulesCollection) { this.ModelState.AddModelError(string.Empty, brokenRule.Description); } } return model; }
public static Hour HourUpdate(Hour hour) { hour = hour.Save(); FeedService.FeedAdd("Updated", hour); return hour; }
public static Hour HourSave(Hour hour, Task task) { if (!hour.IsValid) { return hour; } Hour result; if (hour.IsNew) { result = HourService.HourInsert(hour); } else { result = HourService.HourUpdate(hour); } return result; }
public static Hour HourInsert(Hour hour) { hour = hour.Save(); FeedService.FeedAdd("Created", hour); return hour; }