public void DeleteCase(string index) { try { //Step 1 Code to delete the object from the database LoanComment s = new LoanComment(); s.loanId = Convert.ToInt32(currentCase.Text); s.comment = ""; s.seqNo = Convert.ToInt16(index); s.userId = 0; s.userName = ""; s.date = DateTime.Now; PostRequest <LoanComment> req = new PostRequest <LoanComment>(); req.entity = s; PostResponse <LoanComment> r = _loanService.ChildDelete <LoanComment>(req); if (!r.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); 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(); } }
public void DeleteRecord(string index) { try { //Step 1 Code to delete the object from the database LoanType s = new LoanType(); s.recordId = index; s.name = ""; PostRequest <LoanType> req = new PostRequest <LoanType>(); req.entity = s; PostResponse <LoanType> r = _loanService.ChildDelete <LoanType>(req); if (!r.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); return; } else { //Step 2 : remove the object from the store Store1.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(); } }