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