Example #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Task task = new Task();

            task.name = txtName.Text;
            task.comments = txtAreaComments.Text;

            task.start_date = new DateTime(int.Parse(txtStartDate.Text.Substring(6, 4)), int.Parse(txtStartDate.Text.Substring(3, 2)), int.Parse(txtStartDate.Text.Substring(0, 2)));
             task.due_date= new DateTime(int.Parse(txtDueDate.Text.Substring(6,4)),int.Parse(txtDueDate.Text.Substring(3,2)),int.Parse(txtDueDate.Text.Substring(0,2)));
             if (txtCompletionDate.Text != "")
             {
                 task.completion_date = new DateTime(int.Parse(txtCompletionDate.Text.Substring(6, 4)), int.Parse(txtCompletionDate.Text.Substring(3, 2)), int.Parse(txtCompletionDate.Text.Substring(0, 2)));
             }

            entity.Tasks.AddObject(task);

            entity.SaveChanges();

            loadTasksForToday();
            loadUnfinishedTasks();
        }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Tasks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTasks(Task task)
 {
     base.AddObject("Tasks", task);
 }
Example #3
0
 /// <summary>
 /// Create a new Task object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="start_date">Initial value of the start_date property.</param>
 /// <param name="due_date">Initial value of the due_date property.</param>
 public static Task CreateTask(global::System.Int32 id, global::System.String name, global::System.DateTime start_date, global::System.DateTime due_date)
 {
     Task task = new Task();
     task.id = id;
     task.name = name;
     task.start_date = start_date;
     task.due_date = due_date;
     return task;
 }