コード例 #1
0
        /// <summary>
        /// Adds a new item to the list.
        /// Uses ProcyModes.LocalOnly as default.
        /// Override in your own class to use other ProxyModes
        /// </summary>
        protected override void AddNewCore()
        {
            var portal = new Csla.DataPortal <T>();

            portal.CreateCompleted += (o, e) =>
            {
                // call OnUnhandledAsyncException if failed
                if (e.Error != null)
                {
                    OnUnhandledAsyncException(new ErrorEventArgs(this, e.Error));
                }
                else
                {
                    try
                    {
                        this.Add(e.Object);
                        OnAddedNew(e.Object);
                    }
                    catch (Exception ex)
                    {
                        OnUnhandledAsyncException(new ErrorEventArgs(this, ex));
                    }
                }
            };

            portal.BeginCreate();
        }
コード例 #2
0
ファイル: ProductList1.xaml.cs プロジェクト: BiYiTuan/csla
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
   MarkBusy(true);
   var dp = new Csla.DataPortal<InvLib.ProductEdit>();
   dp.DeleteCompleted += (o, e1) =>
     {
       MarkBusy(false);
       _selectedItem = null;
       this.ViewEditContent.Content = null;
       ((CslaDataProvider)Resources["ProductList"]).Refresh();
     };
   InvLib.ProductList.ClearCache();
   dp.BeginDelete(new Csla.SingleCriteria<InvLib.ProductEdit, int>(_selectedItem.Id));
 }
コード例 #3
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            MarkBusy(true);
            var dp = new Csla.DataPortal <InvLib.ProductEdit>();

            dp.DeleteCompleted += (o, e1) =>
            {
                MarkBusy(false);
                _selectedItem = null;
                this.ViewEditContent.Content = null;
                ((CslaDataProvider)Resources["ProductList"]).Refresh();
            };
            InvLib.ProductList.ClearCache();
            dp.BeginDelete(new Csla.SingleCriteria <InvLib.ProductEdit, int>(_selectedItem.Id));
        }
コード例 #4
0
 public static ModuloFuncionalidadList Get(ModuloFuncionalidadCriteria criteria)
 {
     return(DataPortal.Fetch <ModuloFuncionalidadList>(criteria));
 }