public void Insert(MeetingQuestionEntity data)
 {
     BaseRepository().Insert(data);
     Task.Run(() =>
     {
         //添加添加安全积分
         SafetyScoreService scoreService = new SafetyScoreService();
         try
         {
             scoreService.AddScore(data.AnswerUserId, 6);
         }
         catch (Exception ex)
         {
         }
     });
 }
Esempio n. 2
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="data"></param>
 public void Insert(MeetingRecordEntity data)
 {
     BaseRepository().Insert(data);
     Task.Run(() =>
     {
         //添加添加安全积分
         SafetyScoreService scoreService = new SafetyScoreService();
         List <string> userIds           = data.ShareUserIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
         if (userIds != null && userIds.Count > 0)
         {
             userIds.ForEach(x => {
                 try
                 {
                     scoreService.AddScore(x, 5);
                 }
                 catch (Exception)
                 {
                 }
             });
         }
     });
 }
Esempio n. 3
0
        /// <summary>
        /// 保存表单
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void Save(MeetSubjectEntity entity)
        {
            var db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                var ck = db.IQueryable <AccountRuleEntity>(p => p.Standard == "班前一课" && p.IsOpen == 1).FirstOrDefault();
                if (ck != null)
                {
                    SafetyScoreService scoreService = new SafetyScoreService();
                    if (entity.State)
                    {
                        scoreService.AddScore(entity.TeachUserId, 7);
                    }
                }
                db.Insert(entity);
                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, MeetSubjectEntity entity)
        {
            var db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                //添加安全积分
                SafetyScoreService scoreService = new SafetyScoreService();
                if (!string.IsNullOrEmpty(keyValue))
                {
                    var old = db.FindEntity <MeetSubjectEntity>(x => x.ID == keyValue);
                    if (!old.State && entity.State)
                    {
                        var ck = db.IQueryable <AccountRuleEntity>(p => p.Standard == "班前一课" && p.IsOpen == 1).FirstOrDefault();
                        if (ck != null)
                        {
                            scoreService.AddScore(entity.TeachUserId, 7);
                        }
                    }
                    db.Update(entity);
                }
                else
                {
                    if (entity.State)
                    {
                        scoreService.AddScore(entity.TeachUserId, 7);
                    }
                    db.Insert(entity);
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
            }
        }