public MainForm() { InitializeComponent(); mainController = new Controller(); mainDataStorage = DataStorage.get(); mainController.registerSalon(DEFAULT_SALON_ADRESS, DEFAULT_SALON_NAME); this.Text = "Управление салоном \"" + mainDataStorage.getSalon().name + "\" (" + mainDataStorage.getSalon().address + ")"; showPanel(0); }
public Salon(String address, String name, int id) { this.address = address; this.id = id; this.name = name; this.masterList = new List <Master>(); this.recordList = new List <Record>(); mainDataStorage = DataStorage.get(); openHour = DEFAUILT_OPEN_TIME; closeHour = DEFAUILT_CLOSE_TIME; }
private void buttonCreateReport_Click(object sender, EventArgs e) { if (monthCalendarReport.SelectionStart != null && monthCalendarReport.SelectionEnd != null) { DataStorage dataStorage = DataStorage.get(); List <String> salonReport; salonReport = dataStorage.getSalon().getStatistics(monthCalendarReport.SelectionStart, monthCalendarReport.SelectionEnd); try { System.IO.File.WriteAllLines(AppDomain.CurrentDomain.BaseDirectory + "salonStatistic.htm", salonReport); } catch (Exception exception) { MessageBox.Show("Ошибка сохранения отчета - " + exception.Message, "Ошибка сохранения", MessageBoxButtons.OK); } System.Diagnostics.Process.Start(AppDomain.CurrentDomain.BaseDirectory + "salonStatistic.htm"); this.Close(); } }
/// <summary> /// Возвращает список часов, свободных для записи /// </summary> /// <param name="day">Дата, для которой ищутся свободные часы</param> public List <int> getFreeHours(DateTime day) { mainDataStorage = DataStorage.get(); List <int> fullHours = new List <int>(); List <int> freeHours = new List <int>(); foreach (Record record in recordList) { if (record.day == day) { fullHours.Add(record.hour); } } for (int hour = mainDataStorage.getSalon().openHour; hour <= mainDataStorage.getSalon().closeHour; hour++) { if (!fullHours.Contains(hour)) { freeHours.Add(hour); } } return(freeHours); }
public Controller() { this.mainDataStorage = DataStorage.get(); }