protected void btnDelete_Click(object sender, EventArgs e) { try { Panel1.Visible = true; Logic lo = new Logic(); Taskk t = lo.GetSingleTask(drpTitles.SelectedItem.Text); int id = lo.GetTaskID(drpTitles.SelectedItem.Text); string u = Session["username"].ToString(); Person pp = lo.GetPerson(u); bool delPersonTask = lo.DeletePersonTask(pp.Id, id); bool delTask = lo.DeleteTask(id); if (delPersonTask == true && delTask == true) { Label lb = new Label(); lb.Text = "Task Deleted Successfully..."; Panel1.CssClass = "divSuccess"; icon.CssClass = "img"; icon.ImageUrl = "~/assets/icons/success3.png"; icon.Visible = true; PlaceHolder1.Controls.Add(lb); Load(); txtTitle.Text = ""; txtDescription.Text = ""; txtIsCompleted.Text = ""; } else { Label lb = new Label(); lb.Text = "Delete Failed"; Panel1.CssClass = "divError"; icon.CssClass = "img"; icon.ImageUrl = "~/assets/icons/error3.png"; icon.Visible = true; PlaceHolder1.Controls.Add(lb); Load(); } } catch { } }
protected void btnLoad_Click(object sender, EventArgs e) { try { Logic lo = new Logic(); Taskk t = lo.GetSingleTask(drpTitles.SelectedItem.Text); txtTitle.Text = t.Title; txtDescription.Text = t.Description; txtDate.Text = t.DateCreated.ToShortDateString(); } catch { Label lb = new Label(); lb.Text = "Loading Failed. Please Try Again"; Panel1.CssClass = "divError"; icon.CssClass = "img"; icon.ImageUrl = "~/assets/icons/error3.png"; icon.Visible = true; PlaceHolder1.Controls.Add(lb); } }