Ejemplo n.º 1
0
 private async Task SetRelatedRegionsAsync(string onlineRegion)
 {
     try
     {
         if (string.IsNullOrEmpty(onlineRegion)) return;
         var op = await AdvertiseRelatedRegionBussines.GetAllAsync(onlineRegion);
         foreach (var item in op)
             for (var i = 0; i < DGrid.RowCount; i++)
                 if (item.LocalRegionGuid == ((Guid?)DGrid[dgGuid.Index, i].Value ?? Guid.Empty))
                     DGrid[dgIsChecked.Index, i].Value = true;
     }
     catch (Exception ex)
     {
         WebErrorLog.ErrorInstence.StartErrorLog(ex);
     }
 }
Ejemplo n.º 2
0
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var list = await AdvertiseRelatedRegionBussines.GetAllAsync(Region.Name.Trim());

                var res = await AdvertiseRelatedRegionBussines.RemoveRangeAsync(list);
                if (res.HasError)
                {
                    frmNotification.PublicInfo.ShowMessage(res.ErrorMessage);
                    return;
                }

                await LoadRegionsAsync();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
Ejemplo n.º 3
0
        private async Task LoadRegionsAsync()
        {
            try
            {
                _token?.Cancel();
                _token = new CancellationTokenSource();
                var list = await RegionsBussines.GetAllAsync((Guid.Parse(Settings.Classes.clsEconomyUnit.EconomyCity)), _token.Token);
                var allRelated = await AdvertiseRelatedRegionBussines.GetAllAsync();
                var query =
                    from c in list
                    where !(from o in allRelated
                            select o.LocalRegionGuid)
                        .Contains(c.Guid)
                    select c;
                regBingingSource.DataSource = query.OrderBy(q => q.Name).ToSortableBindingList();

                await SetRelatedRegionsAsync(Region.Name.Trim());
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }