Beispiel #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow dgr = dataGridView1.CurrentRow;
                dgr.Cells["LicenseNumber"].Value = this.tbxCarLicenceNumber.Text;
                dgr.Cells["CarType"].Value       = this.tbxCarType.Text;
                dgr.Cells["EngineNumber"].Value  = this.tbxCarEngineNumber.Text;
                dgr.Cells["CarcaseNumber"].Value = this.tbxCarcaseNumber.Text;
                dgr.Cells["InsuranceDate"].Value = this.tbxCarInsuranceDate.Text;
                dgr.Cells["RoadtollDate"].Value  = this.tbxCarRoadtollDate.Text;
                dgr.Cells["CheckDate"].Value     = this.tbxCarCheckDate.Text;

                DDCarInfo newCar = new DDCarInfo("CarID", Convert.ToInt32(dgr.Cells["CarID"].Value));
                newCar.LicenseNumber = this.tbxCarLicenceNumber.Text;
                newCar.CarType       = this.tbxCarType.Text;
                newCar.EngineNumber  = this.tbxCarEngineNumber.Text;
                newCar.CarcaseNumber = this.tbxCarcaseNumber.Text;
                newCar.InsuranceDate = this.tbxCarInsuranceDate.Text;
                newCar.RoadtollDate  = this.tbxCarRoadtollDate.Text;
                newCar.CheckDate     = this.tbxCarCheckDate.Text;
                newCar.Save();
                MessageBox.Show("信息更新成功!", "提示信息");
            }
            catch
            {
                MessageBox.Show("信息更新错误,请检查数据库是否连接正确!", "提示信息");
            }
        }
Beispiel #2
0
        public void Update(int CarID, string LicenseNumber, string CarType, string EngineNumber, string CarcaseNumber, string InsuranceDate, string RoadtollDate, string CheckDate, int?PawnageID)
        {
            DDCarInfo item = new DDCarInfo();

            item.MarkOld();
            item.IsLoaded = true;

            item.CarID = CarID;

            item.LicenseNumber = LicenseNumber;

            item.CarType = CarType;

            item.EngineNumber = EngineNumber;

            item.CarcaseNumber = CarcaseNumber;

            item.InsuranceDate = InsuranceDate;

            item.RoadtollDate = RoadtollDate;

            item.CheckDate = CheckDate;

            item.PawnageID = PawnageID;

            item.Save(UserName);
        }