コード例 #1
0
ファイル: CarForm.cs プロジェクト: Mario-Kart-Felix/BBAuto
        private void ChangedGrade()
        {
            if (_load)
            {
                int id = 0;
                if (cbGrade.SelectedValue != null)
                {
                    int.TryParse(cbGrade.SelectedValue.ToString(), out id);
                }

                if (id == 0)
                {
                    return;
                }

                GradeList gradeList = GradeList.getInstance();
                Grade     grade     = gradeList.getItem(id);

                DataTable dt = _car.info.ToDataTable();

                DataTable dt2 = grade.ToDataTable();
                foreach (DataRow row in dt2.Rows)
                {
                    dt.Rows.Add(row.ItemArray);
                }

                dgvCarInfo.DataSource = dt;
            }
        }
コード例 #2
0
        public override void Save()
        {
            ID = Convert.ToInt32(_provider.Insert("Grade", ID, Name, EPower, EVol, MaxLoad, NoLoad, EngineType.ID, Model.ID));

            GradeList gradeList = GradeList.getInstance();

            gradeList.Add(this);
        }
コード例 #3
0
        private void loadGrade()
        {
            int       idModel = 0;
            GradeList grades  = GradeList.getInstance();

            int.TryParse(cbModel.SelectedValue.ToString(), out idModel);


            _dgv.DataSource            = grades.ToDataTable(idModel);
            _dgv.Columns["id"].Visible = false;
        }
コード例 #4
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            GradeList grades = GradeList.getInstance();

            int idGrade = 0;

            foreach (DataGridViewCell cell in _dgv.SelectedCells)
            {
                int.TryParse(_dgv.Rows[cell.RowIndex].Cells[0].Value.ToString(), out idGrade);

                grades.Delete(idGrade);
            }

            loadGrade();
        }
コード例 #5
0
ファイル: CarForm.cs プロジェクト: Mario-Kart-Felix/BBAuto
        private void loadGrade()
        {
            if (_load)
            {
                int idModel = 0;
                if (cbModel.SelectedValue != null)
                {
                    int.TryParse(cbModel.SelectedValue.ToString(), out idModel);
                }
                GradeList grades = GradeList.getInstance();

                cbGrade.DataSource    = grades.ToDataTable(idModel);
                cbGrade.DisplayMember = "Название";
                cbGrade.ValueMember   = "id";
            }
        }
コード例 #6
0
        private void _dgv_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if ((e.ColumnIndex < 0) || (e.RowIndex < 0))
            {
                return;
            }

            int idGrade = Convert.ToInt32(_dgv.Rows[e.RowIndex].Cells[0].Value);

            GradeList grades = GradeList.getInstance();
            Grade     grade  = grades.getItem(idGrade);

            Grade_AddEdit aeG = new Grade_AddEdit(grade);

            if (aeG.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                loadGrade();
            }
        }
コード例 #7
0
        public void ShowInvoice()
        {
            _excelDoc = openDocumentExcel("Накладная");

            _excelDoc.setValue(7, 2, _car.info.Owner);

            _excelDoc.setValue(16, 82, _invoice.Number);
            _excelDoc.setValue(16, 98, _invoice.Date.ToShortDateString());

            string fullNameAuto = string.Concat("Автомобиль ", _car.Mark.Name, " ", _car.info.Model, ", ", _car.Grz);

            _excelDoc.setValue(22, 10, fullNameAuto);
            _excelDoc.setValue(22, 53, _car.dateGet.ToShortDateString());

            var grades = GradeList.getInstance();

            var grade = grades.getItem(Convert.ToInt32(_car.GradeID));

            var ptsList = PTSList.getInstance();
            var pts     = ptsList.getItem(_car);

            var fullDetailAuto = string.Concat("VIN ", _car.vin, ", Двигатель ", _car.eNumber, ", № кузова ",
                                               _car.bodyNumber, ", Год выпуска ", _car.Year, " г., Паспорт ",
                                               pts.Number, " от ", pts.Date.ToShortDateString(), ", мощность двигателя ", grade.EPower, " л.с.");

            _excelDoc.setValue(47, 2, fullDetailAuto);

            Driver driver1 = _driverList.getItem(Convert.ToInt32(_invoice.DriverFromID));
            Driver driver2 = _driverList.getItem(Convert.ToInt32(_invoice.DriverToID));

            _excelDoc.setValue(9, 10, driver1.Dept);
            _excelDoc.setValue(56, 11, driver1.Position);
            _excelDoc.setValue(56, 63, driver1.GetName(NameType.Full));

            _excelDoc.setValue(11, 13, driver2.Dept);
            _excelDoc.setValue(60, 11, driver2.Position);
            _excelDoc.setValue(60, 63, driver2.GetName(NameType.Full));

            _excelDoc.Show();
        }