예제 #1
0
 public SynergyV5ListItem(string itemValue, 
                          DateTime? itemActivatedAtTime, 
                          DateTime? completedAtTime, 
                          DateTime? archivedAtTime)
     : this(itemValue)
 {
     SynergyV5ToDo newToDo = new SynergyV5ToDo();
     newToDo.SetTimeStamps(itemActivatedAtTime, completedAtTime, archivedAtTime);
     ToDo = newToDo;
 }
예제 #2
0
        private void PopulateListItems(SynergyV5List synLst, SQLiteCommand cmd)
        {
            //mirrors synergyV5PopulateListItems() in Gauntlet

            //select list items by position for list
            cmd.Parameters.Clear();
            cmd.CommandText =
                SYNERGY_V5_SELECT_LIST_ITEMS_AND_TODOS_BY_POSITION_FOR_LIST_ID_X;

            SQLiteParameter listIdParam = new SQLiteParameter();
            listIdParam.Value = synLst.ListId;
            cmd.Parameters.Add(listIdParam);

            using (var rdr = cmd.ExecuteReader())
            {
                int itemId, position, listItemId, toDoId;

                String itemValue,
                        toDoActivatedAtString,
                        toDoCompletedAtString,
                        toDoArchivedAtString;

                while (rdr.Read())
                {
                    itemId = GetNullableInt32(rdr, 0);
                    itemValue = GetNullableString(rdr, 1);
                    position = GetNullableInt32(rdr, 2);
                    listItemId = GetNullableInt32(rdr, 3);
                    toDoId = GetNullableInt32(rdr, 4);
                    toDoActivatedAtString = GetNullableString(rdr, 5);
                    toDoCompletedAtString = GetNullableString(rdr, 6);
                    toDoArchivedAtString = GetNullableString(rdr, 7);

                    SynergyV5ListItem sli = new SynergyV5ListItem(itemValue);
                    sli.ItemId = itemId;
                    sli.ListItemId = listItemId;

                    if(toDoId > 0)
                    {
                        //has toDo item

                        SynergyV5ToDo toDo = new SynergyV5ToDo();
                        toDo.ToDoId = toDoId;

                        DateTime? activated =
                            TimeStamp.YYYY_MM_DD_HH_MM_SS_UTC_ToDateTime(toDoActivatedAtString);

                        DateTime? completed =
                            TimeStamp.YYYY_MM_DD_HH_MM_SS_UTC_ToDateTime(toDoCompletedAtString);

                        DateTime? archived =
                            TimeStamp.YYYY_MM_DD_HH_MM_SS_UTC_ToDateTime(toDoArchivedAtString);

                        toDo.SetTimeStamps(activated, completed, archived);

                        sli.ToDo = toDo;
                    }

                    synLst.Add(position, sli);
                }
            }
        }