示例#1
0
        public List <Service> preferencias(Usuario usuario)
        {
            //Retorna los servicios los servicios conectados a las categorias que el usuario ha dado like
            client.Connect();

            List <Nombre> query = client.Cypher
                                  .Match("(u:Usuario)-[:LIKE]->(c:Categoria)-[:TIPO]->(s:Servicio)")
                                  .Where((Usuario u) => u.correo == usuario.correo)
                                  .Return(s => s.As <Nombre>())
                                  .Results
                                  .ToList();

            List <string> nombres = new List <string>();

            if (query.Count() != 0 && !(query[0] == null))
            {
                foreach (var a in query)
                {
                    nombres.Add(a.id);
                }
            }

            MongoConnect mongo = new MongoConnect();

            return(mongo.getServicesById(nombres));
        }
示例#2
0
        public void loadService(string id)
        {
            MongoConnect mc          = new MongoConnect();
            Service      tempService = mc.getid(id);

            this.id    = tempService.id;
            name       = tempService.name;
            owner      = tempService.owner;
            ImagList   = tempService.ImagList;
            province   = tempService.province;
            canton     = tempService.canton;
            district   = tempService.district;
            town       = tempService.town;
            KmDistance = tempService.KmDistance;
            latitude   = tempService.latitude;
            longitude  = tempService.longitude;
            fare       = tempService.fare;
        }
示例#3
0
        public void loadCartItems()
        {
            ShoppingCart.Clear();

            var          redis = RedisStore.RedisCache;
            MongoConnect mongo = new MongoConnect();

            if (Exists())
            {
                var itemHash = redis.HashGetAll(HashKey);

                foreach (var Item in itemHash)
                {
                    //FareKey = FareKey + ":" + Item.Value;
                    var fareHash = redis.HashGetAll(Item.Value.ToString());

                    Service service = mongo.getid((Item.Name).ToString());

                    foreach (var Fare in fareHash)
                    {
                        Fare fare = new Fare();
                        foreach (var f in service.fare)
                        {
                            if (Fare.Name == f.name)
                            {
                                fare = f;
                            }
                        }
                        fare.qty = Convert.ToInt32((Fare.Value).ToString());
                        Tuple <Service, Fare> item = new Tuple <Service, Fare>(service, fare);
                        ShoppingCart.Add(item);
                    }
                    //System.Diagnostics.Debug.WriteLine(string.Format("key : {0}, value : {1}", Item.Name, Item.Value));
                }
            }
        }