protected void SubmitButton_Click(object sender, EventArgs e) { NotesBLL notes = new NotesBLL(); TimeKeeper.NotesDataTable note = notes.GetNoteByUserID((int)Session["UserID"]); if (NoteLabel.Text == "Empty") { if (notes.AddNote((int)Session["UserID"], NotesTextBox.Text)) { NoteLabel.Text = "Why? " + NoteLabel.Text.ToString(); NotesTextBox.BackColor = System.Drawing.Color.White; } else { NoteLabel.Text = "Could not create a new note for today!"; } } else { if (NotesTextBox.Text.ToString().Length == 0) { notes.DeleteNote((int)Session["NoteID"]); } else if (notes.UpdateNote((int)Session["UserID"], NotesTextBox.Text, (int)Session["NoteID"])) { NoteLabel.Text = "Note updated!"; NotesTextBox.BackColor = System.Drawing.Color.White; } else { NoteLabel.Text = "Could not update the note!"; } } }
protected void SubmitButton_Click(object sender, EventArgs e) { NotesBLL notes = new NotesBLL(); TimeKeeper.NotesDataTable note = notes.GetNoteByUserID((int)Session["UserID"]); if (NoteLabel.Text == "Empty") { if (notes.AddNote((int)Session["UserID"], NotesTextBox.Text)) { NoteLabel.Text = "Why? " + NoteLabel.Text.ToString(); NotesTextBox.BackColor = System.Drawing.Color.White; } else NoteLabel.Text = "Could not create a new note for today!"; } else { if (NotesTextBox.Text.ToString().Length == 0) { notes.DeleteNote((int)Session["NoteID"]); } else if (notes.UpdateNote((int)Session["UserID"], NotesTextBox.Text, (int)Session["NoteID"])) { NoteLabel.Text = "Note updated!"; NotesTextBox.BackColor = System.Drawing.Color.White; } else NoteLabel.Text = "Could not update the note!"; } }
public ActionResult DeleteCustomer(int id) { Customers customer = customerBLL.GetCustomer(id); List <Notes> notes = notesBLL.GetNotes(id); foreach (Notes item in notes) { notesBLL.DeleteNote(item.NoteID); } List <Leads> leads = leadsBLL.GetLeads(id); foreach (Leads item in leads) { leadsBLL.DeleteLead(item.LeadID); } customerBLL.DeleteCustomers(customer); return(RedirectToAction("Index")); }