예제 #1
0
        protected void editCommand()
        {
            DomainObject entity = (DomainObject)getSelectedEntity();

            if (entity == null)
            {
                return;
            }

            EntityDetailForm form;

            try
            {
                form = createEntityDetailForm(entity.Id);
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }
            catch (Exception ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            if (form.ShowDialog() == DialogResult.OK)
            {
                onEntityUpdated(form.Entity);
            }
        }
예제 #2
0
        private void mnPrint_Click(object sender, EventArgs e)
        {
            VezbaEditorBaseForm childForm = this.ActiveMdiChild as VezbaEditorBaseForm;

            if (childForm == null)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            try
            {
                PreviewDialog p = new PreviewDialog();
                p.setIzvestaj(new VezbaIzvestaj(childForm));
                p.ShowDialog();
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
            }
            catch (Exception ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
            }
            finally
            {
                Cursor.Hide();
                Cursor.Current = Cursors.Arrow;
            }
        }
예제 #3
0
 private void mnPromenaGimnasticara_Click(object sender, EventArgs e)
 {
     try
     {
         GimnasticariForm f = new GimnasticariForm();
         f.ShowDialog();
     }
     catch (BusinessException ex)
     {
         MessageDialogs.showMessage(ex.Message, this.Text);
     }
     catch (InfrastructureException ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
 }
예제 #4
0
 private void mnPregledElemenata_Click(object sender, EventArgs e)
 {
     try
     {
         PregledElemenataForm f = new PregledElemenataForm();
         f.ShowDialog();
     }
     catch (BusinessException ex)
     {
         MessageDialogs.showMessage(ex.Message, this.Text);
     }
     catch (InfrastructureException ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
 }
예제 #5
0
 private void mnNaziviGrupa_Click(object sender, EventArgs e)
 {
     try
     {
         GrupeForm f = new GrupeForm();
         f.ShowDialog();
     }
     catch (BusinessException ex)
     {
         MessageDialogs.showMessage(ex.Message, this.Text);
     }
     catch (InfrastructureException ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
 }
예제 #6
0
        protected void deleteCommand()
        {
            DomainObject entity = (DomainObject)getSelectedEntity();

            if (entity == null)
            {
                return;
            }
            if (!MessageDialogs.queryConfirmation(deleteConfirmationMessage(entity), this.Text))
            {
                return;
            }

            try
            {
                using (ISession session = NHibernateHelper.OpenSession())
                    using (session.BeginTransaction())
                    {
                        CurrentSessionContext.Bind(session);
                        if (refIntegrityDeleteDlg(entity))
                        {
                            delete(entity);
                            session.Transaction.Commit();
                            onEntityDeleted(entity);
                        }
                    }
            }
            catch (InfrastructureException ex)
            {
                string errMsg = deleteErrorMessage(entity);
                MessageDialogs.showError(
                    String.Format("{0} \n\n{1}", errMsg, ex.Message),
                    this.Text);
            }
            catch (Exception ex)
            {
                string errMsg = deleteErrorMessage(entity);
                MessageDialogs.showError(
                    String.Format("{0} \n\n{1}", errMsg, ex.Message),
                    this.Text);
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.SessionFactory);
            }
        }
예제 #7
0
 private void mnTabelaElemenata_Click(object sender, EventArgs e)
 {
     try
     {
         TabelaElemenataForm f =
             new TabelaElemenataForm(
                 TabelaElemenataForm.TabelaElemenataFormRezimRada.Edit,
                 Sprava.Undefined);
         f.ShowDialog();
     }
     catch (BusinessException ex)
     {
         MessageDialogs.showMessage(ex.Message, this.Text);
     }
     catch (InfrastructureException ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
 }
예제 #8
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     Cursor.Show();
     try
     {
         PreviewDialog p = new PreviewDialog();
         p.setIzvestaj(new TabelaIzvestaj(tabela));
         p.ShowDialog();
     }
     catch (InfrastructureException ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
     catch (Exception ex)
     {
         MessageDialogs.showError(ex.Message, this.Text);
     }
     finally
     {
         Cursor.Hide();
         Cursor.Current = Cursors.Arrow;
     }
 }
예제 #9
0
        protected void addCommand()
        {
            EntityDetailForm form;

            try
            {
                form = createEntityDetailForm(null);
            }
            catch (InfrastructureException ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }
            catch (Exception ex)
            {
                MessageDialogs.showError(ex.Message, this.Text);
                return;
            }

            if (form.ShowDialog() == DialogResult.OK)
            {
                onEntityAdded(form.Entity);
            }
        }