public static void ProcessCards() { var ndl = new NaggerDataLinker(); List <Card> cards = ndl.GetCardCollection(); int currentColumn = 0; foreach (var card in cards) { currentColumn = card.ColumnID; card.ColumnID = (int)card.AssignColumn(); if (card.ColumnID != currentColumn) { ndl.UpdateCard(card); } } Console.WriteLine("Could Do: {0}", cards.Count(c => c.AssignColumn() == ColumnType.colCould)); Console.WriteLine("Should Do: {0}", cards.Count(c => c.AssignColumn() == ColumnType.colShould)); Console.WriteLine("Must Do: {0}", cards.Count(c => c.AssignColumn() == ColumnType.colMust)); Console.WriteLine("Done: {0}", cards.Count(c => c.AssignColumn() == ColumnType.colDone)); Console.WriteLine("Skipped: {0}", cards.Count(c => c.AssignColumn() == ColumnType.colSkip)); }
public void ProcessCard(string Nag, string fromColumn, string toColumn) { var ndl = new NaggerDataLinker(); CardManager mgr = new CardManager(); ICard card = mgr.DeserializeCard(Nag, toColumn); ICard mostRecentAction = ndl.GetMostRecentAction(card.ID); ICard previousAction = ndl.GetPenultimateAction(card.ID); if (card.ProcessTransition(fromColumn, previousAction, mostRecentAction) == false) { log.InfoFormat("Error updating: {0}", Nag); var result = new { successMessage = "" }; Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.Write(JsonConvert.SerializeObject(result)); } else { ndl.Update(card); log.InfoFormat("Card updated: {0}", Nag); var result = new { successMessage = "Card moved" }; Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.Write(JsonConvert.SerializeObject(result)); } }
// GET: Nags public ActionResult Index() { var model = new List <CardViewModel>(); NaggerDataLinker ndl = new NaggerDataLinker(); List <Card> cards = ndl.GetCardCollection(); var viewModel = from c in cards join m in db.Columns on c.ColumnID equals m.ID join l in db.Locations on c.LocationID equals l.ID join b in db.Boards on c.BoardID equals b.ID join f in db.Frequencies on c.FrequencyID equals f.DayCount select new CardViewModel { ColumnDescription = m.Description, BoardDescription = b.Description, LocationDescription = l.Description, FrequencyDescription = f.Description, Mandated = c.Mandated, BoardID = c.BoardID, FrequencyID = c.FrequencyID, LocationID = c.LocationID, Title = c.Title, Description = c.Description }; return(View(viewModel)); }
public ActionResult Create(CardViewModel newCard) { try { NaggerDataLinker ndl = new NaggerDataLinker(); ndl.InsertCard(newCard); return(RedirectToAction("Index")); } catch (Exception ex) { string bob = ex.Message; return(View(newCard)); } }
public void GetAllNags() { ArrayList objs = new ArrayList(); try { var ndl = new NaggerDataLinker(); List <Card> cards = ndl.GetCardCollection(); foreach (var card in cards) { objs.Add(new { id = card.ID, title = card.Title, columnID = card.ColumnID, description = card.Description, board = card.BoardID, frequencyID = card.FrequencyID, dueDate = card.DueDate, lastDone = card.LastDone, skipCount = card.SkipCount }); } } catch (Exception ex) { if (log.IsDebugEnabled) { log.DebugFormat("Error getting Nags: {0}", ex.Message); } } Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.Write(JsonConvert.SerializeObject(objs)); }