private void CloseMonthPeriod(object sender, EventArgs e) { if (_activePeriod == null) { MessageBox.Show("Žádne období k ukončení", "Upozornění", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ICollection <MonthReport> report = AdministrationLogic.GetPeriodReport(_activePeriod); AdministrationLogic.EndPeriod(_activePeriod); _activePeriod = null; using (StreamWriter writer = new StreamWriter("report.txt")) { foreach (MonthReport r in report) { string payed; if (r.Payed) { payed = "ano"; } else { payed = "ne"; } string row = string.Format("{0} Zakaznik: {1}; Adresou {2}; Material: {3}; Mnozstvi aboslutniho alkoholu: {4}; Cena: {5}; Zaplaceno: {6}", r.Date.ToShortDateString(), r.Surename, r.Adress, r.MaterialName, r.AbsVolume, r.Price, payed); writer.WriteLine(row); } } Reload(); }
public NewDistillationForm() { InitializeComponent(); Season season = AdministrationLogic.GetActiveSeason(); Period period = AdministrationLogic.GetActivePeriod(); _distillation = new Distillation { StartTime = DateTime.Now, Date = DateTime.Today.Date, Payed = false, Season = season, Season_Id = season.Id, Period = period, Period_Id = period.Id }; _reqTBs = new List <TextBox> { tbAmount, tbDistVolume, tbPercAlc }; materialCB.DataSource = MaterialLogic.GetAllMaterial(); materialCB.DisplayMember = "Name"; tbPeriod.Text = period.Name; tbSeason.Text = season.Name; }
private void NewDistClick(object sender, EventArgs e) { if (AdministrationLogic.GetActivePeriod() != null && AdministrationLogic.GetActiveSeason() != null) { NewDistillationForm ndf = new NewDistillationForm(); AddMdiChild(ndf); } else { MessageBox.Show("Není nastavená sezóna nebo měsíční období přejděte do administrace.", "Upozornění", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void NewMonthPeriod(object sender, EventArgs e) { if (_activePeriod != null) { MessageBox.Show("Před vytvořením nového období je třeba ukončit poslední období.", "Upozornění", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } NewPeriodForm npf = new NewPeriodForm(); if (npf.ShowDialog() == DialogResult.OK) { _activePeriod = AdministrationLogic.StartPeriod(npf.NewPeriod); MessageBox.Show("Nové období bylo vytvořeno.", "Informace", MessageBoxButtons.OK, MessageBoxIcon.Information); Reload(); } }
private void SaveClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(periodNameTBox.Text)) { MessageBox.Show("Není vypněno jméno období!", "Upozorneni", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Period p = new Period { Name = periodNameTBox.Text, StartDate = startDate.Value, EndDate = null, Finished = false, Season = AdministrationLogic.GetActiveSeason(), Season_Id = AdministrationLogic.GetActiveSeason().Id }; NewPeriod = p; DialogResult = DialogResult.OK; }
private void NewSeason(object sender, EventArgs e) { if (_activePeriod != null) { if (MessageBox.Show("Aktuální sezóna obsahuje neukončené období, chcete jej ukončit?", "Upozornění", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CloseMonthPeriod(null, null); } else { return; } } NewSeasonForm nsf = new NewSeasonForm(); if (nsf.ShowDialog() == DialogResult.OK) { _activeSeason = AdministrationLogic.StartSeason(_activeSeason, nsf.NewSeason); MessageBox.Show("Nová sezóna je vytvořena.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); Reload(); } }
private void NewPeriodForm_Load(object sender, EventArgs e) { seasonTBox.Text = AdministrationLogic.GetActiveSeason().Name; startDate.Value = DateTime.Today; }
public AdministrationForm() { InitializeComponent(); _activeSeason = AdministrationLogic.GetActiveSeason(); _activePeriod = AdministrationLogic.GetActivePeriod(); }
public AdministrationController(AdministrationLogic businessLayer) { _businessLayer = businessLayer; }