void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new CompanyVehcileBO(); try { objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt()); objMaster.Delete(objMaster.Current); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
private void InitializeConstructor() { dtpFrontLeft.Value = DateTime.Now.ToDate(); dtpFrontRight.Value = DateTime.Now.ToDate(); dtpRearLeft.Value = DateTime.Now.ToDate(); dtpRearRight.Value = DateTime.Now.ToDate(); txtFrontLeftMileage.Value = 0; txtFrontRightMileage.Value = 0; txtRearLeftMileage.Value = 0; txtRearRightMileage.Value = 0; dtpManfDate.Value = DateTime.Now.ToDate(); dtpServicesDate.Value = DateTime.Now.ToDate(); dtpRoadTaxExp.Value = DateTime.Now.ToDate(); dtpMOTExp.Value = DateTime.Now.ToDate(); dtpPlateExp.Value = DateTime.Now.ToDate(); dtpPlateEx2.Value = DateTime.Now.ToDate(); dtpPlateEx3.Value = DateTime.Now.ToDate(); dtpInsuranceExpiry.Value = DateTime.Now.ToDate(); objMaster = new CompanyVehcileBO(); this.SetProperties((INavigation)objMaster); //objTyreTransaction = new CompanyVehicleTyreTransactionBO(); //this.SetProperties((INavigation)objTyreTransaction); }
public frmCompanyVehcileList() { InitializeComponent(); grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick); grdLister.RowsChanging += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging); objMaster = new CompanyVehcileBO(); this.SetProperties((INavigation)objMaster); grdLister.ShowRowHeaderColumn = false; this.Shown += new EventHandler(frmCompanyVehcileList_Shown); grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick); }