Example #1
0
        /// <summary>
        /// Gets the user place tag subscription.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="number">The number.</param>
        /// <param name="page">The page.</param>
        /// <returns>List of Tag Places</returns>
        public List <Model.TagPlace.TagPlace> GetUserPlaceTagSubscription(long userId, int number, int page)
        {
            List <Model.TagPlace.TagPlace> tagPlacesList = new List <XareuServices.Model.TagPlace.TagPlace>();

            var query = (from tagPlaces in data.place_tag_users_subscriptions
                         where tagPlaces.user_id == userId
                         select tagPlaces).Skip <place_tag_users_subscription>(number * page).Take <place_tag_users_subscription>(number);

            foreach (place_tag_users_subscription placeTag in query)
            {
                Model.TagPlace.TagPlace newTagPlace = new XareuServices.Model.TagPlace.TagPlace();

                newTagPlace.Id   = placeTag.place_tag_id;
                newTagPlace.Name = placeTag.place_tag.place_tag_name;
                try
                {
                    newTagPlace.ParentId = (long)placeTag.place_tag.place_tag_parent;
                }
                catch { newTagPlace.ParentId = 0; }

                tagPlacesList.Add(newTagPlace);
            }

            return(tagPlacesList);
        }
Example #2
0
        /// <summary>
        /// Gets the place tag.
        /// </summary>
        /// <param name="placeTag">The place tag.</param>
        /// <returns></returns>
        private Model.TagPlace.TagPlace getPlaceTag(place_tag_in_publication placeTag)
        {
            Model.TagPlace.TagPlace newTagPlace = new XareuServices.Model.TagPlace.TagPlace();

            newTagPlace.Id   = placeTag.place_tag_id;
            newTagPlace.Name = placeTag.place_tag.place_tag_name;
            try
            {
                newTagPlace.ParentId = (long)placeTag.place_tag.place_tag_parent;
            }
            catch { newTagPlace.ParentId = 0; }

            return(newTagPlace);
        }
Example #3
0
        /// <summary>
        /// Gets the tag place.
        /// </summary>
        /// <param name="tagPlace">The tag place.</param>
        /// <returns></returns>
        private Model.TagPlace.TagPlace getTagPlace(place_tag tagPlace)
        {
            Model.TagPlace.TagPlace newTagPlace = new XareuServices.Model.TagPlace.TagPlace();

            newTagPlace.Id   = tagPlace.place_tag_id;
            newTagPlace.Name = tagPlace.place_tag_name;
            try
            {
                newTagPlace.ParentId = (long)tagPlace.place_tag_parent;
            }
            catch { newTagPlace.ParentId = 1; }

            return(newTagPlace);
        }
Example #4
0
 /// <summary>
 /// Adds the tag place.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 /// <param name="token">The token.</param>
 /// <param name="newToken">The new token.</param>
 /// <param name="tagPlace">The tag place.</param>
 /// <returns>True if it was OK, false otherwise</returns>
 public bool AddTagPlace(long userID, Guid token, out Guid newToken, XareuServices.Model.TagPlace.TagPlace tagPlace)
 {
     if (loginService.UseToken(userID, token, out newToken))
     {
         try
         {
             long tagPlaceID;
             return(placeTagDAO.AddTagPlace(tagPlace, out tagPlaceID));
         }
         catch
         {
             throw new Exception("Adding tag place error");
         }
     }
     throw new Exception("Login error");
 }
Example #5
0
        /// <summary>
        /// Añade una etiqueta de lugar
        /// </summary>
        /// <param name="tagPlace">Etiqueta de lugar que queremos añadir</param>
        /// <param name="tagPlaceID"></param>
        /// <returns>
        /// True si la pudo añadir, false en caso contrario
        /// </returns>
        public bool AddTagPlace(XareuServices.Model.TagPlace.TagPlace tagPlace, out long tagPlaceID)
        {
            tagPlaceID = 0;
            try
            {
                place_tag newPlaceTag = this.convertToLinqPlaceTag(tagPlace);

                data.place_tags.InsertOnSubmit(newPlaceTag);
                data.SubmitChanges();

                tagPlaceID = this.getLastInsertedTagPlaceID();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #6
0
        /// <summary>
        /// Gets the sons.
        /// </summary>
        /// <param name="tagPlaceID">The tag place ID.</param>
        /// <returns>List of tag places</returns>
        public List <Model.TagPlace.TagPlace> GetSons(long tagPlaceID)
        {
            List <Model.TagPlace.TagPlace> sons = new List <XareuServices.Model.TagPlace.TagPlace>();

            IEnumerable <place_tag> tagPlaces = from places in data.place_tags
                                                where places.place_tag_parent == tagPlaceID
                                                select places;

            foreach (place_tag place in tagPlaces)
            {
                Model.TagPlace.TagPlace newPlace = new XareuServices.Model.TagPlace.TagPlace();
                newPlace.Id       = place.place_tag_id;
                newPlace.Name     = place.place_tag_name;
                newPlace.ParentId = (long)place.place_tag_parent;
                sons.Add(newPlace);
            }
            return(sons);
        }
Example #7
0
        /// <summary>
        /// Edita los datos de una etiqueta de lugar determinada por los que indicamos
        /// </summary>
        /// <param name="tagPlace">Nuevos datos de la etiqueta que queremos editar (conservando el Id)</param>
        /// <returns></returns>
        public bool EditTagPlace(XareuServices.Model.TagPlace.TagPlace tagPlace)
        {
            place_tag actualTagPlaceValues;

            IEnumerable <place_tag> query = from tagPlaces in data.place_tags
                                            where tagPlaces.place_tag_id == tagPlace.Id
                                            select tagPlaces;

            actualTagPlaceValues = query.First <place_tag>();

            try
            {
                actualTagPlaceValues.place_tag_name   = tagPlace.Name;
                actualTagPlaceValues.place_tag_parent = tagPlace.ParentId;

                this.data.SubmitChanges();
                return(true);
            }

            catch
            {
                return(false);
            }
        }
Example #8
0
 /// <summary>
 /// Adds the tag place.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 /// <param name="token">The token.</param>
 /// <param name="newToken">The new token.</param>
 /// <param name="tagPlace">The tag place.</param>
 /// <returns>True if it was OK, false otherwise</returns>
 public bool AddTagPlace(long userID, Guid token, out Guid newToken, XareuServices.Model.TagPlace.TagPlace tagPlace)
 {
     return(tagPlaceService.AddTagPlace(userID, token, out newToken, tagPlace));
 }