private async void btnInsert_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0) { return; } if (DGrid.CurrentRow == null) { return; } var list = await SerializedDataBussines.GetDivarRegionAsync(); var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var reg = list.FirstOrDefault(q => q.Guid == guid); if (reg == null) { return; } var frm = new frmMatchRegionMain(reg); frm.ShowDialog(this); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async Task LoadDataAsync() { try { var list = await SerializedDataBussines.GetDivarRegionAsync(); if (cmbState.SelectedValue != null && (Guid)cmbState.SelectedValue != Guid.Empty) { list = list.Where(q => q.CityGuid == (Guid)cmbState.SelectedValue).ToList(); } regBindingSource.DataSource = list.ToSortableBindingList(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }