コード例 #1
0
        private void DoubleClickSale(Point point)
        {
            Car car = _dgvMain.GetCar();

            if (car == null)
            {
                return;
            }

            PTSList ptsList = PTSList.getInstance();
            PTS     pts     = ptsList.getItem(car);

            STSList stsList = STSList.getInstance();
            STS     sts     = stsList.getItem(car);

            if ((_dgvCar.Columns[point.X].HeaderText == "№ ПТС") && (!string.IsNullOrEmpty(pts.File)))
            {
                WorkWithFiles.openFile(pts.File);
            }
            else if ((_dgvCar.Columns[point.X].HeaderText == "№ СТС") && (!string.IsNullOrEmpty(sts.File)))
            {
                WorkWithFiles.openFile(sts.File);
            }
            else
            {
                CarSaleList carSaleList = CarSaleList.getInstance();
                CarSale     carSale     = carSaleList.getItem(car.ID);

                Car_Sale carSaleForm = new Car_Sale(carSale);
                if (carSaleForm.ShowDialog() == DialogResult.OK)
                {
                    loadCars();
                }
            }
        }
コード例 #2
0
        internal override object[] getRow()
        {
            MileageList mileageList = MileageList.getInstance();
            Mileage     mileage     = mileageList.getItem(this);
            InvoiceList invoiceList = InvoiceList.getInstance();
            Invoice     invoice     = invoiceList.getItem(this);

            PTSList ptsList = PTSList.getInstance();
            PTS     pts     = ptsList.getItem(this);

            STSList stsList = STSList.getInstance();
            STS     sts     = stsList.getItem(this);

            Regions regions    = Regions.getInstance();
            string  regionName = (invoice == null) ? regions.getItem(_idRegionUsing) : regions.getItem(Convert.ToInt32(invoice.RegionToID));

            int      mileageInt  = 0;
            DateTime mileageDate = DateTime.Today;

            if (mileage != null)
            {
                int.TryParse(mileage.Count, out mileageInt);
                mileageDate = mileage.MonthToString();
            }

            return(new object[] { ID, ID, BBNumber, Grz, Mark.Name, info.Model, vin, regionName,
                                  info.Driver.GetName(NameType.Full), pts.Number, sts.Number, Year, mileageInt,
                                  mileageDate, info.Owner, info.Guarantee, GetStatus() });
        }
コード例 #3
0
ファイル: CreateDocument.cs プロジェクト: BBraunRussia/BBAuto
        private WordDoc CreateProxyOnSTO()
        {
            WordDoc wordDoc = openDocumentWord("Доверенность на предоставление интересов на СТО");

            DriverCarList driverCarList = DriverCarList.getInstance();

            Driver driver = (_invoice == null) ? driverCarList.GetDriver(_car) : driverList.getItem(Convert.ToInt32(_invoice.DriverToID));

            MyDateTime myDate = new MyDateTime(DateTime.Today.ToShortDateString());

            wordDoc.setValue("текущая дата", myDate.ToLongString());

            String fio = String.Empty;

            if (driver != null)
            {
                fio = driver.GetName(NameType.Full);
            }

            wordDoc.setValue("ФИО регионального представителя", fio);

            PassportList passportList = PassportList.getInstance();

            Passport passport = null;

            if (driver != null)
            {
                passport = passportList.getLastPassport(driver);
            }

            string passportToString = "нет данных";

            if (passport != null)
            {
                passportToString = string.Concat(passport.Number, ", выдан ", passport.GiveDate.ToShortDateString(), ", ", passport.GiveOrg, ", Адрес: ", passport.Address);
            }

            wordDoc.setValue("паспорт регионального представителя", passportToString);

            string fullNameAuto = string.Concat(_car.Mark.Name, " ", _car.info.Model);

            wordDoc.setValue("Название марки автомобиля", fullNameAuto);
            wordDoc.setValue("VIN-автомобиля", _car.vin);
            wordDoc.setValue("Модель и марка двигателя автомобиля", _car.eNumber);
            wordDoc.setValue("Номер кузова автомобиля", _car.bodyNumber);
            wordDoc.setValue("Год выпуска автомобиля", _car.Year);
            wordDoc.setValue("Цвет автомобиля", _car.info.Color);

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

            string ptsName = string.Concat(pts.Number, ", выдан ", pts.Date.ToShortDateString(), " ", pts.GiveOrg);

            wordDoc.setValue("ПТС автомобиля", ptsName);
            wordDoc.setValue("ГРЗ автомобиля", _car.Grz);
            wordDoc.setValue("текущий год", DateTime.Today.Year.ToString());

            return(wordDoc);
        }
コード例 #4
0
        public override void Save()
        {
            DeleteFile(File);

            File = WorkWithFiles.fileCopyByID(File, "cars", Car.ID, "", "PTS");

            _provider.Insert("PTS", Car.ID, Number, Date, GiveOrg, File);

            PTSList ptsList = PTSList.getInstance();

            ptsList.Add(this);
        }
コード例 #5
0
ファイル: CarSale.cs プロジェクト: BBraunRussia/BBAuto
        internal override object[] getRow()
        {
            InvoiceList invoiceList = InvoiceList.getInstance();
            Invoice     invoice     = invoiceList.getItem(Car);

            PTSList ptsList = PTSList.getInstance();
            PTS     pts     = ptsList.getItem(Car);

            STSList stsList = STSList.getInstance();
            STS     sts     = stsList.getItem(Car);

            int idRegion = 0;

            int.TryParse(Car.regionUsingID.ToString(), out idRegion);

            Regions regions    = Regions.getInstance();
            string  regionName = (invoice == null) ? regions.getItem(idRegion) : regions.getItem(Convert.ToInt32(invoice.RegionToID));

            return(new object[] { ID, ID, Car.BBNumber, Car.Grz, regionName, _date, comm, pts.Number, sts.Number, Car.GetStatus() });
        }
コード例 #6
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();
        }
コード例 #7
0
ファイル: CarForm.cs プロジェクト: Mario-Kart-Felix/BBAuto
        private void fillFields()
        {
            cbMark.SelectedValue  = (_car.Mark != null) ? _car.Mark.Id.ToString() : "0";
            cbModel.SelectedValue = _car.ModelID;
            cbGrade.SelectedValue = _car.GradeID;
            /* когда Audi не заполняется таблица с инфо о машине */
            if (dgvCarInfo.DataSource == null)
            {
                ChangedGrade();
            }
            cbColor.SelectedValue = _car.ColorID;

            tbBbNumber.Text             = _car.BBNumber;
            tbVin.Text                  = _car.vin;
            tbYear.Text                 = _car.Year;
            tbENumber.Text              = _car.eNumber;
            tbBodyNumber.Text           = _car.bodyNumber;
            mtbGRZ.Text                 = _car.Grz;
            cbOwner.SelectedValue       = _car.ownerID;
            cbRegionBuy.SelectedValue   = _car.RegionBuyID;
            cbRegionUsing.SelectedValue = _car.regionUsingID;
            cbDriver.SelectedValue      = _car.driverID;
            cbDealer.SelectedValue      = _car.idDiller;
            dtpDateOrder.Value          = _car.dateOrder;
            chbIsGet.Checked            = _car.IsGet;
            dtpDateGet.Value            = _car.dateGet;
            tbEvents.Text               = _car.events;
            tbCost.Text                 = _car.cost.ToString();
            tbDOP.Text                  = _car.dop;

            Driver driver = _driverCarList.GetDriver(_car) ?? new Driver();

            llDriver.Text = driver.GetName(NameType.Full);

            //если не назначен водитель
            if (driver.Region != null)
            {
                lbRegion.Text = driver.Region.Name;
            }

            PTSList ptsList = PTSList.getInstance();

            _pts = ptsList.getItem(_car);
            mtbNumberPTS.Text = _pts.Number;
            dtpDatePTS.Value  = _pts.Date;
            tbGiveOrgPTS.Text = _pts.GiveOrg;
            TextBox tbFilePTS = ucFilePTS.Controls["tbFile"] as TextBox;

            tbFilePTS.Text = _pts.File;

            STSList stsList = STSList.getInstance();

            _sts = stsList.getItem(_car);
            mtbNumberSTS.Text = _sts.Number;
            dtpDateSTS.Value  = _sts.Date;
            tbGiveOrgSTS.Text = _sts.GiveOrg;
            TextBox tbFileSTS = ucFileSTS.Controls["tbFile"] as TextBox;

            tbFileSTS.Text = _sts.File;

            Mileage mileage = _mileageList.getItem(_car);

            if (mileage != null)
            {
                lbMileage.Text = mileage.ToString();
            }

            ChangeDealer(_car.idDiller);

            if (_car.Lising == string.Empty)
            {
                lbLising.Visible  = false;
                mtbLising.Visible = false;
                chbLising.Checked = false;
            }
            else
            {
                lbLising.Visible  = true;
                mtbLising.Visible = true;
                chbLising.Checked = true;
                mtbLising.Text    = _car.Lising;
            }

            tbInvertoryNumber.Text = _car.InvertoryNumber;
        }
コード例 #8
0
        private void DoubleClickDefault(Point point)
        {
            Car car = _dgvMain.GetCar();

            if (car == null)
            {
                return;
            }

            /*TODO: Столяровой доступ к информации про водителя и основную о машине */
            if (User.getDriver().UserRole == RolesList.AccountantWayBill && _dgvCar.Columns[point.X].HeaderText != "Водитель")
            {
                OpenCarAddEdit(car);
                return;
            }

            PTSList ptsList = PTSList.getInstance();
            PTS     pts     = ptsList.getItem(car);

            STSList stsList = STSList.getInstance();
            STS     sts     = stsList.getItem(car);

            string columnName = _dgvCar.Columns[point.X].HeaderText;

            if (_dgvCar.Columns[point.X].HeaderText == "VIN")
            {
                formCarInfo formcarInfo = new formCarInfo(car);
                formcarInfo.ShowDialog();
            }
            else if (_dgvCar.Columns[point.X].HeaderText == "Водитель")
            {
                if (isCellNoHeader(point.X))
                {
                    DriverCarList driverCarList = DriverCarList.getInstance();
                    Driver        driver        = driverCarList.GetDriver(car);

                    if (driver == null)
                    {
                        return;
                    }

                    DriverList     driverList = DriverList.getInstance();
                    Driver_AddEdit dAE        = new Driver_AddEdit(driver);
                    if (dAE.ShowDialog() == DialogResult.OK)
                    {
                        loadCars();
                    }
                }
            }
            else if ((_dgvCar.Columns[point.X].HeaderText == "№ ПТС") && (!string.IsNullOrEmpty(pts.File)))
            {
                WorkWithFiles.openFile(pts.File);
            }
            else if ((_dgvCar.Columns[point.X].HeaderText == "№ СТС") && (!string.IsNullOrEmpty(sts.File)))
            {
                WorkWithFiles.openFile(sts.File);
            }
            else if (DGVSpecialColumn.CanFiltredActual(columnName))
            {
                _myFilter.SetFilterValue(string.Concat(columnName, ":"), point);
            }
            else
            {
                OpenCarAddEdit(car);
            }
        }