private void btnOK_Click(object sender, EventArgs e) { if (SelectedClan == null) { MessageDialogs.showMessage("Izaberite clana", this.Text); DialogResult = DialogResult.None; return; } this.clan = SelectedClan; }
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); } }
private void initUI() { this.Text = "Izaberite clana"; this.FormBorderStyle = FormBorderStyle.FixedDialog; Font = Options.Instance.Font; cmbClan.DropDownStyle = ComboBoxStyle.DropDownList; setClanovi(clanovi); SelectedClan = null; }
protected override List<object> loadEntities() { clanovi = loadClanovi(); setClanovi(clanovi); if (clanovi.Count > 0) SelectedClan = clanovi[0]; else SelectedClan = null; return loadDolasci(SelectedClan, getFromDate(), getToDate()); }
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; }
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); }
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; }
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; }
private void showUplateForClan(Clan c) { setEntities(loadUplateForClan(c)); //sortByDatumVreme(); }
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; }); }
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); }
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; }
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; }
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; }
private Clan createTestClan() { Clan result = new Clan(); result.Broj = CitacKartica.TEST_KARTICA_BROJ; result.Prezime = CitacKartica.TEST_KARTICA_NAME; return result; }
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); }
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; }
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; }
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; }); }
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; }
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; }
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; }
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; }