public void DeleteRecord(string index) { try { //Step 1 Code to delete the object from the database SocialSecuritySchedule s = new SocialSecuritySchedule(); s.recordId = index; //s.intName = ""; PostRequest <SocialSecuritySchedule> req = new PostRequest <SocialSecuritySchedule>(); req.entity = s; PostResponse <SocialSecuritySchedule> r = _PayrollService.ChildDelete <SocialSecuritySchedule>(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(); } }
public void DeleteRecord(string index) { try { //Step 1 Code to delete the object from the database LeavePayment s = new LeavePayment(); s.recordId = index; s.date = DateTime.Now; s.effectiveDate = DateTime.Now; s.amount = 0; PostRequest <LeavePayment> req = new PostRequest <LeavePayment>(); req.entity = s; PostResponse <LeavePayment> r = _payrollService.ChildDelete <LeavePayment>(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(); } }