Esempio n. 1
0
 private void AddData()
 {
     try
     {
         m_Log.Trace("AddData({0})", textBoxShow.Text);
         using (TodoListEntities context = new TodoListEntities())
         {
             TodoList todoList = new TodoList();
             {
                 todoList.Name     = textBoxShow.Text;
                 todoList.TodoDate = Convert.ToDateTime(dateTimePickerDate.Text);
                 // TODO: dodac obsluge godziny
                 //TodoDate = Convert.ToDateTime(string.Format("{0} {1}", dateTimePickerDate.Text, dateTimePickerTime.Text)),
                 todoList.Descpription = richTextBoxRecipes.Text;
             };
             m_Log.Trace("AddData({0})", todoList);
             context.TodoLists.Add(todoList);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         m_Log.Error(ex);
     }
 }
Esempio n. 2
0
 private void DeleteData()
 {
     m_Log.Trace("DeleteData({0})", FormInfo.TextBoxShowValue);
     using (TodoListEntities contextt = new TodoListEntities())
     {
         TodoList todoList = contextt.TodoLists.FirstOrDefault(r => r.Name == FormInfo.TextBoxShowValue);
         if (todoList != null)
         {
             contextt.TodoLists.Remove(todoList);
             contextt.SaveChanges();
         }
     }
 }
Esempio n. 3
0
 private void EditData()
 {
     m_Log.Trace("EditData()");
     using (TodoListEntities contextt = new TodoListEntities())
     {
         TodoList todoList = contextt.TodoLists.FirstOrDefault(r => r.Name == FormInfo.TextBoxShowValue);
         if (todoList != null)
         {
             todoList.Name         = textBoxShow.Text;
             todoList.TodoDate     = Convert.ToDateTime(dateTimePickerDate.Text);
             todoList.Descpription = richTextBoxRecipes.Text;
         }
         contextt.SaveChanges();
     }
 }