예제 #1
0
파일: Cars.cs 프로젝트: Progoff-inc/KR
 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;
 }
예제 #2
0
        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();
        }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
파일: Cars.cs 프로젝트: Progoff-inc/KR
 public void CloseCarForm()
 {
     FillCars(cars = ctrl.GetCars());
     chCarForm.Hide();
 }