/// <summary>
 /// Factory method. Asynchronously loads a <see cref="DocListGetter"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria parameter of the DocListGetter to fetch.</param>
 /// <param name="callback">The completion callback method.</param>
 public static void GetDocListGetter(DocListFilteredCriteria docListFilteredCriteria, EventHandler <DataPortalResult <DocListGetter> > callback)
 {
     DataPortal.BeginFetch <DocListGetter>(docListFilteredCriteria, (o, e) =>
     {
         if (e.Error != null)
         {
             throw e.Error;
         }
         if (!DocClassNVL.IsCached)
         {
             DocClassNVL.SetCache(e.Object.DocClassNVL);
         }
         if (!DocTypeNVL.IsCached)
         {
             DocTypeNVL.SetCache(e.Object.DocTypeNVL);
         }
         if (!DocStatusNVL.IsCached)
         {
             DocStatusNVL.SetCache(e.Object.DocStatusNVL);
         }
         if (!UserNVL.IsCached)
         {
             UserNVL.SetCache(e.Object.UserNVL);
         }
         callback(o, e);
     });
 }
 /// <summary>
 /// Factory method. Asynchronously creates a new <see cref="DocEditGetter"/> unit of objects.
 /// </summary>
 /// <param name="callback">The completion callback method.</param>
 public static void NewDocEditGetter(EventHandler <DataPortalResult <DocEditGetter> > callback)
 {
     // DataPortal_Fetch is used as ReadOnlyBase<T> doesn't allow the use of DataPortal_Create.
     DataPortal.BeginFetch <DocEditGetter>(new Criteria1(true, new int()), (o, e) =>
     {
         if (e.Error != null)
         {
             throw e.Error;
         }
         if (!DocClassNVL.IsCached)
         {
             DocClassNVL.SetCache(e.Object.DocClassNVL);
         }
         if (!DocTypeNVL.IsCached)
         {
             DocTypeNVL.SetCache(e.Object.DocTypeNVL);
         }
         if (!DocStatusNVL.IsCached)
         {
             DocStatusNVL.SetCache(e.Object.DocStatusNVL);
         }
         if (!UserNVL.IsCached)
         {
             UserNVL.SetCache(e.Object.UserNVL);
         }
         callback(o, e);
     });
 }
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="DocEditGetter"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docID">The DocID parameter of the DocEditGetter to fetch.</param>
 /// <param name="callback">The completion callback method.</param>
 public static void GetDocEditGetter(int docID, EventHandler <DataPortalResult <DocEditGetter> > callback)
 {
     DataPortal.BeginFetch <DocEditGetter>(new Criteria1(false, docID), (o, e) =>
     {
         if (e.Error != null)
         {
             throw e.Error;
         }
         if (!DocClassNVL.IsCached)
         {
             DocClassNVL.SetCache(e.Object.DocClassNVL);
         }
         if (!DocTypeNVL.IsCached)
         {
             DocTypeNVL.SetCache(e.Object.DocTypeNVL);
         }
         if (!DocStatusNVL.IsCached)
         {
             DocStatusNVL.SetCache(e.Object.DocStatusNVL);
         }
         if (!UserNVL.IsCached)
         {
             UserNVL.SetCache(e.Object.UserNVL);
         }
         callback(o, e);
     });
 }
 /// <summary>
 /// Loads a <see cref="DocListGetter"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="docListFilteredCriteria">The fetch criteria.</param>
 protected void DataPortal_Fetch(DocListFilteredCriteria docListFilteredCriteria)
 {
     LoadProperty(DocListProperty, DocList.GetDocList(docListFilteredCriteria));
     LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL());
     LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL());
     LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL());
     LoadProperty(UserNVLProperty, UserNVL.GetUserNVL());
 }
 /// <summary>
 /// Loads a <see cref="DocListGetter"/> unit of objects.
 /// </summary>
 protected void DataPortal_Fetch()
 {
     LoadProperty(DocListProperty, DocList.GetDocList());
     LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL());
     LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL());
     LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL());
     LoadProperty(UserNVLProperty, UserNVL.GetUserNVL());
 }
 /// <summary>
 /// Loads a <see cref="DocEditUoWGetter"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="docID">The fetch criteria.</param>
 protected void DataPortal_Fetch(int docID)
 {
     LoadProperty(DocProperty, Doc.GetDoc(docID));
     LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL());
     LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL());
     LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL());
     LoadProperty(UserNVLProperty, UserNVL.GetUserNVL());
 }
        /// <summary>
        /// Factory method. Loads a <see cref="DocTypeNVL"/> object.
        /// </summary>
        /// <returns>A reference to the fetched <see cref="DocTypeNVL"/> object.</returns>
        public static DocTypeNVL GetDocTypeNVL()
        {
            if (_list == null)
            {
                _list = DataPortal.Fetch <DocTypeNVL>();
            }

            return(_list);
        }
 /// <summary>
 /// Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
 /// </summary>
 /// <param name="e">The DataPortalContext object passed to the DataPortal.</param>
 protected override void DataPortal_OnDataPortalInvokeComplete(Csla.DataPortalEventArgs e)
 {
     if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Server &&
         e.Operation == DataPortalOperations.Update)
     {
         // this runs on the server
         DocTypeList.InvalidateCache();
         DocTypeNVL.InvalidateCache();
     }
 }
 /// <summary>
 /// Creates or loads a <see cref="DocEditGetter"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="crit">The create/fetch criteria.</param>
 protected void DataPortal_Fetch(Criteria1 crit)
 {
     if (crit.CreateDoc)
     {
         LoadProperty(DocProperty, Doc.NewDoc());
     }
     else
     {
         LoadProperty(DocProperty, Doc.GetDoc(crit.DocID));
     }
     LoadProperty(DocClassNVLProperty, DocClassNVL.GetDocClassNVL());
     LoadProperty(DocTypeNVLProperty, DocTypeNVL.GetDocTypeNVL());
     LoadProperty(DocStatusNVLProperty, DocStatusNVL.GetDocStatusNVL());
     LoadProperty(UserNVLProperty, UserNVL.GetUserNVL());
 }
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="DocTypeNVL"/> object.
 /// </summary>
 /// <param name="callback">The completion callback method.</param>
 public static void GetDocTypeNVL(EventHandler <DataPortalResult <DocTypeNVL> > callback)
 {
     if (_list == null)
     {
         DataPortal.BeginFetch <DocTypeNVL>((o, e) =>
         {
             _list = e.Object;
             callback(o, e);
         });
     }
     else
     {
         callback(null, new DataPortalResult <DocTypeNVL>(_list, null, null));
     }
 }
        /// <summary>
        /// Loads a <see cref="DocTypeNVL"/> collection from the database or from the cache.
        /// </summary>
        protected void DataPortal_Fetch()
        {
            if (IsCached)
            {
                LoadCachedList();
                return;
            }

            using (var cn = new SqlConnection(Database.DocStoreConnection))
            {
                using (var cmd = new SqlCommand("GetDocTypeNVL", cn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cn.Open();
                    var args = new DataPortalHookArgs(cmd);
                    OnFetchPre(args);
                    LoadCollection(cmd);
                    OnFetchPost(args);
                }
            }
            _list = this;
        }
 private void OnDocTypeEditCollSaved(object sender, Csla.Core.SavedEventArgs e)
 {
     // this runs on the client
     DocTypeList.InvalidateCache();
     DocTypeNVL.InvalidateCache();
 }
 /// <summary>
 /// Used by async loaders to load the cache.
 /// </summary>
 /// <param name="list">The list to cache.</param>
 internal static void SetCache(DocTypeNVL list)
 {
     _list = list;
 }
 /// <summary>
 /// Clears the in-memory DocTypeNVL cache so it is reloaded on the next request.
 /// </summary>
 public static void InvalidateCache()
 {
     _list = null;
 }