예제 #1
0
        private ErrorCode DBAsynQueryNoticeCallBack(DBActiveWrapper db)
        {
            ErrorCode errorCode = db.SqlExecQuery("select * from notice;", dataReader =>
            {
                DBToCS.QueryNotice notice = new DBToCS.QueryNotice();
                while (dataReader.Read())
                {
                    DBToCS.QueryNotice.Types.Notice info =
                        new DBToCS.QueryNotice.Types.Notice
                    {
                        Id       = dataReader.GetUInt32("id"),
                        Platform = dataReader.GetUInt32("platform_id"),
                        Title    = dataReader.GetString("title"),
                        Eflag    = dataReader.GetInt32("eflag"),
                        Estate   = dataReader.GetInt32("estate"),
                        Priority = dataReader.GetInt32("priority"),
                        Notice_  = dataReader.GetString("notice"),
                        StarTime = dataReader.GetUInt64("star_time"),
                        EndTime  = dataReader.GetUInt64("end_time")
                    };
                    notice.NoticeInfo.Add(info);
                }
                CS.instance.userMgr.EncodeAndSendToLogicThread(notice, ( int )DBToCS.MsgID.EQueryNoticeCallBack);
                return(ErrorCode.Success);
            });

            return(errorCode);
        }
예제 #2
0
        private void DBCallBackQueryNotice(GBuffer buffer)
        {
            DBToCS.QueryNotice msg = new DBToCS.QueryNotice();
            msg.MergeFrom(buffer.GetBuffer(), 0, ( int )buffer.length);

            for (int i = 0; i < msg.NoticeInfo.Count; i++)
            {
                Notice notice = new Notice();
                DBToCS.QueryNotice.Types.Notice noticeInfo = msg.NoticeInfo[i];
                notice.id        = noticeInfo.Id;
                notice.platform  = ( UserPlatform )noticeInfo.Platform;
                notice.title     = noticeInfo.Title;
                notice.flag      = ( NoticeFlag )noticeInfo.Eflag;
                notice.state     = ( NoticeState )noticeInfo.Estate;
                notice.priority  = ( uint )noticeInfo.Priority;
                notice.msg       = noticeInfo.Notice_;
                notice.star_time = ( long )noticeInfo.StarTime;
                notice.end_time  = ( long )noticeInfo.EndTime;
                this.AddNotice(notice);
            }
        }