Exemple #1
0
        /// <summary>
        /// 插入到通知关联员工表
        /// </summary>
        public void InsertNoticeRes(List <sys_notice> noticList, long userId)
        {
            if (noticList == null || noticList.Count == 0)
            {
                return;
            }
            var snrDal  = new sys_notice_resource_dal();
            var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);

            foreach (var notice in noticList)
            {
                var thisNoticRes = snrDal.GetByResNotic(notice.id, userId);
                if (thisNoticRes != null)
                {
                    if (thisNoticRes.is_show == 1)
                    {
                        thisNoticRes.is_show = 0;
                        snrDal.Update(thisNoticRes);
                    }
                    continue;
                }
                thisNoticRes = new sys_notice_resource()
                {
                    id                  = snrDal.GetNextIdCom(),
                    notice_id           = notice.id,
                    resource_id         = userId,
                    is_show             = 0,
                    first_show_time     = timeNow,
                    status_changed_time = timeNow,
                };
                snrDal.Insert(thisNoticRes);
            }
        }
Exemple #2
0
        /// <summary>
        /// 是否下次登陆继续通知
        /// </summary>
        public bool ChangeNoticeNext(long noticeId, long userId, bool isShow)
        {
            var snrDal       = new sys_notice_resource_dal();
            var thisNoticRes = snrDal.GetByResNotic(noticeId, userId);

            if (thisNoticRes == null)
            {
                return(false);
            }
            var show = (sbyte)(isShow ? 1 : 0);

            if (thisNoticRes.is_show != show)
            {
                thisNoticRes.is_show = show;
                snrDal.Update(thisNoticRes);
            }
            return(true);
        }