Ejemplo n.º 1
0
        private bool LoadByPrimaryKeyDynamic(System.Int32 orderId, System.String couponCode)
        {
            OrderCouponQuery query = new OrderCouponQuery();

            query.Where(query.OrderId == orderId, query.CouponCode == couponCode);
            return(this.Load(query));
        }
Ejemplo n.º 2
0
        public int GetNumberOfRedemptions()
        {
            //SELECT
            //COUNT(oc.CouponCode) as NumRedemptions
            //FROM DNNspot_Store_OrderCoupon oc
            //INNER JOIN DNNspot_Store_Order o ON o.Id = oc.OrderId
            //WHERE o.StoreId = @storeId AND CouponCode = @couponCode
            //GROUP BY oc.CouponCode

            OrderCouponQuery oc = new OrderCouponQuery("oc");
            OrderQuery       o  = new OrderQuery("o");

            oc.Select(oc.CouponCode.Count().As("NumRedemptions"));
            oc.InnerJoin(o).On(o.Id == oc.OrderId);
            oc.Where(o.StoreId == this.StoreId.Value, oc.CouponCode.ToUpper() == this.Code.ToUpper());
            oc.GroupBy(oc.CouponCode);

            object scalar = oc.ExecuteScalar();

            if (scalar != null)
            {
                return((int)scalar);
            }
            return(0);
        }
Ejemplo n.º 3
0
        protected void InitQuery(OrderCouponQuery query)
        {
            query.OnLoadDelegate = this.OnQueryLoaded;

            if (!query.es2.HasConnection)
            {
                query.es2.Connection = ((IEntityCollection)this).Connection;
            }
        }
Ejemplo n.º 4
0
 public bool Load(OrderCouponQuery query)
 {
     this.query = query;
     InitQuery(this.query);
     return(Query.Load());
 }