public override void PopulateData() { try { using (TaxiDataContext db = new TaxiDataContext()) { listOfData = db.stp_GetDriversList(AppVars.DefaultDriverSubCompanyId).OrderBy(item => item.No, new NaturalSortComparer <string>()).ToList(); } //listOfData= (from a in General.GetQueryable<Fleet_Driver>(c => c.IsActive == true && (c.SubcompanyId == AppVars.DefaultDriverSubCompanyId || AppVars.DefaultDriverSubCompanyId == 0)) // .AsEnumerable().OrderBy(item => item.DriverNo, new NaturalSortComparer<string>()) // select new // { // Id = a.Id, // No = a.DriverNo, // Name = a.DriverName, // VehicleNo = a.VehicleNo, // VehicleType = a.Fleet_VehicleType.VehicleType, // MOTExpiry = a.MOTExpiryDate, // MOT2Expiry = a.MOT2ExpiryDate, // PCOVehicleExpiry = a.PCOVehicleExpiryDate, // InsuranceExpiry = a.InsuranceExpiryDate, // PCODriverExpiry = a.PCODriverExpiryDate, // LicenseExpiry = a.DrivingLicenseExpiryDate, // RoadTaxExpiry=a.RoadTaxiExpiryDate, // MobileNo = a.MobileNo, // EndDate=a.LastEndDate, // DriverTypeId=a.DriverTypeId // }).ToList(); if (IsFirstLoaded == false) { grdLister.Columns.Clear(); IsFirstLoaded = true; } if (IsClosed) { return; } //if (this.InvokeRequired) //{ // UIDelegate del = new UIDelegate(PopulateUI); // this.BeginInvoke(del,list); //} //else //{ // PopulateUI(list); //} } catch (Exception ex) { hasError = true; //if (this.InvokeRequired) //{ // hasError = true; // UIMessage del = new UIMessage(ShowUI); // this.BeginInvoke(del, true, "There is a Problem on fetching data from server. Please try again or refresh it.."); //} //else //{ // has // ShowUI(true, "There is a problem on fetching data from server. Please try again or refresh it.."); //} } }