public void UpdateOnlyMainSections(int Id, ToDoListToday toDoListToday) { string query = "Update ToDoListToday set Title=@p1, Completed=@p2 where Id=@p3"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListToday.Title); command.Parameters.AddWithValue("@p2", toDoListToday.Completed); command.Parameters.AddWithValue("@p3", Id); command.ExecuteNonQuery(); connection.Connection().Close(); }
public void Add(ToDoListToday toDoListToday) { string query = "Insert Into ToDoListToday (Title,Day,Week,Month,Year,Completed) Values (@p1,@p2,@p3,@p4,@p5,@p6)"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListToday.Title); command.Parameters.AddWithValue("@p2", toDoListToday.Day); command.Parameters.AddWithValue("@p3", toDoListToday.Week); command.Parameters.AddWithValue("@p4", toDoListToday.Month); command.Parameters.AddWithValue("@p5", toDoListToday.Year); command.Parameters.AddWithValue("@p6", toDoListToday.Completed); command.ExecuteNonQuery(); connection.Connection().Close(); }
public void UpdateOnlyMainSections(int Id, ToDoListToday toDoListToday) { try { if (toDoListToday.Title.Length > 2) { toDoListTodayDal.UpdateOnlyMainSections(Id, toDoListToday); } } catch (Exception exception) { throw exception; } }
public void Add(ToDoListToday toDoListToday) { try { if (toDoListToday.Title.Length > 2) { toDoListTodayDal.Add(toDoListToday); } } catch (Exception exception) { throw exception; } }
private void btnComplete_Click(object sender, EventArgs e) { if (txtId.Text != "" || txtId.Text == null) { ToDoListToday toDoListToday = new ToDoListToday(); toDoListToday.Id = Convert.ToInt32(txtId.Text); toDoListToday.Completed = txtCompleted.Text; toDoListTodayManager.UpdateCompletedStatus(toDoListToday.Id, toDoListToday.Completed); MessageBox.Show("Durum Bilgisi Başarıyla Güncellendi."); txtCompleted.Text = toDoListToday.Completed == "Tamamlandı" ? "Tamamlanmadı" : "Tamamlandı"; ShowData(); } }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtId.Text != "" || txtId.Text == null) { ToDoListToday toDoListToday = new ToDoListToday(); toDoListToday.Id = Convert.ToInt32(txtId.Text); toDoListToday.Title = txtTitle.Text; toDoListToday.Completed = txtCompleted.Text; toDoListTodayManager.UpdateOnlyMainSections(toDoListToday.Id, toDoListToday); MessageBox.Show("Yapılacak Bilgileri Başarıyla Güncellendi."); ShowData(); } }
public void Update(int Id, ToDoListToday toDoListToday) { string query = "Update ToDoListToday set Title=@p1, Day=@p2, Week=@p3, Month=@p4, Year=@p5, Completed=@p6 where Id=@p7"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListToday.Title); command.Parameters.AddWithValue("@p2", toDoListToday.Day); command.Parameters.AddWithValue("@p3", toDoListToday.Week); command.Parameters.AddWithValue("@p4", toDoListToday.Month); command.Parameters.AddWithValue("@p5", toDoListToday.Year); command.Parameters.AddWithValue("@p6", toDoListToday.Completed); command.Parameters.AddWithValue("@p7", Id); command.ExecuteNonQuery(); connection.Connection().Close(); }
private void btnAdd_Click(object sender, EventArgs e) { if (txtTitle.Text.Length > 2) { if (toDoType == "Gunluk") { ToDoListToday toDoListToday = new ToDoListToday(); toDoListToday.Title = txtTitle.Text; toDoListToday.Day = dtpCreatedDate.Value.Day; toDoListToday.Week = dtpCreatedDate.Value.DayOfYear / 7; toDoListToday.Month = dtpCreatedDate.Value.Month; toDoListToday.Year = dtpCreatedDate.Value.Year; toDoListToday.Completed = "Tamamlanmadı"; toDoListTodayManager.Add(toDoListToday); MessageBox.Show("Başarıyla Eklendi."); this.Hide(); } else if (toDoType == "Haftalik") { ToDoListWeek toDoListWeek = new ToDoListWeek(); toDoListWeek.Title = txtTitle.Text; toDoListWeek.Week = dtpCreatedDate.Value.DayOfYear / 7; toDoListWeek.Month = dtpCreatedDate.Value.Month; toDoListWeek.Year = dtpCreatedDate.Value.Year; toDoListWeek.Completed = "Tamamlanmadı"; toDoListWeekManager.Add(toDoListWeek); MessageBox.Show("Başarıyla Eklendi."); this.Hide(); } else if (toDoType == "Aylik") { ToDoListMonth toDoListMonth = new ToDoListMonth(); toDoListMonth.Title = txtTitle.Text; toDoListMonth.Month = dtpCreatedDate.Value.Month; toDoListMonth.Year = dtpCreatedDate.Value.Year; toDoListMonth.Completed = "Tamamlanmadı"; toDoListMonthManager.Add(toDoListMonth); MessageBox.Show("Başarıyla Eklendi."); this.Hide(); } } }
public ToDoListToday GetById(int Id) { ToDoListToday todo = new ToDoListToday(); string query = "Select * From ToDoListToday Where Id=@p1"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", Id); SQLiteDataReader dr = command.ExecuteReader(); while (dr.Read()) { todo.Id = Convert.ToInt16(dr["Id"]); todo.Title = dr["Title"].ToString(); todo.Day = Convert.ToInt16(dr["Day"]); todo.Week = Convert.ToInt16(dr["Week"]); todo.Month = Convert.ToInt16(dr["Month"]); todo.Year = Convert.ToInt16(dr["Year"]); todo.Completed = dr["Completed"].ToString(); } dr.Close(); connection.Connection().Close(); return(todo); }
public List <ToDoListToday> GetAll() { List <ToDoListToday> todos = new List <ToDoListToday>(); string query = "Select * From ToDoListToday Order By Id Desc"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); SQLiteDataReader dr = command.ExecuteReader(); while (dr.Read()) { ToDoListToday todo = new ToDoListToday(); todo.Id = Convert.ToInt16(dr["Id"]); todo.Title = dr["Title"].ToString(); todo.Day = Convert.ToInt16(dr["Day"]); todo.Week = Convert.ToInt16(dr["Week"]); todo.Month = Convert.ToInt16(dr["Month"]); todo.Year = Convert.ToInt16(dr["Year"]); todo.Completed = dr["Completed"].ToString(); todos.Add(todo); } dr.Close(); connection.Connection().Close(); return(todos); }