public void DeleteCase(string index) { try { //Step 1 Code to delete the object from the database CaseComment s = new CaseComment(); s.caseId = Convert.ToInt32(currentCase.Text); s.comment = ""; s.seqNo = Convert.ToInt16(index); s.userId = 0; s.userName = ""; s.date = DateTime.Now; PostRequest <CaseComment> req = new PostRequest <CaseComment>(); req.entity = s; PostResponse <CaseComment> r = _caseService.ChildDelete <CaseComment>(req); if (!r.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", r.ErrorCode) != null ? GetGlobalResourceObject("Errors", r.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + r.LogId : r.Summary).Show(); return; } else { //Step 2 : remove the object from the store caseCommentStore.Remove(index); //Step 3 : Showing a notification for the user Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordDeletedSucc }); } } catch (Exception ex) { //In case of error, showing a message box to the user X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show(); } }