public object ValidateSave(bool isPhantom, string obj, JsonObject values) { if (!values.ContainsKey("comment")) { return(new { valid = false, msg = "Error in call" }); } PostRequest <LoanComment> req = new PostRequest <LoanComment>(); LoanComment note = JsonConvert.DeserializeObject <List <LoanComment> >(obj)[0]; //note.recordId = id; note.loanId = Convert.ToInt32(currentCase.Text); note.comment = values["comment"].ToString(); int bulk; req.entity = note; PostResponse <LoanComment> resp = _loanService.ChildAddOrUpdate <LoanComment>(req); if (!resp.Success) { Common.errorMessage(resp); return(new { valid = false }); } //loanComments_RefreshData(note.loanId); return(new { valid = true }); }
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(); } }