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(); } } }
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() }); }
public void SendNotification() { if (DateTime.Today.Day != SEND_DAY) { return; } DiagCardList diagCardList = DiagCardList.getInstance(); List <DiagCard> list = diagCardList.GetDiagCardEnds().ToList(); int begin = 0; int end = 0; if (!ListEmpty(list)) { STSList stsList = STSList.getInstance(); while (end < list.Count) { begin = end; end += ((end + MAILS_COUNT) < list.Count) ? MAILS_COUNT : (list.Count - end); List <DiagCard> listCut = new List <DiagCard>(); for (int i = begin; i < end; i++) { listCut.Add(list[i]); } IEnumerable <Car> carList = diagCardList.GetCarListFromDiagCardList(listCut); List <string> files = new List <string>(); foreach (Car car in carList) { STS sts = stsList.getItem(car); if (sts.File != string.Empty) { files.Add(sts.File); } } string mailText = CreateMail(listCut); EMail email = new EMail(); Driver employeeAutoDept = GetDriverForSending(); email.SendNotification(employeeAutoDept, mailText, true, files); } } }
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() }); }
private ToolStripMenuItem CreateShowSTS() { ToolStripMenuItem item = CreateItem("Свидетельство о регистрации ТС"); item.Click += delegate { Car car = _dgvMain.GetCar(); if (car == null) { return; } STSList stsList = STSList.getInstance(); STS sts = stsList.getItem(car); if (!string.IsNullOrEmpty(sts.File)) { WorkWithFiles.openFile(sts.File); } }; return(item); }
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; }
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); } }