コード例 #1
0
ファイル: BiracClanaDialog.cs プロジェクト: stankela/clanovi
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (SelectedClan == null)
            {
                MessageDialogs.showMessage("Izaberite clana", this.Text);
                DialogResult = DialogResult.None;
                return;
            }

            this.clan = SelectedClan;
        }
コード例 #2
0
 public void DodajClanaSaKarticom(Clan clan)
 {
     if (Options.Instance.JedinstvenProgram || !Options.Instance.IsProgramZaClanarinu)
     {
         if (!clanoviSaKarticom.ContainsKey(clan.BrojKartice.Value))
         {
             clanoviSaKarticom.Add(clan.BrojKartice.Value, clan);
         }
     }
     else
     {
         Form1.Instance.sendToPipeClient(DODAJ_CLANA + " " + clan.Id);
     }
 }
コード例 #3
0
ファイル: BiracClanaDialog.cs プロジェクト: stankela/clanovi
        private void initUI()
        {
            this.Text = "Izaberite clana";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            Font = Options.Instance.Font;

            cmbClan.DropDownStyle = ComboBoxStyle.DropDownList;

            setClanovi(clanovi);
            SelectedClan = null;
        }
コード例 #4
0
        protected override List<object> loadEntities()
        {
            clanovi = loadClanovi();
            setClanovi(clanovi);
            if (clanovi.Count > 0)
                SelectedClan = clanovi[0];
            else
                SelectedClan = null;

            return loadDolasci(SelectedClan, getFromDate(), getToDate());
        }
コード例 #5
0
ファイル: ClanDialog.cs プロジェクト: stankela/clanovi
        private bool hasImePrezimeDatumRodjenjaChanged(Clan c)
        {
            bool equals = string.IsNullOrEmpty(c.Ime) && string.IsNullOrEmpty(oldIme)
                            || (!string.IsNullOrEmpty(c.Ime)
                                && !string.IsNullOrEmpty(oldIme)
                                && c.Ime.ToUpper() == oldIme.ToUpper());
            if (!equals)
                return true;

            equals = string.IsNullOrEmpty(c.Prezime) && string.IsNullOrEmpty(oldPrezime)
                            || (!string.IsNullOrEmpty(c.Prezime)
                                && !string.IsNullOrEmpty(oldPrezime)
                                && c.Prezime.ToUpper() == oldPrezime.ToUpper());
            if (!equals)
                return true;

            equals = c.DatumRodjenja == null && oldDatumRodjenja == null
                            || (c.DatumRodjenja != null
                                && oldDatumRodjenja != null
                                && c.DatumRodjenja.Value == oldDatumRodjenja.Value);
            return !equals;
        }
コード例 #6
0
 private bool napraviKarticuDlg(Clan c, bool testKartica)
 {
     string naslov = "Pravljenje kartice";
     string pitanje;
     if (testKartica)
     {
         pitanje = "Da li zelite da napravite TEST KARTICU?";
     }
     else
     {
         pitanje = String.Format(
         "Da li zelite da napravite karticu za clana \"{0}\"?", c.BrojPrezimeImeDatumRodjenja);
     }
     return MessageDialogs.queryConfirmation(pitanje, naslov);
 }
コード例 #7
0
 private void txtClan_TextChanged(object sender, EventArgs e)
 {
     string text = txtClan.Text;
     Clan clan = null;
     int broj;
     if (int.TryParse(text, out broj))
     {
         clan = findClan(broj);
     }
     else if (text != String.Empty)
     {
         clan = searchForClan(text);
     }
     SelectedClan = clan;
 }
コード例 #8
0
        private List<DolazakNaTrening> getDolasci(Clan c, DateTime from, DateTime to)
        {
            if (c == null || c.Broj == CitacKartica.TEST_KARTICA_BROJ)
                return new List<DolazakNaTrening>();

            List<DolazakNaTrening> result = null;
            try
            {
                using (ISession session = NHibernateHelper.Instance.OpenSession())
                using (session.BeginTransaction())
                {
                    CurrentSessionContext.Bind(session);
                    DolazakNaTreningDAO dolazakNaTreningDAO = DAOFactoryFactory.DAOFactory.GetDolazakNaTreningDAO();
                    result = new List<DolazakNaTrening>(dolazakNaTreningDAO.getDolazakNaTrening(c, from, to));
                }
            }
            catch (Exception ex)
            {
                MessageDialogs.showMessage(ex.Message, "Uplata clanarine");
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }
            if (result == null)
                result = new List<DolazakNaTrening>();
            return result;
        }
コード例 #9
0
 private void showUplateForClan(Clan c)
 {
     setEntities(loadUplateForClan(c));
     //sortByDatumVreme();
 }
コード例 #10
0
        private List<object> loadUplateForClan(Clan c)
        {
            if (c == null)
                return new List<object>();

            UplataClanarineDAO uplataClanarineDAO = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO();
            return new List<UplataClanarine>(uplataClanarineDAO.findUplate(c)).ConvertAll<object>(
                delegate(UplataClanarine u)
                {
                    return u;
                });
        }
コード例 #11
0
        protected override List<object> loadEntities()
        {
            clanovi = loadClanovi();
            setClanovi(clanovi);
            if (clanovi.Count > 0)
                SelectedClan = clanovi[0];
            else
                SelectedClan = null;

            if (rbtClan.Checked)
                return loadUplateForClan(SelectedClan);
            else
                return loadUplateForInterval(dtpOd.Value.Date, dtpDo.Value.Date);
        }
コード例 #12
0
ファイル: MergeClanoviForm.cs プロジェクト: stankela/clanovi
        private List<UplataClanarine> loadUplate(Clan c)
        {
            if (c == null)
                return new List<UplataClanarine>();

            UplataClanarineDAO uplataClanarineDAO = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO();
            List<UplataClanarine> result = new List<UplataClanarine>(uplataClanarineDAO.findUplate(c));
            if (result == null)
                result = new List<UplataClanarine>();
            Util.sortByVaziOdDesc(result);
            return result;
        }
コード例 #13
0
ファイル: MergeClanoviForm.cs プロジェクト: stankela/clanovi
        private void updateClanUI(Clan clan, TextBox txtId, TextBox txtBroj, TextBox txtIme, TextBox txtPrezime,
            TextBox txtDatumRodjenja, TextBox txtAdresa, TextBox txtMesto, TextBox txtTelefon1,
            TextBox txtTelefon2, CheckBox ckbPristupnica, CheckBox ckbKartica, List<UplataClanarine> uplate)
        {
            if (clan == null)
            {
                txtBroj.Text = String.Empty;
                txtIme.Text = String.Empty;
                txtPrezime.Text = String.Empty;
                txtDatumRodjenja.Text = String.Empty;
                txtAdresa.Text = String.Empty;
                txtMesto.Text = String.Empty;
                txtTelefon1.Text = String.Empty;
                txtTelefon2.Text = String.Empty;
                ckbPristupnica.Checked = false;
                ckbKartica.Checked = false;
                return;
            }

            txtId.Text = clan.Id.ToString();
            txtBroj.Text = clan.Broj.ToString();
            txtIme.Text = clan.Ime;
            txtPrezime.Text = clan.Prezime;

            txtDatumRodjenja.Text = String.Empty;
            if (clan.DatumRodjenja != null)
                txtDatumRodjenja.Text = clan.DatumRodjenja.Value.ToString("dd.MM.yyyy");

            txtAdresa.Text = clan.Adresa;

            txtMesto.Text = String.Empty;
            if (clan.Mesto != null)
                txtMesto.Text = clan.Mesto.Naziv;

            txtTelefon1.Text = clan.Telefon1;
            txtTelefon2.Text = clan.Telefon2;

            ckbPristupnica.Checked = clan.ImaPristupnicu;
            ckbKartica.Checked = clan.ImaKarticu;
        }
コード例 #14
0
 private void setSelectedClan(Clan clan)
 {
     // NOTE: Da bi radilo ispravno, Clan mora da implementira Equals i GetHashCode
     List<object> items = (List<object>)dataGridView1.DataSource;
     int index = items.IndexOf(clan);
     if (index >= 0)
         getCurrencyManager().Position = index;
 }
コード例 #15
0
 private Clan createTestClan()
 {
     Clan result = new Clan();
     result.Broj = CitacKartica.TEST_KARTICA_BROJ;
     result.Prezime = CitacKartica.TEST_KARTICA_NAME;
     return result;
 }
コード例 #16
0
        private void findPrethodneUplateAndNeplaceniDolasci(Clan SelectedClan)
        {
            prethodneUplate = getUplate(SelectedClan);

            DateTime from = Options.Instance.NedostajuceUplateStartDate;
            DateTime to = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0).AddSeconds(-1);
            List<DolazakNaTrening> dolasci = getDolasci(SelectedClan, from, to);

            neplaceniDolasci = findNeplaceniDolasci(dolasci, from, to, prethodneUplate);
        }
コード例 #17
0
 public UplataClanarine findUplata(Clan clan)
 {
     if (uplateGodisnjaClanarina.ContainsKey(clan.Id))
     {
         return uplateGodisnjaClanarina[clan.Id];
     }
     if (ovomesecneUplate.ContainsKey(clan.Id))
     {
         return ovomesecneUplate[clan.Id][0];
     }
     if (prethodneUplate.ContainsKey(clan.Id))
     {
         List<UplataClanarine> uplate = prethodneUplate[clan.Id];
         Util.sortByVaziOdDesc(uplate);
         return uplate[0];
     }
     return null;
 }
コード例 #18
0
        private List<UplataClanarine> getUplate(Clan c)
        {
            if (c == null || c.Broj == CitacKartica.TEST_KARTICA_BROJ)
                return new List<UplataClanarine>();

            List<UplataClanarine> uplate = null;
            try
            {
                using (ISession session = NHibernateHelper.Instance.OpenSession())
                using (session.BeginTransaction())
                {
                    CurrentSessionContext.Bind(session);
                    UplataClanarineDAO uplataClanarineDAO = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO();
                    uplate = new List<UplataClanarine>(uplataClanarineDAO.findUplate(c));
                }
            }
            catch (Exception ex)
            {
                MessageDialogs.showMessage(ex.Message, "Uplata clanarine");
            }
            finally
            {
                CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory);
            }

            if (uplate == null)
                uplate = new List<UplataClanarine>();
            Util.sortByVaziOdDesc(uplate);
            return uplate;
        }
コード例 #19
0
        private List<object> loadDolasci(Clan c, DateTime from, DateTime to)
        {
            if (c == null)
                return new List<object>();

            DolazakNaTreningDAO dolazakNaTreningDAO = DAOFactoryFactory.DAOFactory.GetDolazakNaTreningDAO();
            return new List<DolazakNaTrening>(dolazakNaTreningDAO.getDolazakNaTrening(c, from, to)).ConvertAll<object>(
                delegate(DolazakNaTrening u)
                {
                    return u;
                });
        }
コード例 #20
0
        private void initUI()
        {
            this.Text = "Pravljenje kartice";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            Font = Options.Instance.Font;

            ckbKartica.Checked = false;
            cmbClan.DropDownStyle = ComboBoxStyle.DropDownList;

            setClanovi(clanovi);
            SelectedClan = null;
        }
コード例 #21
0
 private void txtSifraClana_TextChanged(object sender, EventArgs e)
 {
     dataGridView1.DataSource = null;
     string text = txtSifraClana.Text;
     Clan clan = null;
     int broj;
     if (int.TryParse(text, out broj))
     {
         clan = findClan(broj);
     }
     else if (text != String.Empty)
     {
         clan = searchForClan(text);
     }
     SelectedClan = clan;
 }
コード例 #22
0
 private void txtSifraClana_TextChanged(object sender, System.EventArgs e)
 {
     string text = txtSifraClana.Text;
     Clan clan = null;
     int broj;
     if (int.TryParse(text, out broj))
     {
         clan = findClan(broj);
     }
     else if (text != String.Empty)
     {
         clan = searchForClan(text);
     }
     SelectedClan = clan;
     ckbKartica.Checked = SelectedClan != null && SelectedClan.ImaKarticu;
 }
コード例 #23
0
ファイル: ClanDialog.cs プロジェクト: stankela/clanovi
        protected override void updateUIFromEntity(DomainObject entity)
        {
            Clan c = (Clan)entity;
            if (c == null)
              c = new Clan();

            txtBroj.Text = c.Broj.ToString();
            txtIme.Text = c.Ime;
            txtPrezime.Text = c.Prezime;

            txtDatumRodjenja.Text = String.Empty;
            if (c.DatumRodjenja != null)
                txtDatumRodjenja.Text = c.DatumRodjenja.Value.ToString("dd-MM-yyyy");

            txtAdresa.Text = c.Adresa;
            SelectedMesto = c.Mesto;
            txtTelefon1.Text = c.Telefon1;
            txtTelefon2.Text = c.Telefon2;
            SelectedInstitucija = c.Institucija;
            txtNapomena.Text = c.Napomena;
            ckbPristupnica.Checked = c.ImaPristupnicu;
            ckbKartica.Checked = c.ImaKarticu;
        }