public void Add(PTS pts) { if (list.Exists(x => x == pts)) return; list.Add(pts); }
protected override void loadFromSql() { DataTable dt = _provider.Select("PTS"); foreach (DataRow row in dt.Rows) { PTS pts = new PTS(row); Add(pts); } }
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 void fillFields() { cbMark.SelectedValue = (_car.Mark != null) ? _car.Mark.ID.ToString() : "0"; cbModel.SelectedValue = _car.ModelID; cbGrade.SelectedValue = _car.GradeID; 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(); changeDiler(_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; }