public EditFormProperties() { LoadingElapseTime = new ElapseTime(); _ToolbarButtons = new ToolbarButtons(); _EditMode = EditModeEnum.List; _VisibleToolbar = true; _VisibleStatusbar = true; _IsLoadingRefresh = false; IsLoaded = false; }
private void Layers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (PreviousMode == Settings.Instance.Mode) { return; } if (e.Action == NotifyCollectionChangedAction.Add) { Settings.Instance.Mode = EditModeEnum.Draw; PreviousMode = EditModeEnum.Draw; } }
/// <summary> /// Saves the changes done to the current record on the recordset. /// </summary> /// <remarks>If the recordset is not batch enabled this method saves the changes on the database.</remarks> public override void Update() { DataRow theRow = CurrentRow; if (theRow == null) { return; } if (newRow) { Tables[0].Rows.Add(theRow); index = Tables[0].Rows.IndexOf(theRow); newRow = false; dbRow = null; } int Action = -1; int Save = 0; if (theRow.RowState != DataRowState.Unchanged) { if (theRow.RowState == DataRowState.Added) { Save = -1; editMode = EditModeEnum.dbEditAdd; //AIS-TODO: Check if data row is empty do not call database operation if (CheckNullState(theRow)) { return; } } OnValidating(ref Save, ref Action); if (Action == 0) { editMode = EditModeEnum.dbEditNone; return; } if (!isBatchEnabled()) { UpdateWithNoEvents(theRow); } } editMode = EditModeEnum.dbEditNone; }
public void SetEditMode(EditModeEnum aEditMode) { print("EditorManager - EditMode changed to " + aEditMode.ToString()); this.editMode = aEditMode; this.selectionState = SelectionStateEnum.DEFAULT; this.blockGhost = null; switch (this.editMode) { case EditModeEnum.ADD: this.placeView.SetActive(true); break; case EditModeEnum.REMOVE: this.placeView.SetActive(false); // this.placeView.enabled = false; break; case EditModeEnum.SELECT: this.placeView.SetActive(false); // this.placeView.enabled = false; break; } }
/// <summary> /// Sets the recordset on edit mode. /// </summary> public void Edit() { editMode = EditModeEnum.dbEditNone; }
/// <summary> /// Creates a new record. /// </summary> public override void AddNew() { doAddNew(); editMode = EditModeEnum.dbEditAdd; }
public EmployeeDetailForm(EditModeEnum editMode) { InitializeComponent(); _editMode = editMode; }
/// <summary> /// Deletes the current record or a group of records. /// </summary> /// <param name="deleteBehavior">AffectEnum value indicating if the deletion applies to the current group or a group.</param> public void Delete(int deleteBehavior) { Exception exceptionToThrow = null; EventStatusEnum status = EventStatusEnum.adStatusOK; string[] errors = null; OnWillChangeRecord(EventReasonEnum.adRsnDelete, ref status, 1); if (status != EventStatusEnum.adStatusCancel) { try { if (!isBatchEnabled() || editMode != EditModeEnum.adEditNone) { editMode = EditModeEnum.adEditDelete; } DataRow deletingRow; switch (deleteBehavior) { case (int)AffectEnum.adAffectCurrent: deletingRow = UsingView ? currentView[index].Row : Tables[0].Rows[index]; break; case (int)AffectEnum.adAffectGroup: deletingRow = UsingView ? currentView[index].Row : Tables[0].Rows[index]; break; default: throw new ArgumentException("Value not allowed to delete."); } deletingRow.Delete(); Update(); } catch (Exception e) { if (!isBatchEnabled() || editMode != EditModeEnum.adEditNone) { editMode = EditModeEnum.adEditInProgress; } errors = new string[] { e.Message }; exceptionToThrow = e; } if (exceptionToThrow != null) { throw exceptionToThrow; } OnRecordChangeComplete(EventReasonEnum.adRsnDelete, ref status, 1, errors); } }
public EditModel(uint id, EditModeEnum editMode) { ID = id; EditMode = editMode; }
/// <summary> /// Array access by index /// </summary> /// <param name="columnIndex">index value</param> /// <returns>object</returns> public override Object this[int columnIndex] { get { return base[columnIndex]; } set { base[columnIndex] = value; if (!isBatchEnabled() || editMode != EditModeEnum.adEditNone) { editMode = EditModeEnum.adEditInProgress; } firstChange = firstChange ? false : firstChange; } }
/// <summary> /// Saves the current content of the ADORecordsetHelper to the database. /// </summary> /// <param name="reportMove">Bool flag that indicates if this operation will notify others process raising an event or not.</param> private void Update(bool reportMove) { Exception exceptionToThrow = null; EventStatusEnum status = EventStatusEnum.adStatusOK; string[] errors = null; OnWillChangeRecordset(EventReasonEnum.adRsnMove, ref status); if (status != EventStatusEnum.adStatusCancel) { DataRow theRow = CurrentRow; if (newRow) { newRow = false; } if (theRow.RowState != DataRowState.Unchanged) { if (!isBatchEnabled()) { if (UsingView) { dbvRow.EndEdit(); index = findBookmarkIndex(dbvRow.Row); } status = EventStatusEnum.adStatusOK; OnWillChangeRecord(EventReasonEnum.adRsnUpdate, ref status, 1); if (status != EventStatusEnum.adStatusCancel) { try { UpdateWithNoEvents(theRow); editMode = EditModeEnum.adEditNone; } catch (Exception e) { errors = new string[] { e.Message }; exceptionToThrow = e; } OnRecordChangeComplete(EventReasonEnum.adRsnUpdate, ref status, 1, errors); } } } OnRecordsetChangeComplete(EventReasonEnum.adRsnMove, ref status, errors); if (exceptionToThrow != null) { throw exceptionToThrow; } if (reportMove) { Move(0, EventReasonEnum.adRsnMove, EventStatusEnum.adStatusOK); } } }
/// <summary> /// Cancels a pending batch update. /// </summary> public override void CancelBatch() { bool wasNewRow = newRow; EventStatusEnum status = EventStatusEnum.adStatusOK; string[] errors = null; OnWillChangeRecord(wasNewRow ? EventReasonEnum.adRsnUndoAddNew : EventReasonEnum.adRsnUndoUpdate, ref status, 1); if (status != EventStatusEnum.adStatusCancel) { try { base.CancelBatch(); index = -1; editMode = EditModeEnum.adEditNone; } catch (Exception e) { errors = new string[] { e.Message }; } OnRecordChangeComplete(wasNewRow ? EventReasonEnum.adRsnUndoAddNew : EventReasonEnum.adRsnUndoUpdate, ref status, 1, errors); } }
/// <summary> /// Writes all pending batch updates to disk. /// </summary> public void UpdateBatch() { Exception exceptionToThrow = null; if (UsingView) { dbvRow.EndEdit(); index = findBookmarkIndex(dbvRow.Row); } if (isBatchEnabled()) { DbConnection connection = GetConnection(connectionString); using (DbDataAdapter dbAdapter = CreateAdapter(connection, true)) { DataTable changes = UsingView ? currentView.Table.GetChanges() : Tables[0].GetChanges(); if (changes != null) { EventStatusEnum status = EventStatusEnum.adStatusOK; string[] errors = null; OnWillChangeRecord(EventReasonEnum.adRsnUpdate, ref status, 1); if (status != EventStatusEnum.adStatusCancel) { try { dbAdapter.Update(isClone ? currentView.Table.DataSet : this); editMode = EditModeEnum.adEditNone; } catch (Exception e) { errors = new string[] { e.Message }; exceptionToThrow = e; } OnRecordChangeComplete(EventReasonEnum.adRsnUpdate, ref status, 1, errors); if (exceptionToThrow != null) { throw exceptionToThrow; } } } } } }
public EditModel(EditModeEnum editMode) { EditMode = editMode; }
void Awake() { this.selectionState = SelectionStateEnum.DEFAULT; this.editMode = EditModeEnum.ADD; }
public EditMode(EditModeEnum mode = 0) { Mode = mode; }
public void setCurrentEditMode(EditModeEnum newMode) { currentEditMode = newMode; destroyPreviews(); }
/// <summary> /// Creates a new record for an updatable Recordset. /// </summary> public override void AddNew() { //Validations. AddNew is not allowed for Recordset with ReadOnly LockType if (LockType == LockTypeEnum.adLockReadOnly) { throw new NotSupportedException("AddNew is not supported for RecordSets with a LockType " + LockType); } EventStatusEnum status = EventStatusEnum.adStatusOK; OnWillMove(EventReasonEnum.adRsnMove, ref status); string[] errors = null; if (status != EventStatusEnum.adStatusCancel) { OnWillChangeRecord(EventReasonEnum.adRsnAddNew, ref status, 1); if (status != EventStatusEnum.adStatusCancel) { try { if (!isBatchEnabled() || editMode != EditModeEnum.adEditNone) { editMode = EditModeEnum.adEditAdd; } base.AddNew(); if (!UsingView) { Tables[0].Rows.Add(dbRow); base.newRow = false; MoveLast(); } } catch (Exception e) { errors = new string[] { e.Message }; status = EventStatusEnum.adStatusErrorsOccurred; } OnRecordChangeComplete(EventReasonEnum.adRsnAddNew, ref status, 1, errors); } OnMoveComplete(EventReasonEnum.adRsnMove, ref status, errors); } }