示例#1
0
        private void EditEndingLookup(object sender, System.Windows.Controls.DataFormEditEndingEventArgs e)
        {
            if (m_gridReady)
            {
                DataForm dataForm = sender as DataForm;

                if (dataForm.CurrentItem != null)
                {
                    int lookupType = (int)SIPDialPlanLookupTypes.SpeedDial;
                    if (dataForm == m_enumsDataForm)
                    {
                        lookupType = (int)SIPDialPlanLookupTypes.ENUM;
                    }
                    else if (dataForm == m_cnamDataForm)
                    {
                        lookupType = (int)SIPDialPlanLookupTypes.CNAM;
                    }

                    if (dataForm.Mode == DataFormMode.AddNew)
                    {
                        SIPDialplanLookup lookup = dataForm.CurrentItem as SIPDialplanLookup;
                        lookup.ID         = Guid.NewGuid().ToString();
                        lookup.DialPlanID = m_dialPlan.ID;
                        lookup.Owner      = m_owner;
                        lookup.LookupType = lookupType;
                    }
                }
            }
        }
 private void dfrSatisfacaoFuncionario_EditEnding(object sender, DataFormEditEndingEventArgs e)
 {
     if (e.EditAction.Equals(DataFormEditAction.Commit))
     {
         try
         {
             satisfacaoFuncionarioSetDomainDataSource.SubmitChanges();
             MessageBox.Show("Satisfação do Funcionario atualizado");
         }
         catch (Exception ex)
         {
             MessageBox.Show(string.Format("Atualização da Satisfação do Funcionario Falhou: {0}", ex.ToString()));
         }
     }
 }
示例#3
0
        private void EditEndingRoute(object sender, System.Windows.Controls.DataFormEditEndingEventArgs e)
        {
            if (m_gridReady)
            {
                DataForm dataForm = sender as DataForm;

                if (dataForm.Mode == DataFormMode.AddNew)
                {
                    SIPDialplanRoute route = dataForm.CurrentItem as SIPDialplanRoute;
                    route.ID         = Guid.NewGuid().ToString();
                    route.DialPlanID = m_dialPlan.ID;
                    route.Owner      = m_owner;
                }
            }
        }
 /// <summary>
 /// Raises the ItemEditEnding event.
 /// </summary>
 /// <param name="e">The event args.</param>
 protected virtual void OnItemEditEnding(DataFormEditEndingEventArgs e)
 {
     EventHandler<DataFormEditEndingEventArgs> handler = this.EditEnding;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        /// <summary>
        /// Commits the edit of the current item.
        /// </summary>
        /// <param name="exitEditingMode">Whether or not editing mode should be exited after committing the edit.</param>
        /// <returns>True if the commit succeeds; false otherwise.</returns>
        public bool CommitEdit(bool exitEditingMode)
        {
            if (!this.CanCommitEdit)
            {
                return false;
            }

            DataFormEditEndingEventArgs e = new DataFormEditEndingEventArgs(DataFormEditAction.Commit);
            this.OnItemEditEnding(e);

            if (e.Cancel)
            {
                return false;
            }

            if (!this.ValidateItem())
            {
                return false;
            }

            if (!this.IsAddingNew)
            {
                try
                {
                    this._isCommitting = true;

                    if (this.EditableCollectionView != null)
                    {
                        this.EditableCollectionView.CommitEdit();
                    }
                    else
                    {
                        IEditableObject currentEditableObject = this._lastItem as IEditableObject;

                        if (currentEditableObject != null)
                        {
                            currentEditableObject.EndEdit();
                        }
                    }
                }
                finally
                {
                    this._isCommitting = false;
                }
            }
            else
            {
                this.CommitAppend();
            }

            this._editablePropertiesOriginalValues.Clear();
            this._editedProperties.Clear();

            if (exitEditingMode)
            {
                this.EndEdit();
            }

            this.UpdateButtonsAndStates();
            this.OnItemEditEnded(new DataFormEditEndedEventArgs(DataFormEditAction.Commit));

            if (!exitEditingMode)
            {
                this.BeginEdit(false /* startingNewEdit */);
            }

            return true;
        }
        /// <summary>
        /// Cancels the editing of the current item.
        /// </summary>
        /// <returns>Whether or not the cancellation was successful.</returns>
        public bool CancelEdit()
        {
            if (!this.CanCancelEdit)
            {
                return false;
            }

            DataFormEditEndingEventArgs e = new DataFormEditEndingEventArgs(DataFormEditAction.Cancel);
            this.OnItemEditEnding(e);

            if (e.Cancel)
            {
                return false;
            }

            DataFormMode oldMode = this.Mode;

            if (!this.IsAddingNew)
            {
                if (this.EditableCollectionView != null)
                {
                    if (this.EditableCollectionView.CanCancelEdit)
                    {
                        this.EditableCollectionView.CancelEdit();
                    }
                }
                else
                {
                    IEditableObject currentEditableObject = this._lastItem as IEditableObject;

                    if (currentEditableObject != null)
                    {
                        currentEditableObject.CancelEdit();
                    }
                }
            }
            else
            {
                this.CancelAppend();
            }

            this._fieldLevelErrors.Clear();
            this._entityLevelErrors.Clear();

            if (this._validationSummary != null)
            {
                Debug.Assert(this._validationSummary.Errors != null, "ValidationSummary.Errors should never be null.");
                this._validationSummary.Errors.Clear();
            }

            this.IsItemValid = true;
            this._editablePropertiesOriginalValues.Clear();
            this._editedProperties.Clear();
            this.EndEdit();
            this.UpdateButtonsAndStates();
            this.OnItemEditEnded(new DataFormEditEndedEventArgs(DataFormEditAction.Cancel));

            // 


            if (this._lastItem != null)
            {
                IDictionary<Type, FrameworkElement> contentsNew = null;

                if (oldMode == DataFormMode.Edit)
                {
                    contentsNew = this._editContentsNew;
                }
                else if (oldMode == DataFormMode.AddNew)
                {
                    contentsNew = this._addNewContentsNew;
                }

                if (contentsNew != null)
                {
                    this.RemoveContentForType(this._lastItem.GetType(), contentsNew);
                }
            }

            // We need to re-generate UI, which won't happen automatically
            // if we're in auto-edit mode, so force a generation.
            if (this.AutoEdit && !this._forcedEndEdit)
            {
                this.GenerateUI();
            }

            return true;
        }
 private void dfrConvenio_EditEnding(object sender, DataFormEditEndingEventArgs e)
 {
     if (e.EditAction.Equals(DataFormEditAction.Commit))
     {
         try
         {
             convenioPlanoSaudeSetDomainDataSource.SubmitChanges();
             MessageBox.Show("Dados do Convênio atualizados");
         }
         catch (Exception ex)
         {
             MessageBox.Show(string.Format("Atualização de Dados do Convênio Falhou: {0}", ex.ToString()));
         }
     }
 }
        private void dfrServico_EditEnding(object sender, DataFormEditEndingEventArgs e)
        {
            if (e.EditAction.Equals(DataFormEditAction.Commit))
            {
                try
                {
                    servicoMedicoSetDomainDataSource.SubmitChanges();
                    MessageBox.Show("Serviço Médico atualizado");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Atualização de Serviço Médico Falhou: {0}", ex.ToString()));
                }
            }

            dfrServico.CurrentItem = servicoMedicoSetDataGrid.SelectedItem;

            servicoAnteriorEscolhido.nome = ((ServicoMedicoSet)dfrServico.CurrentItem).nome;
            servicoAnteriorEscolhido.descricao = ((ServicoMedicoSet)dfrServico.CurrentItem).descricao;
            servicoAnteriorEscolhido.preco = ((ServicoMedicoSet)dfrServico.CurrentItem).preco;
        }