public static ProductDiscount GetByProduct(int productId, DateTime dateTime) { var action = ModulesRepository.ModuleExecuteReadOne( "Select Top(1) * From [Module].[" + ModuleName + "] " + "Where ProductId=@ProductId And ((@dateTime between DateStart and DateExpired) Or (IsRepeat = 1)) Order by SortOrder", CommandType.Text, GetBuyInTimeProductModelFromReader, new SqlParameter("@ProductId", productId), new SqlParameter("@dateTime", dateTime)); if (action == null) { return(null); } if (action.IsRepeat && action.DateExpired < DateTime.Now) { action.DateExpired = GetExpireDateTime(action.DateExpired, action.DaysRepeat); } return(new ProductDiscount() { ProductId = productId, Discount = action.DiscountInTime, DateExpired = action.DateExpired }); }
public static AbandonedCartTemplate GetTemplate(int id) { return (ModulesRepository.ModuleExecuteReadOne( "Select * From [Module].[AbandonedCartTemplate] Where Id = @Id", CommandType.Text, GetTemplateFromReader, new SqlParameter("@Id", id))); }
public static BuyInTimeProductModel GetByShowMode(int showMode, DateTime dateTime) { return(ModulesRepository.ModuleExecuteReadOne( "Select Top(1) * From [Module].[" + ModuleName + "] " + "Where ShowMode=@ShowMode And ((@dateTime between DateStart and DateExpired) Or (IsRepeat = 1)) Order by SortOrder", CommandType.Text, GetBuyInTimeProductModelFromReader, new SqlParameter("@ShowMode", showMode), new SqlParameter("@dateTime", dateTime))); }
public static YaOrder GetOrder(int marketOrderId) { return(ModulesRepository.ModuleExecuteReadOne( "Select * From Module.YaMarketOrder Where MarketOrderId = @MarketOrderId", CommandType.Text, reader => new YaOrder() { MarketOrderId = SQLDataHelper.GetInt(reader, "MarketOrderId"), OrderId = SQLDataHelper.GetInt(reader, "OrderId"), Status = SQLDataHelper.GetString(reader, "Status"), }, new SqlParameter("@MarketOrderId", marketOrderId))); }
public static AbandonedCart GetAbondonedCart(Guid customerId) { return (ModulesRepository.ModuleExecuteReadOne( "Select *, " + "(Select Count(*) From [Module].[AbandonedCartLetter] Where AbandonedCartLetter.CustomerId = OrderConfirmation.CustomerId) as SendingCount, " + "(Select Top(1)SendingDate From [Module].[AbandonedCartLetter] Where AbandonedCartLetter.CustomerId = OrderConfirmation.CustomerId Order By SendingDate Desc) as SendingDate " + "From [Order].[OrderConfirmation] Where CustomerId = @CustomerId", CommandType.Text, GetOrderConfirmationFromReader, new SqlParameter("@CustomerId", customerId))); }
public static StoreReview GetStoreReview(int id) { return(ModulesRepository.ModuleExecuteReadOne <StoreReview>( "SELECT *, (SELECT Count(ID) FROM [Module].[StoreReview] WHERE [ParentID] = ParentReview.ID) as ChildsCount FROM [Module].[StoreReview] as ParentReview WHERE [ID] = @ID", CommandType.Text, (reader) => { var review = GetStoreReviewFromReader(reader); review.ChildrenReviews = ModulesRepository.ConvertTo <int>(reader, "ChildsCount") > 0 ? GetStoreReviewsByParentId( ModulesRepository.ConvertTo <int>(reader, "ParentID")) : new List <StoreReview>(); return review; }, new SqlParameter("@ID", id))); }
public static BuyInTimeProductModel Get(int id) { return(ModulesRepository.ModuleExecuteReadOne("Select * From [Module].[" + ModuleName + "] Where Id=@Id", CommandType.Text, GetBuyInTimeProductModelFromReader, new SqlParameter("@Id", id))); }