예제 #1
0
        // The method that delete simple todolist
        /// <summary>
        /// The method that delete simple todolist
        /// </summary>
        /// <param name="id"> the id of the object being deleted </param>
        public void DeleteToDoList(int id)
        {
            var r = from d in this.DataBaseToDoLists1
                    where d.Id == id
                    select d;
            DataBaseToDoList1 obj = r.SingleOrDefault();

            if (obj != null)
            {
                this.DataBaseToDoLists1.Remove(obj);
                this.SaveChanges();
            }
        }
        // The metod save change information to the database
        /// <summary>
        /// The metod save change information to the database
        /// </summary>
        /// <param name="sender"> Contains a reference to the object that triggered the event </param>
        /// <param name="e"> Contains state information and event data associated with a routed event  </param>
        private void SaveChanges_Click(object sender, RoutedEventArgs e)
        {
            DataBaseToDoList1 todolist = new DataBaseToDoList1();

            if (todolist != null)
            {
                todolist.Name = this.ToDoListEditShow.Text;
                todolist.Done = done;
            }
            DbToDoList.SaveChangesToDoList(todolist, updatingToDoListID);
            RestartWindow();
            UpdateGrid();
            SetGrayForeground();
        }
예제 #3
0
        // The method that save changes simple todolist
        /// <summary>
        /// The method that save changes simple todolist
        /// </summary>
        /// <param name="obj"> the object we are changing to </param>
        /// <param name="id"> the id of the object being changed</param>
        public void SaveChangesToDoList(DataBaseToDoList1 todolist, int id)
        {
            var r = from d in this.DataBaseToDoLists1
                    where d.Id == id
                    select d;
            DataBaseToDoList1 obj = r.SingleOrDefault();

            if (obj != null)
            {
                obj.Name = todolist.Name;
                obj.Done = todolist.Done;
            }
            this.SaveChanges();
        }
        // The metod save information to the database
        /// <summary>
        /// The metod save information to the database
        /// </summary>
        /// <param name="sender"> Contains a reference to the object that triggered the event </param>
        /// <param name="e"> Contains state information and event data associated with a routed event  </param>
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            SolidColorBrush blackBrush = new SolidColorBrush(Colors.Black);

            blackBrush.Opacity = 0.9;
            if (this.ToDoListNameShow.Foreground.Opacity == blackBrush.Opacity)
            {
                DataBaseToDoList1 todolist = new DataBaseToDoList1()
                {
                    Name = this.ToDoListNameShow.Text,
                    Done = false,
                };
                DbToDoList.SaveToDoList(todolist);
                RestartWindow();
                UpdateGrid();
            }
            else
            {
                AlertWindow alertWindow = new AlertWindow("Please, corect your information!", "Input Error");
                alertWindow.ShowDialog();
            }
        }
예제 #5
0
 // The method that save simple todolist
 /// <summary>
 /// The method that save simple todolist
 /// </summary>
 /// <param name="todolist"> the object we are adding to database </param>
 public void SaveToDoList(DataBaseToDoList1 todolist)
 {
     this.DataBaseToDoLists1.Add(todolist);
     this.SaveChanges();
 }