Ejemplo n.º 1
0
        public async t.Task InsertAsync(Task task)
        {
            string tags;

            if (task.Tags.Count == 0)
            {
                tags = "";
            }
            else
            {
                tags = task.Tags[0].ID;
                for (var i = 1; i < task.Tags.Count; i++)
                {
                    tags += "," + task.Tags[i].ID;
                }
            }
            string cmd = String.Format(@"INSERT INTO tasks(Title, ID, Repeat, ActivatedTime, ExpiryTime, Time, Tags, WebAddress) VALUES 
                                        ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}');",
                                       task.Title, task.ID, RepeatStorageConverter.ToString(task.Repeat), task.ActivatedTime.ToString("yyyy-MM-dd HH:mm"),
                                       task.ExpiryTime.ToString("yyyy-MM-dd HH:mm"), TimeInfosStorageConverter.ToString(task.Time), tags, task.WebAddress);

            await ExecuteQueryAsync(cmd);
        }