private void mnNedostajuceUplate_Click(object sender, EventArgs e) { BiracIntervala dlg; try { dlg = new BiracIntervala("Nedostajuce uplate", false, false, true); dlg.ShowDialog(); } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } if (dlg.DialogResult != DialogResult.OK) return; PrintOrExportForm form = new PrintOrExportForm(); if (form.ShowDialog() != DialogResult.OK) return; bool exportToFile = form.Eksportuj; String fileName = ""; if (exportToFile) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Title = "Snimi izvestaj"; saveFileDialog1.Filter = "Text Documents (*.txt)|*.txt"; saveFileDialog1.FileName = "Nedostajuce uplate.txt"; if (saveFileDialog1.ShowDialog() != DialogResult.OK) return; fileName = saveFileDialog1.FileName; } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); if (exportToFile) { StreamWriter streamWriter = File.CreateText(fileName); streamWriter.WriteLine("NEDOSTAJU\u0106E UPLATE"); streamWriter.WriteLine(""); List<object[]> items = new DolazakNaTreningMesecniLista(dlg.OdDatum, dlg.DoDatum, true).getItems(); foreach (object[] item in items) { streamWriter.WriteLine(item[0].ToString() + '\t' + item[1].ToString() + '\t' + item[2].ToString()); } streamWriter.Close(); } else { PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new DolazakNaTreningMesecniIzvestaj(dlg.OdDatum, dlg.DoDatum, true)); p.ShowDialog(); } } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void mnEvidencijaPrisustvaNaTreningu_Click(object sender, EventArgs e) { BiracIntervala dlg; try { dlg = new BiracIntervala("Dolazak na trening", true, true, false); dlg.DateTimePickerFrom.CustomFormat = "dd.MM.yyyy HH:mm"; dlg.DateTimePickerTo.CustomFormat = "dd.MM.yyyy HH:mm"; dlg.ShowDialog(); } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } if (dlg.DialogResult != DialogResult.OK) return; Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new EvidencijaTreningaIzvestaj(dlg.ClanId, dlg.OdDatumVreme, dlg.DoDatumVreme, dlg.Grupe)); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void mnIzvestajiCenovnik_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new CenovnikIzvestaj()); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void mnAktivniClanovi_Click(object sender, EventArgs e) { BiracIntervala dlg; try { dlg = new BiracIntervala("Aktivni clanovi", false, false, false); dlg.ShowDialog(); } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } if (dlg.DialogResult != DialogResult.OK) return; Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new AktivniClanoviIzvestaj(dlg.OdDatum.Date, dlg.DoDatum.Date)); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void mnUplateClanova_Click(object sender, EventArgs e) { BiracClana dlg; try { dlg = new BiracClana("Izvestaj o uplatama clanova"); dlg.ShowDialog(); } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } if (dlg.DialogResult != DialogResult.OK) return; bool ceoIzvestaj = dlg.CeoIzvestaj; int idClana = dlg.IdClana; if (idClana < 0) ceoIzvestaj = true; Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new UplateClanovaIzvestaj(ceoIzvestaj, idClana)); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void mnUplataClanarine_Click(object sender, EventArgs e) { if (!dozvoliOtvaranjeProzora()) return; UplataClanarineDialog dlg; try { dlg = new UplataClanarineDialog(null); dlg.ShowDialog(); } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } if (dlg.DialogResult != DialogResult.OK) return; CitacKarticaDictionary.Instance.DodajUplate(dlg.Uplate); string naslov = "Uplata clanarine"; string pitanje = "Da li zelite da stampate potvrdu o uplati?"; PotvrdaDialog dlg2 = new PotvrdaDialog(naslov, pitanje); if (dlg2.ShowDialog() != DialogResult.Yes) return; try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); List<int> idList = new List<int>(); foreach (UplataClanarine u in dlg.Uplate) { idList.Add(u.Id); } p.printWithoutPreview(new PotvrdaIzvestaj(idList)); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); } }
private void mnPrihodiDnevniKategorije_Click(object sender, EventArgs e) { BiracDana dlg = new BiracDana("Izvestaj o prihodima"); if (dlg.ShowDialog() != DialogResult.OK) return; List<Grupa> grupeBezKategorija; try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); grupeBezKategorija = new List<Grupa>(DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO(). getGrupeBezKategorija(dlg.Datum.Date)); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); return; } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); return; } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); } if (grupeBezKategorija.Count > 0) { GrupeBezKategorijaDialog d = new GrupeBezKategorijaDialog(grupeBezKategorija); d.ShowDialog(); return; } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); p.setIzvestaj(new DnevniPrihodiKategorijeIzvestaj(dlg.Datum.Date)); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); Cursor.Hide(); Cursor.Current = Cursors.Arrow; } }
private void btnStampaj_Click(object sender, System.EventArgs e) { // TODO: Probaj da promenis i EntityListForm i EntityDetailForm tako da // rade za bilo koji objekt (da mogu da se koriste i za npr. DTO objekte) UplataClanarine uplata = (UplataClanarine)getSelectedEntity(); if (uplata == null) return; try { using (ISession session = NHibernateHelper.Instance.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); PreviewDialog p = new PreviewDialog(); List<int> idList = new List<int>(); idList.Add(uplata.Id); p.setIzvestaj(new PotvrdaIzvestaj(idList)); p.ShowDialog(); } } catch (InfrastructureException ex) { MessageDialogs.showError(ex.Message, this.Text); } catch (Exception ex) { MessageDialogs.showError(ex.Message, this.Text); } finally { CurrentSessionContext.Unbind(NHibernateHelper.Instance.SessionFactory); } }