protected void saveDocumentTransfer(object sender, DirectEventArgs e) { string seqNo = e.ExtraParams["seqNo"]; string doId = e.ExtraParams["doId"]; string status = e.ExtraParams["status"]; AdminDocTransfer t = new AdminDocTransfer(); t.seqNo = seqNo; t.doId = Convert.ToInt32(doId); t.apStatus = status.Trim('\"'); t.employeeId = _systemService.SessionHelper.GetEmployeeId(); t.departmentId = "0"; PostRequest <AdminDocTransfer> req = new PostRequest <AdminDocTransfer>(); req.entity = t; PostResponse <AdminDocTransfer> resp = _selfServiceService.ChildAddOrUpdate <AdminDocTransfer>(req); if (!resp.Success) { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(resp); return; } DocumentTransferWindow.Close(); documentsTransfersStore.Reload(); }
protected void saveDocumentTransfer(object sender, DirectEventArgs e) { //Getting the id to check if it is an Add or an edit as they are managed within the same form. try { string obj = e.ExtraParams["values"]; AdminDocTransfer b = JsonConvert.DeserializeObject <AdminDocTransfer>(obj); b.apStatus = "1"; //New Mode //Step 1 : Fill The object and insert in the store PostRequest <AdminDocTransfer> request = new PostRequest <AdminDocTransfer>(); request.entity = b; PostResponse <AdminDocTransfer> r = _administrationService.ChildAddOrUpdate <AdminDocTransfer>(request); //check if the insert failed if (!r.Success)//it maybe be another condition { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r);; return; } else { //Add this record to the store documentsStore.Reload(); //Display successful notification Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordSavingSucc }); DocumentTransferWindow.Close(); } } catch (Exception ex) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); } }