Пример #1
0
        private void btnCarSelect_Click(object sender, EventArgs e)
        {
            _SelectedID   = null;
            _SelectedText = "";

            // ранее введеные значения
            Pass oPassTemp = new Pass();

            oPass.FilterDateBeg = dtpDatePass.Value.Date.AddMonths(-12);
            oPassTemp.FillData();
            if (oPassTemp.ErrorNumber != 0 || oPassTemp.MainTable == null)
            {
                return;
            }
            if (oPassTemp.MainTable.Rows.Count == 0)
            {
                RFMMessage.MessageBoxError("Нет данных...");
                return;
            }

            DataTable tdCars = CopyTable(oPassTemp.MainTable, "tdCars", "", "CarName");

            if (StartForm(new frmSelectID(this, tdCars, "DatePass, CarName, CarNumber, DriverName, Reason", "Дата, Машина, Гос.номер, Водитель, Назначение", false)) == DialogResult.Yes)
            {
                if (_SelectedID == null)
                {
                    return;
                }
                oPassTemp.ClearData();
                oPassTemp.ReFillOne((int)_SelectedID);
                txtCarNаme.Text        = oPassTemp.CarName;
                txtCarTypeName.Text    = oPassTemp.CarTypeName;
                txtCarNumber.Text      = oPassTemp.CarNumber;
                txtTrailerNumber.Text  = oPassTemp.TrailerNumber;
                txtDriverName.Text     = oPassTemp.DriverName;
                txtDriverDocument.Text = oPassTemp.DriverDocument;
                txtDriverPhone.Text    = oPassTemp.DriverPhone;
                txtReason.Text         = oPassTemp.Reason;
            }
            _SelectedID   = null;
            _SelectedText = "";
        }