private void loadDataButton_Click(object sender, EventArgs e) { using (FileStream fs = new FileStream("Emporium.dat", FileMode.OpenOrCreate)) { _emporium = (Emporium)_formatter.Deserialize(fs); } foreach (var department in _emporium.Departments) { int rowNumber = dataGridView1.Rows.Add(); dataGridView1.Rows[rowNumber].Cells["NameOfDepartment"].Value = department.Name; dataGridView1.Rows[rowNumber].Cells["AreaOfDepartment"].Value = department.Square.Area / 10_000; dataGridView1.Rows[rowNumber].Cells["FreeAreaOfDepartment"].Value = department.Square.FreeArea / 10_000; } systemTextBox.Text = @"Данные загружены успешно"; EmporiumCreated(); RefreshEmporiumData(); }
private void createEmporiumButton_Click(object sender, EventArgs e) { _emporium = new Emporium(nameOfEmporiumTextBox.Text, Int32.Parse(budgetTextBox.Text)); EmporiumCreated(); RefreshEmporiumData(); }
public Department(string name, int area, Emporium emporium) { _name = name; Square = new Square(area); Emporium = emporium; }