示例#1
0
        /// <summary>
        /// Añade un grupo a la lista de receptores de un mensaje en particular
        /// </summary>
        /// <param name="publicationId"></param>
        /// <param name="groupId">Id del grupo al que queremos enviar el mensaje</param>
        /// <returns>
        /// True si se pudo añadir, false en caso contrario
        /// </returns>
        public bool AddGroupToPublication(long publicationId, long groupId)
        {
            group_in_publication groupInPublication = new group_in_publication();

            groupInPublication.group_id       = groupId;
            groupInPublication.publication_id = publicationId;

            try
            {
                data.group_in_publications.InsertOnSubmit(groupInPublication);
                data.SubmitChanges();
                return(true);
            }
            catch { return(false); }
        }
示例#2
0
        /// <summary>
        /// Borra un grupo de un mensaje
        /// </summary>
        /// <param name="publicationId"></param>
        /// <param name="groupId">Grupo que queremos borrar</param>
        /// <returns>
        /// True si se pudo borrar, false en caso contrario
        /// </returns>
        public bool DeleteGroupFromPublication(long publicationId, long groupId)
        {
            var query = from groups in data.group_in_publications
                        where groups.publication_id == publicationId
                        where groups.group_id == groupId
                        select groups;

            try
            {
                group_in_publication group = query.First <group_in_publication>();

                data.group_in_publications.DeleteOnSubmit(group);
                data.SubmitChanges();
                return(true);
            }
            catch { return(false); }
        }