public Cars(RentCarController ctrl, Form1 parent) { this.ctrl = ctrl; this.parent = parent; InitializeComponent(); label1.TextAlign = ContentAlignment.MiddleCenter; cars = ctrl.GetCars(); comboBox1.Text = "Цена"; radioButton1.Checked = true; }
private void Statistics_Load(object sender, EventArgs e) { dateTimePicker1.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dateTimePicker2.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1); _cars = _ctrl.GetCars(); _ratingCars = _cars.Select(x => new CarRating { Model = x.Model, ReportsNumber = _ctrl.GetCarReports(x.CarId).Count, Mark = GetCarMark(x.CarId) }).OrderByDescending(x => x.Mark).ToList(); for (int i = 0; i < _ratingCars.Count; i++) { _ratingCars[i].Id = i + 1; } carRatingBindingSource.DataSource = _ratingCars; _books = _ctrl.GetBooks(); ReloadProfits(); }
private void ShowRating() { excelworksheet = (Worksheet)excelapp.Worksheets.get_Item(3); var cars = _ctrl.GetCars(); for (int m = 0; m < cars.Count; m++) { var excelcells = (Range)excelworksheet.Cells[m + 2, 1]; //выводим координаты ячеек excelcells.Value2 = cars[m].Model; excelcells = (Range)excelworksheet.Cells[m + 2, 2]; var marks = _ctrl.GetCarMarks(cars[m].CarId); if (marks.Count > 0) { excelcells.Value2 = marks.Average(); } else { excelcells.Value2 = 0; } } }
public void CloseCarForm() { FillCars(cars = ctrl.GetCars()); chCarForm.Hide(); }