/// <summary> /// Method cancels creation new object and clears insertion row. /// </summary> /// <param name="justClosed">Is view was just closed. Used because _ordersInsertionRow is not visible but needs to be cancelled.</param> public void CancelNewObject(bool justClosed) // REV: why do we have this method? Isn't it a part of CancelObjectEditing? { // Cancel editing in orders table. if (_ordersInsertionRow != null && (_ordersInsertionRow.IsVisible || justClosed) && (_ordersInsertionRow.IsBeingEdited || _ordersInsertionRow.IsDirty)) { OrdersGrid.CancelEdit(); _ordersInsertionRow.CancelEdit(); _isNewItemCreated = false; } }
/// <summary> /// Cancels object editing on orders view. /// </summary> public void CancelObjectEditing() { Debug.Assert(OrdersGrid != null); OrdersGrid.CancelEdit(); // Insertion row could be Null reference since it creates // only during first call (user click). if (OrdersGrid.InsertionRow != null) { OrdersGrid.InsertionRow.CancelEdit(); } }
/// <summary> /// Method tries to save changes in edited grid and returns true if changes ware saved successfully. /// </summary> public bool SaveEditedItem() { bool isSuccessfull = false; try { OrdersGrid.EndEdit(); isSuccessfull = true; } catch (Exception ex) { Logger.Warning(ex); OrdersGrid.CancelEdit(); } // if unable to save changes (record has validation error). return(isSuccessfull); }