private IEnumerable <ActivityLogEntryMark> CreateDebugEntryMarks() { List <ActivityLogEntryMark> marks = new List <ActivityLogEntryMark>(); ActivityLogEntryMark good = new ActivityLogEntryMark() { ActivityEntryLogMarkId = 1, ActivityLogId = 1, Color = "#38c695", Description = "Did It!" }; ActivityLogEntryMark notApplicable = new ActivityLogEntryMark() { ActivityEntryLogMarkId = 2, ActivityLogId = 1, Color = "#b27cf5", Description = "Scheduled" }; ActivityLogEntryMark partial = new ActivityLogEntryMark() { ActivityEntryLogMarkId = 3, ActivityLogId = 1, Color = "#feb960", Description = "Partially" }; ActivityLogEntryMark bad = new ActivityLogEntryMark() { ActivityEntryLogMarkId = 4, ActivityLogId = 1, Color = "#fc5f45", Description = "Forgot" }; marks.Add(good); marks.Add(notApplicable); marks.Add(partial); marks.Add(bad); return(marks); }
public int AddUpdate(ActivityLogEntryMark EntryMark, string SessionUserId) { if (IsValid(EntryMark) && string.IsNullOrEmpty(SessionUserId) == false) { return(_markRepository.AddUpdate(EntryMark, SessionUserId)); } return(0); }
public int AddUpdate(ActivityLogEntryMark EntryMark, string SessionUserId) { using (SqlConnection connection = new SqlConnection(base.ConnectionString)) { return(Task.FromResult(connection.ExecuteScalar <int>("spActivityLogEntryMarkAddUpdate", new { @ACTIVITYLOGENTRYMARKID = EntryMark.ActivityEntryLogMarkId, @ACTIVITYLOGID = EntryMark.ActivityLogId, @DESCRIPTION = EntryMark.Description, @COLOR = EntryMark.Color, @SESSIONUSERID = Guid.Parse(SessionUserId) }, null, null, CommandType.StoredProcedure)).Result); } }
private bool IsValid(ActivityLogEntryMark EntryMark) { bool isValid = true; // Not associated with a Log! if (EntryMark.ActivityLogId == 0) { return(false); } // Not a valid Hex color if (EntryMark.Color.Length < 7) { return(false); } // No meaning given to mark! if (string.IsNullOrEmpty(EntryMark.Description)) { return(false); } return(isValid); }