private void btnAddCar_Click(object sender, EventArgs e) { try { if (mlCustomerID == 0) { throw new Exception("请先保存客户资料,再添加车辆!"); } frmCarEdit frmCar = new frmCarEdit(0); LBShowForm.ShowDialog(frmCar); LoadCarDataSource(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void GrdCar_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { DataRowView drvSelect = this.grdCar.Rows[e.RowIndex].DataBoundItem as DataRowView; long lCarID = drvSelect["CarID"] == DBNull.Value ? 0 : Convert.ToInt64(drvSelect["CarID"]); if (lCarID > 0) { frmCarEdit frmCar = new frmCarEdit(lCarID); LBShowForm.ShowDialog(frmCar); LoadCarDataSource(); } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }