示例#1
0
 public override async Task <GenericPage <ExcursionIndexModel> > PageAsync(int offset, int limit, string searchValue)
 {
     using (SqlDeserializerComponent <GenericPage <ExcursionIndexModel> > component = new SqlDeserializerComponent <GenericPage <ExcursionIndexModel> >(
                _connectionString,
                _cmdTxtExcursionPage,
                _rootName,
                new SqlParameter[]
     {
         new SqlParameter("@offset", System.Data.SqlDbType.Int)
         {
             Value = offset
         },
         new SqlParameter("@limit", System.Data.SqlDbType.Int)
         {
             Value = limit
         },
         new SqlParameter("@searchValue", System.Data.SqlDbType.VarChar)
         {
             Value = searchValue ?? string.Empty
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }
        public override async Task <Option <GenericPage <BlogEntryModel> > > BlogsAsync(int offset, int limit)
        {
            using (SqlDeserializerComponent <GenericPage <BlogEntryModel> > component = new SqlDeserializerComponent <GenericPage <BlogEntryModel> >(
                       _connectionString,
                       _cmdTxtBlogsPage,
                       _rootName,
                       new SqlParameter[]
            {
                new SqlParameter("@offset", System.Data.SqlDbType.Int)
                {
                    Value = offset
                },
                new SqlParameter("@limit", System.Data.SqlDbType.Int)
                {
                    Value = limit
                }
            }))
            {
                try
                {
                    var model = await component.ExecuteStoreProcedureAndDeserialize();

                    if (model == null)
                    {
                        return(Option <GenericPage <BlogEntryModel> > .None());
                    }
                    return(Option <GenericPage <BlogEntryModel> > .Some(model));
                }
                catch (InvalidOperationException)
                {
                    return(Option <GenericPage <BlogEntryModel> > .None());
                }
            }
        }
        public override async Task <Option <BlogEntryTextModel> > BlogAsync(string uriKey)
        {
            using (SqlDeserializerComponent <BlogEntryTextModel> component = new SqlDeserializerComponent <BlogEntryTextModel>(
                       _connectionString,
                       _cmdTxtCustomer,
                       new SqlParameter[]
            {
                new SqlParameter("@uriKey", System.Data.SqlDbType.VarChar)
                {
                    Value = uriKey
                }
            }))
            {
                try
                {
                    BlogEntryTextModel model = await component.ExecuteStoreProcedureAndDeserialize();

                    if (model == null)
                    {
                        return(Option <BlogEntryTextModel> .None());
                    }
                    return(Option <BlogEntryTextModel> .Some(model));
                }
                catch (InvalidOperationException)
                {
                    return(Option <BlogEntryTextModel> .None());
                }
            }
        }
示例#4
0
 public override async Task <ExcursionDataModel> FindAsync(Guid excursionId)
 {
     using (SqlDeserializerComponent <ExcursionDataModel> component = new SqlDeserializerComponent <ExcursionDataModel>(
                _connectionString,
                _cmdTxtExcursionDetail,
                new SqlParameter[]
     {
         new SqlParameter("@excursionId", System.Data.SqlDbType.UniqueIdentifier)
         {
             Value = excursionId
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }
 public override async Task <Product> ProductAsync(Guid productId)
 {
     using (SqlDeserializerComponent <Product> component = new SqlDeserializerComponent <Product>(
                _connectionString,
                _cmdTxtProduct,
                new SqlParameter[]
     {
         new SqlParameter("@customerId", System.Data.SqlDbType.UniqueIdentifier)
         {
             Value = productId
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }
 public override async Task <ProductExcursionIndex[]> ProductExcursionsAsync(DateTime date)
 {
     using (SqlDeserializerComponent <ProductExcursionIndex[]> component = new SqlDeserializerComponent <ProductExcursionIndex[]>(
                _connectionString,
                _cmdTxtProductExcursions,
                "ProductExcursionCollection",
                new SqlParameter[1]
     {
         new SqlParameter("@date", System.Data.SqlDbType.SmallDateTime)
         {
             Value = date
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }
 public override async Task <AnalyticsModel> AnalyticsModelAsync(DateTime dateUserActivity, DateTime dateActiveExcursions)
 {
     using (SqlDeserializerComponent <AnalyticsModel> component = new SqlDeserializerComponent <AnalyticsModel>(
                _connectionString,
                _cmdTxt,
                new SqlParameter[2]
     {
         new SqlParameter("@dateUserActivity", System.Data.SqlDbType.SmallDateTime)
         {
             Value = dateUserActivity
         },
         new SqlParameter("@dateActiveExcursions", System.Data.SqlDbType.SmallDateTime)
         {
             Value = dateActiveExcursions
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }
 public override async Task <GenericPage <ProductIndex> > ProductsAsync(int offset, int limit)
 {
     using (SqlDeserializerComponent <GenericPage <ProductIndex> > component = new SqlDeserializerComponent <GenericPage <ProductIndex> >(
                _connectionString,
                _cmdTxtProductPage,
                _rootName,
                new SqlParameter[]
     {
         new SqlParameter("@offset", System.Data.SqlDbType.Int)
         {
             Value = offset
         },
         new SqlParameter("@limit", System.Data.SqlDbType.Int)
         {
             Value = limit
         }
     }))
     {
         return(await component.ExecuteStoreProcedureAndDeserialize());
     }
 }