public void Add(ToDoListMonth toDoListMonth) { string query = "Insert Into ToDoListMonth (Title,Month,Year,Completed) Values (@p1,@p2,@p3,@p4)"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListMonth.Title); command.Parameters.AddWithValue("@p2", toDoListMonth.Month); command.Parameters.AddWithValue("@p3", toDoListMonth.Year); command.Parameters.AddWithValue("@p4", toDoListMonth.Completed); command.ExecuteNonQuery(); connection.Connection().Close(); }
public void UpdateOnlyMainSections(int Id, ToDoListMonth toDoListMonth) { string query = "Update ToDoListMonth set Title=@p1, Description=@p2, Completed=@p3 where Id=@p4"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListMonth.Title); command.Parameters.AddWithValue("@p2", toDoListMonth.Description); command.Parameters.AddWithValue("@p3", toDoListMonth.Completed); command.Parameters.AddWithValue("@p4", Id); command.ExecuteNonQuery(); connection.Connection().Close(); }
public void Update(int Id, ToDoListMonth toDoListMonth) { string query = "Update ToDoListMonth set Title=@p1, Month=@p2, Year=@p3, Completed=@p4 where Id=@p5"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); command.Parameters.AddWithValue("@p1", toDoListMonth.Title); command.Parameters.AddWithValue("@p2", toDoListMonth.Month); command.Parameters.AddWithValue("@p3", toDoListMonth.Year); command.Parameters.AddWithValue("@p4", toDoListMonth.Completed); command.Parameters.AddWithValue("@p5", toDoListMonth.Id); command.ExecuteNonQuery(); connection.Connection().Close(); }
private void btnComplete_Click(object sender, EventArgs e) { if (txtId.Text != "" || txtId.Text == null) { ToDoListMonth toDoListMonth = new ToDoListMonth(); toDoListMonth.Id = Convert.ToInt32(txtId.Text); toDoListMonth.Completed = txtCompleted.Text; toDoListMonthManager.UpdateCompletedStatus(toDoListMonth.Id, toDoListMonth.Completed); MessageBox.Show("Durum Bilgisi Başarıyla Güncellendi."); txtCompleted.Text = toDoListMonth.Completed == "Tamamlandı" ? "Tamamlanmadı" : "Tamamlandı"; ShowData(); } }
public void UpdateOnlyMainSections(int Id, ToDoListMonth toDoListMonth) { try { if (toDoListMonth.Title.Length > 2) { toDoListMonthDal.UpdateOnlyMainSections(Id, toDoListMonth); } } catch (Exception exception) { throw exception; } }
public void Add(ToDoListMonth toDoListMonth) { try { if (toDoListMonth.Title.Length > 2) { toDoListMonthDal.Add(toDoListMonth); } } catch (Exception exception) { throw exception; } }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtId.Text != "" || txtId.Text == null) { ToDoListMonth toDoListMonth = new ToDoListMonth(); toDoListMonth.Id = Convert.ToInt32(txtId.Text); toDoListMonth.Title = txtTitle.Text; toDoListMonth.Description = txtDescription.Text; toDoListMonth.Completed = txtCompleted.Text; toDoListMonthManager.UpdateOnlyMainSections(toDoListMonth.Id, toDoListMonth); MessageBox.Show("Yapılacak Bilgileri Başarıyla Güncellendi."); ShowData(); } }
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 ToDoListMonth GetById(int Id) { ToDoListMonth todo = new ToDoListMonth(); string query = "Select * From ToDoListMonth 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.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 <ToDoListMonth> GetAll() { List <ToDoListMonth> todos = new List <ToDoListMonth>(); string query = "Select * From ToDoListMonth Order By Id Desc"; SQLiteCommand command = new SQLiteCommand(query, connection.Connection()); SQLiteDataReader dr = command.ExecuteReader(); while (dr.Read()) { ToDoListMonth todo = new ToDoListMonth(); todo.Id = Convert.ToInt16(dr["Id"]); todo.Title = dr["Title"].ToString(); todo.Description = dr["Description"].ToString(); 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); }