Esempio n. 1
0
        // This might be best moved into a different class later on.
        public static List <Comment> GetCommentsForProduct(int productId)
        {
            List <Comment> result = new List <Comment>();

            SearchEntity search = new SearchEntity();

            search.ColumnsToReturn = new List <string>();
            search.ColumnsToReturn.Add("CommentId");

            search.ConnectionString = Constants.CONNECTION_STRING;

            LacesRepo.Condition userIdCond = new LacesRepo.Condition();
            userIdCond.Column   = "ProductId";
            userIdCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            userIdCond.Value    = Convert.ToString(productId);

            search.Conditions.Add(userIdCond);

            search.SchemaName = Constants.SCHEMA_DEFAULT;
            search.TableName  = Constants.TABLE_IMAGES;

            result = new GenericRepository <Comment>().Read(search);

            return(result);
        }
Esempio n. 2
0
        // This might be best moved into a different class later on.
        public static List <Product> GetProductsForUser(int userId)
        {
            List <Product> result = new List <Product>();

            SearchEntity search = new SearchEntity();

            search.ColumnsToReturn = new List <string>();
            search.ColumnsToReturn.Add("ProductId");

            search.ConnectionString = Constants.CONNECTION_STRING;

            LacesRepo.Condition userIdCond = new LacesRepo.Condition();
            userIdCond.Column   = "SellerId";
            userIdCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            userIdCond.Value    = Convert.ToString(userId);

            LacesRepo.Condition statusCond = new LacesRepo.Condition();
            statusCond.Column   = "ProductStatusId";
            statusCond.Operator = LacesRepo.Condition.Operators.EqualTo;
            statusCond.Value    = Convert.ToString((int)ProductStatusOptions.Removed);
            statusCond.Invert   = true;

            search.Conditions.Add(userIdCond);
            search.Conditions.Add(statusCond);

            search.SchemaName = Constants.SCHEMA_DEFAULT;
            search.TableName  = Constants.TABLE_PRODUCTS;

            result = new GenericRepository <Product>().Read(search);

            return(result);
        }