/// <summary> /// //Bind Repeater /// </summary> protected void BindNotes() { NoteAdmin _NoteAdmin = new NoteAdmin(); CustomerNotes.DataSource = _NoteAdmin.GetByCaseID(ItemID); CustomerNotes.DataBind(); }
/// <summary> /// Submit Button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { NoteAdmin _Noteadmin = new NoteAdmin(); Note _NoteAccess = new Note(); _NoteAccess.CaseID = ItemID; _NoteAccess.AccountID = null; _NoteAccess.CreateDte = System.DateTime.Now; _NoteAccess.CreateUser = HttpContext.Current.User.Identity.Name; _NoteAccess.NoteTitle = txtNoteTitle.Text.Trim(); _NoteAccess.NoteBody = ctrlHtmlText.Html ; bool Check = _Noteadmin.Insert(_NoteAccess); if (Check) { //redirect to main page Response.Redirect(CancelLink); } else { //display error message lblError.Text = "An error occurred while updating. Please try again."; lblError.Visible = true; } }
/// <summary> /// Delete button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { CaseAdmin caseAdmin = new CaseAdmin(); NoteAdmin noteAdmin = new NoteAdmin(); Account _account = accountAdmin.GetByAccountID(ItemId); Guid UserKey = new Guid(); if(_account !=null) { if(_account.UserID.HasValue) //Get UserId for this account UserKey = _account.UserID.Value; } //Delete the note for this AccountId. noteAdmin.DeleteByAccountId(ItemId); //Delete the case for this AccountId. caseAdmin.DeleteByAccountId(ItemId); bool status = accountAdmin.Delete(_account); if (status) //Check { //Get user by Unique GUID - User Id MembershipUser user = Membership.GetUser(UserKey); if (user != null) { //Delete online account Membership.DeleteUser(user.UserName); } //Redirect to list page Response.Redirect(ListPageLink); } else { lblMsg.Text = "Unable to delete this account. Please try again."; } }
/// <summary> /// //Bind Repeater /// </summary> protected void BindNotes() { NoteAdmin _NoteAdmin = new NoteAdmin(); TList<Note> noteList = _NoteAdmin.GetByAccountID(AccountID); noteList.Sort("NoteID Desc"); CustomerNotes.DataSource = noteList; CustomerNotes.DataBind(); }