private void DisplayTaskInfo(Task task) { view.TaskName = task.Name; view.Priority = task.Priority; //view.StartDate = task.StartDate; view.DueDate = task.DueDate; view.IsFinished = task.IsFinished; view.FinishDate = task.FinishedDate; isNew = false; }
private void SelectTask(Task task) { SelectTask(this, task.Id); }
protected override void OnLoad(EventArgs e) { /*using (var db = new TodoEntitiesContext()) { var task = new Task() {Name = "Zadanie numer 3"}; db.Tasks.Add(task); db.SaveChanges(); } */ Random random = new Random(234); try { using (var ctx = new EntitiesContext()) { for (int i = 0; i < 5; i++) { Task t = new Task(); t.Name = "Task " + i.ToString(); t.Description = "opis taska " + i.ToString() + ". "; t.CreationDate = DateTime.Now; ctx.Tasks.Add(t); } ctx.SaveChanges(); } using (var context = new EntitiesContext()) { StringBuilder sb = new StringBuilder(); var tasks = from t in context.Tasks select t; foreach (var t in tasks) { t.Name = t.Name + " a to dopisana " + random.Next().ToString() + " liczba"; } context.SaveChanges(); } using (var db = new EntitiesContext()) { StringBuilder sb = new StringBuilder(); var tasks = from t in db.Tasks select t; foreach (var t in tasks) { sb.Append("Task id: "); sb.Append(t.Id); sb.Append("Task name: "); sb.Append(t.Name); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); } textBox1.Text = sb.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } base.OnLoad(e); }