public async Task <List <GetDashBoard_Result> > GetDashBoardPharse2(string UserId, int?CustomerFilter, int?PostFilter, int?OrderFilter, int?FinanceFilter) { var userProfile = HanomaContext.AspNetUserProfiles.FirstOrDefault(p => p.UserId == UserId); if (userProfile != null && userProfile.ProductBrand_ID > 0) { try { //init param var pProductBrandID = new SqlParameter("@pProductBrandID", userProfile.ProductBrand_ID); var pCustomerFilter = new SqlParameter("@pCustomerFilter", CustomerFilter ?? (object)DBNull.Value); var pPostFilter = new SqlParameter("@pPostFilter", PostFilter ?? (object)DBNull.Value); var pOrderFilter = new SqlParameter("@pOrderFilter", OrderFilter ?? (object)DBNull.Value); var pFinanceFilter = new SqlParameter("@pFinanceFilter", FinanceFilter ?? (object)DBNull.Value); var result = await HanomaContext.Set <GetDashBoard_Result>() .FromSqlRaw($"EXECUTE dbo.GetDashBoard " + $"@pProductBrandID = @pProductBrandID, " + $"@pCustomerFilter = @pCustomerFilter, " + $"@pPostFilter = @pPostFilter, " + $"@pOrderFilter = @pOrderFilter, " + $"@pFinanceFilter = @pFinanceFilter ", pProductBrandID, pCustomerFilter, pPostFilter, pOrderFilter, pFinanceFilter) .AsNoTracking() .ToListAsync(); return(result); } catch (Exception ex) { } } return(new List <GetDashBoard_Result>()); }
public async Task <Tuple <int, IEnumerable <ProductBrand_Search_Result> > > GetListBrandPagging(int page, int pageSize, int?LocationId, int active, int?productCategoryId, string keyword) { var Keyword = new SqlParameter("@Keyword", String.IsNullOrEmpty(keyword) ? (object)DBNull.Value : keyword); var Active = new SqlParameter("@Active", active); var PageSize = new SqlParameter("@PageSize", pageSize); var CurrentPage = new SqlParameter("@CurrentPage", page); var ProductCategory_ID = new SqlParameter("@ProductCategory_ID", productCategoryId ?? (object)DBNull.Value); var Location_Id = new SqlParameter("@Location_ID", LocationId ?? (object)DBNull.Value); var ItemCount = new SqlParameter("@ItemCount", "") { Direction = System.Data.ParameterDirection.Output, DbType = System.Data.DbType.Int32 }; var output = await HanomaContext.Set <ProductBrand_Search_Result>() .FromSqlRaw($"EXECUTE dbo.ProductBrand_Search " + $"@Keyword = @Keyword, " + $"@Active = @Active, @PageSize = @PageSize,@Location_ID = @Location_ID, @ProductCategory_ID = @ProductCategory_ID, @CurrentPage = @CurrentPage, @ItemCount = @ItemCount OUTPUT", Keyword, Active, PageSize, Location_Id, ProductCategory_ID, CurrentPage, ItemCount) .AsNoTracking() .ToListAsync(); var ItemCountRes = Convert.ToInt32(ItemCount.Value); return(new Tuple <int, IEnumerable <ProductBrand_Search_Result> >(ItemCountRes, output)); }
public async Task <IEnumerable <ProductBrand_Search_Brand_V2_Result> > GetListProductBrand(ProductBrandFilter filter) { var Keyword = new SqlParameter("@Keyword", filter.Keyword); var StatusType_ID = new SqlParameter("@StatusType_ID", filter.StatusTypeId); var PageSize = new SqlParameter("@PageSize", filter.PageSize); var CurrentPage = new SqlParameter("@CurrentPage", filter.Page); var ProductType_ID = new SqlParameter("@ProductType_ID", filter.ProductTypeID); var ProductCategory_ID = new SqlParameter("@ProductCategory_ID", filter.ProductCategoryID); var AccesoryCategory_ID = new SqlParameter("@AccesoryCategory_ID", filter.AccesoryCategoryID); var Location_ID = new SqlParameter("@Location_ID", filter.LocationID); var result = await HanomaContext.Set <ProductBrand_Search_Brand_V2_Result>() .FromSqlRaw($"EXECUTE dbo.ProductBrand_Search_Brand_V2 " + $"@Keyword = @Keyword, " + $"@ProductType_ID = @ProductType_ID, " + $"@ProductCategory_ID = @ProductCategory_ID, " + $"@AccesoryCategory_ID = @AccesoryCategory_ID, " + $"@Location_ID = @Location_ID, " + $"@StatusType_ID = @StatusType_ID, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage ", Keyword, ProductType_ID, ProductCategory_ID, AccesoryCategory_ID, Location_ID, StatusType_ID, PageSize, CurrentPage ) .AsNoTracking() .ToListAsync(); return(result); }
public async Task <ArticleSearchDTO> SearchArticle(string keyword, int?ArticleCategory_ID, int?ArticleTypeId, int?page, int?PageSize) { var output = new ArticleSearchDTO(); var pKeyword = new SqlParameter("@Keyword", keyword); var pArticleCategory_ID = new SqlParameter("@ArticleCategory_ID", ArticleCategory_ID ?? (object)DBNull.Value); var pArticleTypeId = new SqlParameter("@ArticleType_ID", ArticleTypeId ?? (object)DBNull.Value); var pPage = new SqlParameter("@CurrentPage", page ?? 1); var pPageSize = new SqlParameter("@PageSize", PageSize ?? 10); var pActiveCount = new SqlParameter("@ActiveCount", SqlDbType.Int) { Direction = ParameterDirection.Output }; var pDeActiveCount = new SqlParameter("@DeActiveCount", SqlDbType.Int) { Direction = ParameterDirection.Output }; var pItemCount = new SqlParameter("@ItemCount", SqlDbType.Int) { Direction = ParameterDirection.Output }; //var pExceptionArticleID = new SqlParameter("@ExceptionArticle_ID", ArticleCategory_ID ?? (object)DBNull.Value); output.Data = await HanomaContext.Set <Article_Search_Result>() .FromSqlRaw( $"EXECUTE dbo.Article_Search_Mobile @Keyword = @Keyword, @ArticleCategory_ID = @ArticleCategory_ID, @ArticleType_ID = @ArticleType_ID,@CurrentPage = @CurrentPage,@PageSize = @PageSize,@ActiveCount = @ActiveCount out, @DeActiveCount = @DeActiveCount out, @ItemCount = @ItemCount out", pKeyword, pArticleCategory_ID, pArticleTypeId, pPage, pPageSize, pActiveCount, pDeActiveCount, pItemCount) .AsNoTracking() .ToListAsync(); output.CurrentPage = page ?? 1; output.PageSize = PageSize ?? 10; output.TotalRecord = (int)pItemCount.Value; output.TotalPage = (int)pActiveCount.Value; return(output); }
public async Task <IEnumerable <GetMenuProdCateByUser_Result> > GetMenuProdCateByUser(string UserId, int?productTypeId, int?statusTypeId, int parentId = 656) { var pUserId = new SqlParameter("@UserId", UserId ?? (object)DBNull.Value); var pParenId = new SqlParameter("@ParenId", parentId); var pProductTypeId = new SqlParameter("@ProductTypeId", productTypeId ?? (object)DBNull.Value); var pStatusTypeId = new SqlParameter("@StatusTypeId", statusTypeId ?? (object)DBNull.Value); try { var output = await HanomaContext.Set <GetMenuProdCateByUser_Result>() .FromSqlRaw($"EXECUTE GetMenuProdCateByUser @UserId = @UserId, " + $"@ParenId = @ParenId, " + $"@ProductTypeId = @ProductTypeId, " + $"@StatusTypeId = @StatusTypeId ", pUserId, pParenId, pProductTypeId, pStatusTypeId) .AsNoTracking() .ToListAsync(); return(output); } catch (Exception ex) { return(new List <GetMenuProdCateByUser_Result>()); } }
public async Task <CountHistoryShopingCart_Result> GetCountHistoryShopingCart(CountHistoryShoppingCart model) { var pUserId = new SqlParameter("@UserId", model.UserId ?? (object)DBNull.Value); var pProductBrandId = new SqlParameter("@ProductBrandId", model.ProductBrandId ?? (object)DBNull.Value); var pFromDate = new SqlParameter("@FromDate", model.FromDate ?? (object)DBNull.Value); var pToDate = new SqlParameter("@ToDate", model.ToDate ?? (object)DBNull.Value); var pShopingCartCode = new SqlParameter("@ShopingCartCode", model.ShopingCartCode ?? (object)DBNull.Value); try { var output = await HanomaContext.Set <CountHistoryShopingCart_Result>() .FromSqlRaw($"EXECUTE dbo.CountHistoryShopingCart " + $"@UserId = @UserId, " + $"@ProductBrandId = @ProductBrandId, " + $"@ShopingCartCode = @ShopingCartCode, " + $"@FromDate = @FromDate, " + $"@ToDate = @ToDate ", pUserId, pProductBrandId, pShopingCartCode, pFromDate, pToDate ) .AsNoTracking() .ToListAsync(); return(output.FirstOrDefault()); } catch (Exception ex) { } return(new CountHistoryShopingCart_Result()); }
public async Task <List <DashBoashProductBrand_Result> > GetDashBoard(string UserId) { var userProfile = HanomaContext.AspNetUserProfiles.FirstOrDefault(p => p.UserId == UserId); if (userProfile != null && userProfile.ProductBrand_ID > 0) { try { //init param var Tag = new SqlParameter("@pTag", (object)DBNull.Value); var ProductBrandID = new SqlParameter("@pProductBrandID", userProfile.ProductBrand_ID); var result = await HanomaContext.Set <DashBoashProductBrand_Result>() .FromSqlRaw($"EXECUTE dbo.DashBoashProductBrand " + $"@pTag = @pTag, " + $"@pProductBrandID = @pProductBrandID ", Tag, ProductBrandID) .AsNoTracking() .ToListAsync(); return(result); } catch (Exception ex) { } } return(new List <DashBoashProductBrand_Result>()); }
public async Task <List <GetArticleHome_Result> > GetArtByCateHome(string keyword) { var pKeyword = new SqlParameter("@Keyword", keyword); return(await HanomaContext.Set <GetArticleHome_Result>() .FromSqlRaw( $"EXECUTE dbo.GetArticleHome @Keyword = @Keyword", pKeyword) .AsNoTracking() .ToListAsync()); }
public async Task <List <ProductBrand> > GetTopBrand(int topX) { var BlockName = new SqlParameter("@BlockName", "enterprise_reputation"); var output = await HanomaContext.Set <ProductBrand>() .FromSqlRaw($" SELECT TOP {topX} P.* FROM dbo.ProductBrand AS P WITH (NOLOCK)" + $" INNER JOIN dbo.ProductBrandBlockProductBrand AS BBP WITH(NOLOCK) ON BBP.ProductBrand_id = P.ProductBrand_ID" + $" INNER JOIN dbo.ProductBrandBlock AS BB WITH(NOLOCK) ON BBP.ProductBrandBlock_id = BB.ProductBrandBlock_id" + $" WHERE BB.Name = @BlockName", BlockName) .AsNoTracking() .ToListAsync(); return(output); }
public async Task <List <ProductHighLight_Search_Result> > GetSponsorProduct(int CategoryId, int?ProductTypeId, int Top) { var pProductCategoryId = new SqlParameter("@ProductCategory_ID", CategoryId); var pProductTypeId = new SqlParameter("@ProductType_ID", ProductTypeId); var output = await HanomaContext.Set <ProductHighLight_Search_Result>() .FromSqlRaw($"EXECUTE dbo.ProductHighLight_Search " + $"@ProductCategory_ID = @ProductCategory_ID, " + $"@ProductType_ID = @ProductType_ID ", pProductCategoryId, pProductTypeId) .AsNoTracking() .ToListAsync(); return(output); }
public async Task <IEnumerable <Video_Search_Mobile_Result> > GetVideoByCate(int?VideoCategory_ID, int ArticleTypeId, int?page, int PageSize) { var pVideoCategory_ID = new SqlParameter("@VideoCategory_ID", VideoCategory_ID ?? (object)DBNull.Value); var pArticleTypeId = new SqlParameter("@ArticleType_ID", ArticleTypeId); var pPage = new SqlParameter("@CurrentPage", page ?? 1); var pPageSize = new SqlParameter("@PageSize", PageSize); var pStatusTypeID = new SqlParameter("@StatusType_ID", 4); var result = await HanomaContext.Set <Video_Search_Mobile_Result>() .FromSqlRaw( $"EXECUTE dbo.Video_Search_Mobile @VideoCategory_ID=@VideoCategory_ID, @StatusType_ID = @StatusType_ID, @ArticleType_ID = @ArticleType_ID,@CurrentPage = @CurrentPage,@PageSize = @PageSize ", pVideoCategory_ID, pStatusTypeID, pArticleTypeId, pPage, pPageSize) .AsNoTracking() .ToListAsync(); return(result); }
public async Task <List <HistoryShopingCart_Result> > GetHistoryShopingCart(HistoryShoppingCart model) { var pUserId = new SqlParameter("@UserId", model.UserId ?? (object)DBNull.Value); var pProductBrandId = new SqlParameter("@ProductBrandId", model.ProductBrandId ?? (object)DBNull.Value); var pShopingCartCode = new SqlParameter("@ShopingCartCode", model.ShopingCartCode ?? (object)DBNull.Value); var pShopingCartMasterId = new SqlParameter("@ShopingCartMasterId", model.ShopingCartMasterId ?? (object)DBNull.Value); var pShopingCartDetailId = new SqlParameter("@ShopingCartDetailId", model.ShopingCartDetailId ?? (object)DBNull.Value); var pStatusCart = new SqlParameter("@StatusCart", model.StatusCart ?? (object)DBNull.Value); var pFromDate = new SqlParameter("@FromDate", model.FromDate ?? (object)DBNull.Value); var pToDate = new SqlParameter("@ToDate", model.ToDate ?? (object)DBNull.Value); var pPageSize = new SqlParameter("@PageSize", model.PageSize ?? 1); var pCurrentPage = new SqlParameter("@CurrentPage", model.CurrentPage ?? 20); try { var output = await HanomaContext.Set <HistoryShopingCart_Result>() .FromSqlRaw($"EXECUTE dbo.HistoryShopingCart " + $"@UserId = @UserId, " + $"@ProductBrandId = @ProductBrandId, " + $"@ShopingCartCode = @ShopingCartCode, " + $"@ShopingCartMasterId = @ShopingCartMasterId, " + $"@ShopingCartDetailId = @ShopingCartDetailId, " + $"@StatusCart = @StatusCart, " + $"@FromDate = @FromDate, " + $"@ToDate = @ToDate, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage ", pUserId, pProductBrandId, pShopingCartCode, pShopingCartMasterId, pShopingCartDetailId, pStatusCart, pFromDate, pToDate, pPageSize, pCurrentPage ) .AsNoTracking() .ToListAsync(); return(output); } catch (Exception ex) { } return(new List <HistoryShopingCart_Result>()); }
public async Task <HistoryShopingCart_Result> GetDetailShoppingCart(string ShopingCartCode) { var pUserId = new SqlParameter("@UserId", (object)DBNull.Value); var pProductBrandId = new SqlParameter("@ProductBrandId", (object)DBNull.Value); var pShopingCartCode = new SqlParameter("@ShopingCartCode", ShopingCartCode); var pShopingCartMasterId = new SqlParameter("@ShopingCartMasterId", (object)DBNull.Value); var pShopingCartDetailId = new SqlParameter("@ShopingCartDetailId", (object)DBNull.Value); var pStatusCart = new SqlParameter("@StatusCart", (object)DBNull.Value); var pPageSize = new SqlParameter("@PageSize", 1); var pCurrentPage = new SqlParameter("@CurrentPage", 1); var pFromDate = new SqlParameter("@FromDate", (object)DBNull.Value); var pToDate = new SqlParameter("@ToDate", (object)DBNull.Value); try { var output = await HanomaContext.Set <HistoryShopingCart_Result>() .FromSqlRaw($"EXECUTE dbo.HistoryShopingCart " + $"@UserId = @UserId, " + $"@ProductBrandId = @ProductBrandId, " + $"@ShopingCartCode = @ShopingCartCode, " + $"@ShopingCartMasterId = @ShopingCartMasterId, " + $"@ShopingCartDetailId = @ShopingCartDetailId, " + $"@StatusCart = @StatusCart, " + $"@FromDate = @FromDate, " + $"@ToDate = @ToDate, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage ", pUserId, pProductBrandId, pShopingCartCode, pShopingCartMasterId, pShopingCartDetailId, pStatusCart, pFromDate, pToDate, pPageSize, pCurrentPage ) .AsNoTracking() .ToListAsync(); return(output.FirstOrDefault()); } catch (Exception ex) { } return(new HistoryShopingCart_Result()); }
public async Task <IEnumerable <ProductManufacture_SearchByCategory_Result> > SearchManufacture(int?productCategoryId, int?productTypeId, string text = "") { var ProductCategory_ID = new SqlParameter("@ProductCategory_ID", productCategoryId ?? (object)DBNull.Value); var ProductType_ID = new SqlParameter("@ProductType_ID", productTypeId ?? (object)DBNull.Value); var ItemCount = new SqlParameter("@ItemCount", "") { Direction = System.Data.ParameterDirection.Output, DbType = System.Data.DbType.Int32 }; var output = await HanomaContext.Set <ProductManufacture_SearchByCategory_Result>() .FromSqlRaw($"EXECUTE dbo.ProductManufacture_SearchByCategory @ProductCategory_ID = @ProductCategory_ID, @ProductType_ID = @ProductType_ID, @ItemCount = @ItemCount OUTPUT", ProductCategory_ID, ProductType_ID, ItemCount) .AsNoTracking() .ToListAsync(); if (!String.IsNullOrEmpty(text)) { output = output.Where(x => x.Name.Contains(text)).ToList(); } return(output); }
public async Task <IEnumerable <Library_Search_By_Cate_Result> > GetListLibraryPagging(LibraryFilter filter) { try { var Keyword = new SqlParameter("@Keyword", filter.Keyword ?? (object)DBNull.Value); var StatusType_ID = new SqlParameter("@StatusType_ID", filter.StatusTypeId); var PageSize = new SqlParameter("@PageSize", filter.PageSize); var CurrentPage = new SqlParameter("@CurrentPage", filter.Page ?? 1); var LibraryCategory_ID = new SqlParameter("@LibraryCategory_ID", filter.LibraryCategoryID ?? (object)DBNull.Value); var ProductCategoryID = new SqlParameter("@ProductCategoryID", filter.ProductCategoryID ?? (object)DBNull.Value); var ManufactoriesID = new SqlParameter("@ManufactoriesID", filter.ManufactoriesID ?? (object)DBNull.Value); var ModelID = new SqlParameter("@ModelID", filter.ModelID ?? (object)DBNull.Value); var ProductCategoryID2 = new SqlParameter("@ProductCategoryID2", filter.ProductCategoryID2 ?? (object)DBNull.Value); var CreateBy = new SqlParameter("@CreateBy", filter.CreateBy ?? (object)DBNull.Value); var output = await HanomaContext.Set <Library_Search_By_Cate_Result>() .FromSqlRaw($"EXECUTE dbo.Library_Search_By_Cate " + $"@Keyword = @Keyword, " + $"@StatusType_ID = @StatusType_ID, " + $"@PageSize = @PageSize, " + $"@CurrentPage = @CurrentPage, " + $"@LibraryCategory_ID = @LibraryCategory_ID, " + $"@ProductCategoryID = @ProductCategoryID, " + $"@ManufactoriesID = @ManufactoriesID, " + $"@ModelID = @ModelID, " + $"@ProductCategoryID2 = @ProductCategoryID2, " + $"@CreateBy = @CreateBy ", Keyword, StatusType_ID, PageSize, CurrentPage, LibraryCategory_ID, ProductCategoryID, ManufactoriesID, ModelID, ProductCategoryID2, CreateBy) .AsNoTracking() .ToListAsync(); return(output); } catch (Exception ex) { return(new List <Library_Search_By_Cate_Result>()); } }
public async Task <IEnumerable <Article_Search_Result> > GetArtByCate(int?ArticleCategory_ID, int ArticleTypeId, int?page, int PageSize) { var pArticleCategory_ID = new SqlParameter("@ArticleCategory_ID", ArticleCategory_ID ?? (object)DBNull.Value); var pArticleTypeId = new SqlParameter("@ArticleType_ID", ArticleTypeId); var pPage = new SqlParameter("@CurrentPage", page ?? 1); var pPageSize = new SqlParameter("@PageSize", PageSize); var pExceptionArticleID = new SqlParameter("@ExceptionArticle_ID", ArticleCategory_ID ?? (object)DBNull.Value); var pStatusTypeID = new SqlParameter("@StatusType_ID", 4); var pItemCount = new SqlParameter("@ItemCount", SqlDbType.Int) { Direction = ParameterDirection.Output }; var result = await HanomaContext.Set <Article_Search_Result>() .FromSqlRaw( $"EXECUTE dbo.Article_Search_Mobile @ArticleCategory_ID=@ArticleCategory_ID , @ExceptionArticle_ID=@ExceptionArticle_ID,@StatusType_ID = @StatusType_ID, @ArticleType_ID = @ArticleType_ID,@CurrentPage = @CurrentPage,@PageSize = @PageSize,@ItemCount = @ItemCount out ", pArticleCategory_ID, pExceptionArticleID, pStatusTypeID, pArticleTypeId, pPage, pPageSize, pItemCount) .AsNoTracking() .ToListAsync(); return(result); }
public async Task <List <SpAdMostView_CHT_Result> > GetBannerAdvertisingInChildPage(int AdMostViewType, int AdMostViewCate, int AdMostViewChildCate, int blockId) { try { var pAdMostViewType = new SqlParameter("@pAdMostViewType", AdMostViewType); var pAdMostViewCate = new SqlParameter("@pAdMostViewCate", AdMostViewCate); var pAdMostViewChildCate = new SqlParameter("@pAdMostViewCate2", AdMostViewChildCate); var pAdvertisingBlock_ID = new SqlParameter("@pAdvertisingBlock_ID", blockId); var output = await HanomaContext.Set <SpAdMostView_CHT_Result>() .FromSqlRaw($"EXECUTE dbo.SpAdMostView_CHT " + $"@pAdMostViewType = @pAdMostViewType, " + $"@pAdMostViewCate = @pAdMostViewCate," + $"@pAdMostViewCate2 = @pAdMostViewCate2," + $"@pAdvertisingBlock_ID = @pAdvertisingBlock_ID ", pAdMostViewType, pAdMostViewCate, pAdMostViewChildCate, pAdvertisingBlock_ID) .AsNoTracking() .ToListAsync(); return(output); }catch (Exception ex) { } return(new List <SpAdMostView_CHT_Result>()); }
public RepositoryBase(HanomaContext HanomaContext) { this.HanomaContext = HanomaContext; table = HanomaContext.Set <T>(); }