Ejemplo n.º 1
0
 /// <summary>
 /// Loads a <see cref="DocList"/> collection from the database, based on given criteria.
 /// </summary>
 /// <param name="crit">The fetch criteria.</param>
 protected void DataPortal_Fetch(DocListFilteredCriteria crit)
 {
     using (var ctx = ConnectionManager <SqlConnection> .GetManager(Database.DocStoreConnection, false))
     {
         GetQueryGetDocList(crit);
         using (var cmd = new SqlCommand(getDocListInlineQuery, ctx.Connection))
         {
             cmd.CommandType = CommandType.Text;
             cmd.Parameters.AddWithValue("@DocID", crit.DocID == null ? (object)DBNull.Value : crit.DocID.Value).DbType = DbType.Int32;
             cmd.Parameters.AddWithValue("@DocClassID", crit.DocClassID == null ? (object)DBNull.Value : crit.DocClassID.Value).DbType    = DbType.Int32;
             cmd.Parameters.AddWithValue("@DocTypeID", crit.DocTypeID == null ? (object)DBNull.Value : crit.DocTypeID.Value).DbType       = DbType.Int32;
             cmd.Parameters.AddWithValue("@SenderID", crit.SenderID == null ? (object)DBNull.Value : crit.SenderID.Value).DbType          = DbType.Int32;
             cmd.Parameters.AddWithValue("@RecipientID", crit.RecipientID == null ? (object)DBNull.Value : crit.RecipientID.Value).DbType = DbType.Int32;
             cmd.Parameters.AddWithValue("@DocRef", crit.DocRef == null ? (object)DBNull.Value : crit.DocRef).DbType                         = DbType.String;
             cmd.Parameters.AddWithValue("@DocDate", crit.DocDate == null ? (object)DBNull.Value : crit.DocDate.DBValue).DbType              = DbType.Date;
             cmd.Parameters.AddWithValue("@Subject", crit.Subject == null ? (object)DBNull.Value : crit.Subject).DbType                      = DbType.String;
             cmd.Parameters.AddWithValue("@DocStatusID", crit.DocStatusID == null ? (object)DBNull.Value : crit.DocStatusID.Value).DbType    = DbType.Int32;
             cmd.Parameters.AddWithValue("@CreateDate", crit.CreateDate == null ? (object)DBNull.Value : crit.CreateDate.DBValue).DbType     = DbType.DateTime2;
             cmd.Parameters.AddWithValue("@CreateUserID", crit.CreateUserID == null ? (object)DBNull.Value : crit.CreateUserID.Value).DbType = DbType.Int32;
             cmd.Parameters.AddWithValue("@ChangeDate", crit.ChangeDate == null ? (object)DBNull.Value : crit.ChangeDate.DBValue).DbType     = DbType.DateTime2;
             cmd.Parameters.AddWithValue("@ChangeUserID", crit.ChangeUserID == null ? (object)DBNull.Value : crit.ChangeUserID.Value).DbType = DbType.Int32;
             var args = new DataPortalHookArgs(cmd, crit);
             OnFetchPre(args);
             LoadCollection(cmd);
             OnFetchPost(args);
         }
     }
 }
 /// <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>
 /// 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());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Criteria2"/> class.
 /// </summary>
 /// <param name="createDoc">The CreateDoc.</param>
 /// <param name="docID">The DocID.</param>
 /// <param name="createFolder">The CreateFolder.</param>
 /// <param name="folderID">The FolderID.</param>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria.</param>
 public Criteria2(bool createDoc, int docID, bool createFolder, int folderID, DocListFilteredCriteria docListFilteredCriteria)
 {
     CreateDoc               = createDoc;
     DocID                   = docID;
     CreateFolder            = createFolder;
     FolderID                = folderID;
     DocListFilteredCriteria = docListFilteredCriteria;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="SampleUnitOfWork"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docID">The DocID parameter of the SampleUnitOfWork to fetch.</param>
 /// <param name="folderID">The FolderID parameter of the SampleUnitOfWork to fetch.</param>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria parameter of the SampleUnitOfWork to fetch.</param>
 /// <param name="callback">The completion callback method.</param>
 public static void GetSampleUnitOfWork(int docID, int folderID, DocListFilteredCriteria docListFilteredCriteria, EventHandler <DataPortalResult <SampleUnitOfWork> > callback)
 {
     DataPortal.BeginFetch <SampleUnitOfWork>(new Criteria2(false, docID, false, folderID, docListFilteredCriteria), (o, e) =>
     {
         if (e.Error != null)
         {
             throw e.Error;
         }
         callback(o, e);
     });
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Factory method. Asynchronously creates a new <see cref="SampleUnitOfWork"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria of the SampleUnitOfWork to create.</param>
 /// <param name="callback">The completion callback method.</param>
 public static void NewSampleUnitOfWork(DocListFilteredCriteria docListFilteredCriteria, EventHandler <DataPortalResult <SampleUnitOfWork> > callback)
 {
     // DataPortal_Fetch is used as ReadOnlyBase<T> doesn't allow the use of DataPortal_Create.
     DataPortal.BeginFetch <SampleUnitOfWork>(new Criteria2(true, new int(), true, new int(), docListFilteredCriteria), (o, e) =>
     {
         if (e.Error != null)
         {
             throw e.Error;
         }
         callback(o, e);
     });
 }
 /// <summary>
 /// Factory method. 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>
 /// <returns>A reference to the fetched <see cref="DocListGetter"/> unit of objects.</returns>
 public static DocListGetter GetDocListGetter(DocListFilteredCriteria docListFilteredCriteria)
 {
     return(DataPortal.Fetch <DocListGetter>(docListFilteredCriteria));
 }
Ejemplo n.º 8
0
 partial void GetQueryGetDocList(DocListFilteredCriteria crit);
Ejemplo n.º 9
0
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="DocList"/> collection, based on given parameters.
 /// </summary>
 /// <param name="crit">The fetch criteria.</param>
 /// <param name="callback">The completion callback method.</param>
 public static void GetDocList(DocListFilteredCriteria crit, EventHandler <DataPortalResult <DocList> > callback)
 {
     DataPortal.BeginFetch <DocList>(crit, callback);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Factory method. Loads a <see cref="DocList"/> collection, based on given parameters.
 /// </summary>
 /// <param name="crit">The fetch criteria.</param>
 /// <returns>A reference to the fetched <see cref="DocList"/> collection.</returns>
 public static DocList GetDocList(DocListFilteredCriteria crit)
 {
     return(DataPortal.Fetch <DocList>(crit));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Factory method. Creates a new <see cref="SampleUnitOfWork"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria of the SampleUnitOfWork to create.</param>
 /// <returns>A reference to the created <see cref="SampleUnitOfWork"/> unit of objects.</returns>
 public static SampleUnitOfWork NewSampleUnitOfWork(DocListFilteredCriteria docListFilteredCriteria)
 {
     // DataPortal_Fetch is used as ReadOnlyBase<T> doesn't allow the use of DataPortal_Create.
     return(DataPortal.Fetch <SampleUnitOfWork>(new Criteria2(true, new int(), true, new int(), docListFilteredCriteria)));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Factory method. Loads a <see cref="SampleUnitOfWork"/> unit of objects, based on given parameters.
 /// </summary>
 /// <param name="docID">The DocID parameter of the SampleUnitOfWork to fetch.</param>
 /// <param name="folderID">The FolderID parameter of the SampleUnitOfWork to fetch.</param>
 /// <param name="docListFilteredCriteria">The DocListFilteredCriteria parameter of the SampleUnitOfWork to fetch.</param>
 /// <returns>A reference to the fetched <see cref="SampleUnitOfWork"/> unit of objects.</returns>
 public static SampleUnitOfWork GetSampleUnitOfWork(int docID, int folderID, DocListFilteredCriteria docListFilteredCriteria)
 {
     return(DataPortal.Fetch <SampleUnitOfWork>(new Criteria2(false, docID, false, folderID, docListFilteredCriteria)));
 }