コード例 #1
0
        public override void Grabar()
        {
            opcionesUIBindingSource.RaiseListChangedEvents = false;
            opcionesUIBindingSource.EndEdit();

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                m_Opcion.ChequearReglas();
                if (!m_Opcion.IsValid)
                {
                    throw new ValidationException();
                }

                codigoTextEdit.Focus();
                base.Grabar();
            }
            catch (ValidationException)
            {
                XtraMessageBox.Show(m_Opcion.BrokenRulesCollection.ToString(),
                                    "Grabar",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
            }
            catch (DataPortalException ex)
            {
                XtraMessageBox.Show(ex.BusinessException.Message,
                                    "Grabar",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message,
                                    "Grabar",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }

            opcionesUIBindingSource.RaiseListChangedEvents = true;
        }
コード例 #2
0
        public frmOpcionesUI(Opcion _opcionesUI)
        {
            InitializeComponent();

            m_Opcion = _opcionesUI;
            opcionesUIBindingSource.DataSource = _opcionesUI;
            if (opcionesUIBindingSource.Count > 0)
            {
                gdvOpciones.BestFitColumns();
            }
            if (listaPlantillasBindingSource.Count > 0)
            {
                gdvListaPlantillas.BestFitColumns();
            }
            m_Opcion.ChequearReglas();
            btnRoles.Click += bbiRoles_ItemClick;
            Text            = string.Format("Lista de Opciones de {0}", m_Opcion.Nombre);
            Cursor.Current  = Cursors.Default;
        }