Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="siteId"></param>
        /// <param name="userId"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="isEnabled"></param>
        /// <param name="numberOfWinners"></param>
        /// <param name="pubDate"></param>
        /// <param name="pubEndDate"></param>
        /// <returns></returns>
        public long AddContestGroup(long siteId, long userId,
                                    string title, string description, bool isEnabled,
                                    int numberOfWinners, DateTime?pubDate, DateTime?pubEndDate)
        {
            long           id    = AWAPI_Common.library.MiscLibrary.CreateUniqueId();
            awContestGroup group = new awContestGroup();

            group.contestGroupId  = id;
            group.title           = title;
            group.description     = description;
            group.siteId          = siteId;
            group.userId          = userId;
            group.isEnabled       = isEnabled;
            group.numberOfWinners = numberOfWinners;

            group.pubDate    = pubDate;
            group.pubEndDate = pubEndDate;

            group.lastBuildDate = DateTime.Now;
            group.createDate    = DateTime.Now;

            _context.awContestGroups.InsertOnSubmit(group);
            _context.SubmitChanges();

            return(id);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contestGroupId"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="isEnabled"></param>
        /// <param name="maxEntry"></param>
        /// <param name="maxEntryPerUser"></param>
        /// <param name="maxEntryPerUserPeriodValue"></param>
        /// <param name="maxEntryPerUserPeriodType"></param>
        /// <param name="pubDate"></param>
        /// <param name="pubEndDate"></param>
        /// <returns></returns>
        public bool UpdateContestGroup(long contestGroupId, string title, string description, bool isEnabled,
                                       int numberOfWinners, DateTime?pubDate, DateTime?pubEndDate)
        {
            awContestGroup group = _context.awContestGroups.FirstOrDefault(st =>
                                                                           st.contestGroupId.Equals(contestGroupId));

            if (group == null)
            {
                return(false);
            }

            group.title           = title;
            group.description     = description;
            group.isEnabled       = isEnabled;
            group.numberOfWinners = numberOfWinners;
            group.pubDate         = pubDate;
            group.pubEndDate      = pubEndDate;

            group.lastBuildDate = DateTime.Now;

            _context.SubmitChanges();

            return(true);
        }