예제 #1
0
        /// <summary>
        /// 加入黑名单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public void AddBlackList(AddBlackReqDto model)
        {
            string regsql = @" delete TalkBlackList where UserId = @UserId and RoomId = @RoomId ;
                                    insert into TalkBlackList (UserId,RoomId,BanTime,IsEverlasting) 
                                    values (@UserId,@RoomId,@BanTime,@IsEverlasting); ";

            SqlParameter[] regsp = new SqlParameter[] {
                new SqlParameter("@UserId", model.UserId),
                new SqlParameter("@RoomId", model.RoomId),
                new SqlParameter("@BanTime", DateTime.Now),
                new SqlParameter("@IsEverlasting", true)
            };

            SqlHelper.ExecuteNonQuery(regsql, regsp);

            var processingRecords = new ProcessingRecords()
            {
                ProcessToId   = model.UserId,
                ProcessToName = model.UserName,
                Type          = 2,
                RoomId        = model.RoomId,
                ProcessId     = model.ProcessId,
                ProcessName   = model.ProcessName
            };

            AddProcessingRecords(processingRecords);
        }
예제 #2
0
        /// <summary>
        /// 解禁
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public void RemoveBlackList(DelMessageReqDto model)
        {
            string sql = "delete TalkBlackList where UserId = @UserId and RoomId = @RoomId";

            SqlHelper.ExecuteScalar(sql, new SqlParameter[] { new SqlParameter("@UserId", model.UserId), new SqlParameter("@RoomId", model.RoomId) });

            var processingRecords = new ProcessingRecords()
            {
                ProcessToId   = model.UserId,
                ProcessToName = model.UserName,
                Type          = 3,
                RoomId        = model.RoomId,
                ProcessId     = model.ProcessId,
                ProcessName   = model.ProcessName
            };

            AddProcessingRecords(processingRecords);
        }
예제 #3
0
        /// <summary>
        /// 管理员删除某人全部消息
        /// </summary>
        /// <returns></returns>
        public void DelMessageAll(DelMessageReqDto model)
        {
            string sql = @" update TalkNotes set Status = 0 where RoomId = @RoomId and UserId = @UserId   ";

            int i = SqlHelper.ExecuteNonQuery(sql, new SqlParameter[] { new SqlParameter("@RoomId", model.RoomId), new SqlParameter("@UserId", model.UserId) });

            var processingRecords = new ProcessingRecords()
            {
                ProcessToId   = model.UserId,
                ProcessToName = model.UserName,
                Type          = 1,
                RoomId        = model.RoomId,
                ProcessId     = model.ProcessId,
                ProcessName   = model.ProcessName
            };

            AddProcessingRecords(processingRecords);
        }
예제 #4
0
        /// <summary>
        /// 插入处理记录
        /// </summary>
        /// <param name="model"></param>
        private int AddProcessingRecords(ProcessingRecords model)
        {
            model.ProcessDate = DateTime.Now;
            model.ProcessTime = DateTime.Now;

            string regsql = @"insert into ProcessingRecords (ProcessId,ProcessName,Type,ProcessToId,ProcessToName,ProcessDate,ProcessTime,RoomId)
                                values (@ProcessId,@ProcessName,@Type,@ProcessToId,@ProcessToName,@ProcessDate,@ProcessTime,@RoomId)";

            SqlParameter[] regsp = new SqlParameter[] {
                new SqlParameter("@ProcessId", model.ProcessId),
                new SqlParameter("@ProcessName", model.ProcessName),
                new SqlParameter("@Type", model.Type),
                new SqlParameter("@ProcessToId", model.ProcessToId),
                new SqlParameter("@ProcessToName", model.ProcessToName),
                new SqlParameter("@ProcessDate", model.ProcessDate),
                new SqlParameter("@ProcessTime", model.ProcessTime),
                new SqlParameter("@RoomId", model.RoomId)
            };

            var i = SqlHelper.ExecuteNonQuery(regsql, regsp);

            return(i);
        }