protected void BtDel_Click(object sender, EventArgs e) { AccesDBGestionProject.Models.Project project = new AccesDBGestionProject.Models.Project(); Int32 id = int.Parse(TBId.Text); project = dbContext.projects.Find(id); dbContext.projects.Remove(project); dbContext.SaveChanges(); load_grid(); clear_page(); }
protected void GridViewDescription_SelectedIndexChanged(object sender, EventArgs e) { Calendar1.SelectedDates.Clear(); Int32 id = int.Parse(GridViewProjects.SelectedValue.ToString()); AccesDBGestionProject.Models.Project project = new AccesDBGestionProject.Models.Project(); project = dbContext.projects.Find(id); TBId.Text = project.projectID.ToString(); TBname.Text = project.name; Calendar1.SelectedDates.Add(project.startDate); Calendar1.SelectedDates.Add(project.endDate); }
protected void BtAdd_Click(object sender, EventArgs e) { if (Calendar1.SelectedDates.Count >= 2) { AccesDBGestionProject.Models.Project project = new AccesDBGestionProject.Models.Project(); project.name = TBname.Text; project.startDate = Calendar1.SelectedDates[0]; project.endDate = Calendar1.SelectedDates[1]; dbContext.projects.Add(project); dbContext.SaveChanges(); load_grid(); clear_page(); } }
protected void BtUpdate_Click(object sender, EventArgs e) { if (Calendar1.SelectedDates.Count >= 2) { AccesDBGestionProject.Models.Project project = new AccesDBGestionProject.Models.Project(); Int32 id = int.Parse(TBId.Text); project = dbContext.projects.Find(id); project.name = TBname.Text; project.startDate = Calendar1.SelectedDates[0]; project.endDate = Calendar1.SelectedDates[1]; dbContext.SaveChanges(); load_grid(); clear_page(); } }