Esempio n. 1
0
        public ActionResult FilterRecords()
        {
            AdFilter ad = new AdFilter();

            List <string> genres = getAllGenres();

            ViewBag.slgen = new List <SelectListItem>();
            foreach (string item in genres)
            {
                ViewBag.slgen.Add(new SelectListItem {
                    Text = item, Value = item
                });
            }


            List <string> artists = getAllArtists();

            ViewBag.slart = new List <SelectListItem>();
            foreach (string item in artists)
            {
                ViewBag.slart.Add(new SelectListItem {
                    Text = item, Value = item
                });
            }



            return(View(ad));
        }
Esempio n. 2
0
        public ActionResult SearchRecords(AdFilter ad)
        {
            Dictionary <string, object> queryDict = new Dictionary <string, object>();
            List <Ad> ads = new List <Ad>();
            AdFilter  adf = new AdFilter();



            string searchWord = ad.inputUser + ".*";
            string new1       = searchWord.ToLower();

            queryDict.Add("new1", new1);
            var query = new Neo4jClient.Cypher.CypherQuery("match (r:Record) where toLower(r.Title)=~{new1} return r", queryDict, CypherResultMode.Set);



            List <Record> records = ((IRawGraphClient)client).ExecuteGetCypherResults <Record>(query).ToList();

            foreach (Record rec in records)
            {
                var q = client.Cypher.Match("(r:Record {Id:'" + rec.Id + "'})<-[RELEASE]-(l:Label),(r:Record {Id:'" + rec.Id + "'})<-[OWNS]-(a:Artist),(r:Record {Id:'" + rec.Id + "'})<-[s:SELLING]-(u:User),(r:Record {Id:'" + rec.Id + "'})-[BELONGS_TO]->(g:Genre)  ").Return((l, a, u, s, g) => new { Label = l.As <Label>(), Artist = a.As <Artist>(), User = u.As <User>(), Condition = s.As <Condition>(), Genre = g.As <Genre>() });;
                foreach (var result in q.Results)
                {
                    ads.Add(new Ad {
                        Artist = result.Artist, Record = rec, Label = result.Label, User = result.User, Condition = result.Condition, Genre = result.Genre
                    });
                }
            }
            adf.ads = ads.DistinctBy(x => x.Record.Id).ToList();

            adf.inputUser = ad.inputUser;

            return(View(adf));
        }
 public AdController(
     IAdService adService,
     ICityService cityService,
     IProductModelsService productModelsService,
     IAdViewsService adViewsService)
 {
     _adService            = adService;
     _prepearingModel      = new PrepearingModelHelper(_adService);
     _adFilter             = new AdFilter(_prepearingModel);
     _cityService          = cityService;
     _productModelsService = productModelsService;
     _adViewsService       = adViewsService;
 }
Esempio n. 4
0
        public void List(AdFilter filter, IParser parser)
        {
            var cards = new List <CardResult>();

            var extractor = new CardsMultiResultExtractor(cards);

            dapper
            .ResetParameter()
            .AddParameter("@id", filter.id)
            .AddParameter("@guid", filter.Guid)
            .AddParameter("@idOwner", filter.idOwner)
            .AddParameter("@adStatusList", filter.StringStatusList)
            .AddParameter("@ownerStatusActive", filter.idOwnerStatus)
            .ExecuteMultiple("card_get", extractor);

            parser.Set(cards.Cast <BaseResult>().ToList());
        }
        public CardRegisterDTO Get(Guid guid)
        {
            if (!guid.Equals(Guid.Empty))
            {
                var filter = new AdFilter()
                {
                    Guid       = guid,
                    idOwner    = idOwner,
                    StatusList = new List <int> {
                        (int)AD_STATUS.PUBLISHED,
                        (int)AD_STATUS.PAUSED,
                        (int)AD_STATUS.FINISHED
                    }
                };

                cardService.Get(filter, cardRegisterDTOParser);
            }

            var dto = (CardRegisterDTO)cardRegisterDTOParser.Get();

            return(dto);
        }
        public virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    _adService.Dispose();
                    _prepearingModel.Dispose();
                    _cityService.Dispose();
                    _productModelsService.Dispose();
                    _adViewsService.Dispose();

                    _adService            = null;
                    _prepearingModel      = null;
                    _adFilter             = null;
                    _cityService          = null;
                    _productModelsService = null;
                    _adViewsService       = null;
                }
                this.disposed = true;
            }
        }
        public MyAdDTO MyAdListView()
        {
            var filter = new AdFilter
            {
                idOwner    = idOwner,
                StatusList = new List <int> {
                    (int)AD_STATUS.PUBLISHED,
                    (int)AD_STATUS.PAUSED,
                    (int)AD_STATUS.FINISHED
                }
            };

            var response = new MyAdDTO();

            cardService.Get(filter, cardDetailDTOParser);

            response.Cards = cardDetailDTOParser.List()
                             .Cast <CardDetailDTO>()
                             .ToList();

            response.Status = Status();

            return(response);
        }
Esempio n. 8
0
        public ActionResult SearchRecords()
        {
            AdFilter ad = new AdFilter();

            return(View(ad));
        }
Esempio n. 9
0
        public ActionResult FilterRecords(AdFilter ad)
        {
            string        genre   = ad.genre;
            string        artist  = ad.artist;
            List <Record> records = new List <Record>();
            List <Ad>     ads     = new List <Ad>();
            AdFilter      adf     = new AdFilter();

            if (!genre.IsNullOrWhiteSpace() & !artist.IsNullOrWhiteSpace())
            {
                var query1 = new Neo4jClient.Cypher.CypherQuery("match (a{Name:'" + artist + "'})-[OWNS]->(record)-[BELONGS_TO]->(g{genre:'" + genre + "'}) return record", new Dictionary <string, object>(), CypherResultMode.Set);
                records = ((IRawGraphClient)client).ExecuteGetCypherResults <Record>(query1).ToList();
            }
            else if (!genre.IsNullOrWhiteSpace() & artist.IsNullOrWhiteSpace())
            {
                var query1 = new Neo4jClient.Cypher.CypherQuery("match (a)-[OWNS]->(record)-[BELONGS_TO]->(g{genre:'" + genre + "'}) return record", new Dictionary <string, object>(), CypherResultMode.Set);
                records = ((IRawGraphClient)client).ExecuteGetCypherResults <Record>(query1).ToList();
            }
            else if (genre.IsNullOrWhiteSpace() & !artist.IsNullOrWhiteSpace())
            {
                var query1 = new Neo4jClient.Cypher.CypherQuery("match (a{Name:'" + artist + "'})-[OWNS]->(record)-[BELONGS_TO]->(g) return record", new Dictionary <string, object>(), CypherResultMode.Set);
                records = ((IRawGraphClient)client).ExecuteGetCypherResults <Record>(query1).ToList();
            }
            else
            {
                var query1 = new Neo4jClient.Cypher.CypherQuery("match (a:Artist)-[OWNS]->(record)-[BELONGS_TO]->(g:Genre) return record", new Dictionary <string, object>(), CypherResultMode.Set);
                records = ((IRawGraphClient)client).ExecuteGetCypherResults <Record>(query1).ToList();
            }

            foreach (var rec in records)
            {
                var q = client.Cypher.Match("(r:Record {Id:'" + rec.Id + "'})<-[RELEASE]-(l:Label),(r:Record {Id:'" + rec.Id + "'})<-[OWNS]-(a:Artist),(r:Record {Id:'" + rec.Id + "'})<-[s:SELLING]-(u:User),(r:Record {Id:'" + rec.Id + "'})-[BELONGS_TO]->(g:Genre)  ").Return((l, a, u, s, g) => new { Label = l.As <Label>(), Artist = a.As <Artist>(), User = u.As <User>(), Condition = s.As <Condition>(), Genre = g.As <Genre>() });;
                foreach (var result in q.Results)
                {
                    ads.Add(new Ad {
                        Artist = result.Artist, Record = rec, Label = result.Label, User = result.User, Condition = result.Condition, Genre = result.Genre
                    });
                }
            }
            adf.ads = ads.DistinctBy(x => x.Record.Id).ToList();

            List <string> genres = getAllGenres();

            ViewBag.slgen = new List <SelectListItem>();
            foreach (string item in genres)
            {
                ViewBag.slgen.Add(new SelectListItem {
                    Text = item, Value = item
                });
            }


            List <string> artists = getAllArtists();

            ViewBag.slart = new List <SelectListItem>();
            foreach (string item in artists)
            {
                ViewBag.slart.Add(new SelectListItem {
                    Text = item, Value = item
                });
            }



            return(View(adf));
        }
 public void Get(AdFilter filter, IParser parser)
 {
     cardDAL.Get(filter, parser);
 }
 public void List(AdFilter filter, IParser parse)
 {
     cardDAL.Get(filter, parse);
 }
Esempio n. 12
0
 public AdModule()
 {
     Filter = new AdFilter();
     FillForm();
 }
Esempio n. 13
0
 public void Get(AdFilter filter, IParser parser)
 {
     List(filter, parser);
 }