Exemplo n.º 1
0
        public SudijaFilter getFilter()
        {
            if (!validateFilter())
            {
                return(null);
            }

            SudijaFilter result = new SudijaFilter();

            result.Ime     = txtIme.Text.Trim();
            result.Prezime = txtPrezime.Text.Trim();

            if (cmbPol.SelectedIndex == cmbPol.Items.IndexOf(MUSKI))
            {
                result.Pol = Pol.Muski;
            }
            else if (cmbPol.SelectedIndex == cmbPol.Items.IndexOf(ZENSKI))
            {
                result.Pol = Pol.Zenski;
            }

            result.Drzava = cmbDrzava.SelectedItem as Drzava;
            result.Klub   = cmbKlub.SelectedItem as Klub;
            return(result);
        }
Exemplo n.º 2
0
        private void filterSudijaUserControl1_Filter(object sender, EventArgs e)
        {
            SudijaFilter flt = filterSudijaUserControl1.getFilter();

            if (flt != null)
            {
                filter(flt);
            }
        }
Exemplo n.º 3
0
        private void filter(SudijaFilter flt)
        {
            ISession session = null;

            try
            {
                using (session = NHibernateHelper.Instance.OpenSession())
                    using (session.BeginTransaction())
                    {
                        CurrentSessionContext.Bind(session);

                        IList <Sudija> sudije;
                        if (flt.isEmpty())
                        {
                            sudije = DAOFactoryFactory.DAOFactory.GetSudijaDAO().FindAll();
                        }
                        else
                        {
                            sudije = DAOFactoryFactory.DAOFactory.GetSudijaDAO().FindSudije(
                                flt.Ime, flt.Prezime, flt.Pol, flt.Drzava, flt.Klub);
                        }
                        SetItems(sudije);
                        dataGridViewUserControl1.Focus();
                        updateEntityCount();
                    }
            }
            catch (Exception ex)
            {
                if (session != null && session.Transaction != null && session.Transaction.IsActive)
                {
                    session.Transaction.Rollback();
                }
                MessageDialogs.showError(
                    Strings.getFullDatabaseAccessExceptionMessage(ex), this.Text);
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }
        }