예제 #1
0
        protected void CancelEdit(T item)
        {
            Grid.CancelEditRow(item);
            int Id    = (int)ReflectionExten.GetPropValue(item, "Id");
            var value = dsource.FindIndex(x => (int)ReflectionExten.GetPropValue(x, "Id") == Id);

            dsource[value] = temp;
        }
예제 #2
0
        protected async void DeleteRow(T item)
        {
            try
            {
                loading.Visible = true;
                int Id = (int)ReflectionExten.GetPropValue(item, "Id");
                await DeleteData(Id);

                dsource.Remove(item);
                count = dsource.Count;
                await ShowNotification(new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "Успешно", Detail = "Успешно Удалено", Duration = 1500 });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                await ShowNotification(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "Ошибка", Detail = string.IsNullOrEmpty(ErrorMessage) ? "Ошибка при получении" : ErrorMessage, Duration = 2500 });
            }
            finally
            {
                loading.Visible = false;
                await Grid.Reload();
            }
        }
예제 #3
0
 protected async virtual Task UpdateData(T item)
 {
     int Id = (int)ReflectionExten.GetPropValue(item, "Id");
     await serv.UpdateAsync <T>(item, Id, ApiUrl);
 }