private void saveSlowToolStripMenuItem_Click(object sender, EventArgs e) { var businessDays = RepositoryManager.GetAllBusinessDay(); var dates = businessDays.Select(d => d.Identifier.Date); DateTime selectedDate; using (var selector = new DateTimePickerForm(dates)) { var result = selector.ShowDialog(); if (result != DialogResult.OK) return; selectedDate = selector.DateTime; } SaveBusinessDay(new BusinessDayIdentifier(selectedDate)); MessageBox.Show(this, "Yeey, bang salvo com sucesso!", "Sucesso :)", MessageBoxButtons.OK); }
private void loadToolStripMenuItem1_Click(object sender, EventArgs e) { var businessDays = RepositoryManager.GetAllBusinessDay(); if (!businessDays.Any()) { MessageBox.Show(this, $"Não tem nenhum dia salvo no repositório...{Environment.NewLine}Logo não tem o que load.", "Woops :/", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dates = businessDays.Select(d => d.Identifier.Date); DateTime selectedDate; using (var selector = new DateTimePickerForm(dates)) { var result = selector.ShowDialog(); if (result != DialogResult.OK) return; selectedDate = selector.DateTime; } LoadSimpleBusinessDay(new BusinessDayIdentifier(selectedDate)); MessageBox.Show(this, "Yeey, dia carregado com sucesso!", "Sucesso :)", MessageBoxButtons.OK); }
private void FormContextMenu_LoadClick(object sender, EventArgs e) { var identifiers = BusinessDayRepository.Identifiers.ToArray(); if (identifiers.Length == 0) { MessageBox.Show(this, "O repositório está vazio.", "Repositório vazio", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dates = identifiers.GroupBy(d => d.DateTime.Date).Select(g => g.Key); using (var picker = new DateTimePickerForm(dates)) { var result = picker.ShowDialog(this); if (result != DialogResult.OK) return; LoadBusinessDay(picker.DateTime); } }