void btnSave_Click(object sender, EventArgs e) { string bienSoXe = txtSoxe.Text; string tenXe = txtTenxe.Text; int hangXe = int.Parse(cboHangxe.SelectedValue.ToString()); DateTime time = dtpGuixe.Value; business.AddBike(bienSoXe, tenXe, hangXe, time); MessageBox.Show("Added successfully"); this.Close(); }
void btnRestore_Click(object sender, EventArgs e) { XeView selected = (XeView)this.dgvRecycle.SelectedRows[0].DataBoundItem; var db = new WorkerFileEntities(); XeDeleted restored = db.XeDeleteds.Find(selected.License_Plates); db.XeDeleteds.Remove(restored); db.SaveChanges(); string bienSoXe = selected.License_Plates; string tenXe = selected.Name; int hangXe = business.ReManufacure(selected.Manufacture); DateTime time = DateTime.Parse(selected.Time_Parking); business.AddBike(bienSoXe, tenXe, hangXe, time); MessageBox.Show("Restore Successfully"); this.OnLoad(null); }