Пример #1
0
        /// <summary>
        /// 得到请求的内容
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public Byte[] GetNotifyMaskContent(NotifyMaskItem item)
        {
            int contentLen = 39 + 4 + 4 + 32 + 4 + 4 + 32 + 32 + 160 + 8 + 1 + 25;
            Byte[] buffer = new Byte[contentLen];

            Guid guid = Guid.NewGuid();
            Encoding.ASCII.GetBytes(guid.ToString()).CopyTo(buffer, 0);
            BitConverter.GetBytes(item.Idx).CopyTo(buffer, 39);
            BitConverter.GetBytes(item.TagID).CopyTo(buffer, 39 + 4);
            Encoding.ASCII.GetBytes(item.TagName).CopyTo(buffer, 39 + 4 + 4);
            BitConverter.GetBytes(item.DBHostIdx).CopyTo(buffer, 39 + 4 + 4 + 32);
            BitConverter.GetBytes(item.MaskState).CopyTo(buffer, 39 + 4 + 4 + 32 + 4);
            Encoding.ASCII.GetBytes(item.MaskUser).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4);
            Encoding.ASCII.GetBytes(item.MaskDesk).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4 + 32);
            Encoding.ASCII.GetBytes(item.MaskInfo).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4 + 32 + 32);
            BitConverter.GetBytes(item.MaskTime).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4 + 32 + 32 + 160);
            BitConverter.GetBytes(item.EnableCancel).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4 + 32 + 32 + 160 + 8);
            Encoding.ASCII.GetBytes(item.CancelTime).CopyTo(buffer, 39 + 4 + 4 + 32 + 4 + 4 + 32 + 32 + 160 + 8 + 1);

            return buffer;
        }
Пример #2
0
 //通知屏蔽信息报文格式		
 //ProcID	char[39]	请求的标识
 //Idx	int	活动告警的Idx
 //TagID	int	测点TagID
 //TagName	char[32]	测点TagName
 //DBHostIdx	int	测点所在的数据中心
 //MaskState	int	屏蔽状态
 //MaskUser	char[32]	屏蔽人
 //MaskDesk	char[32]	屏蔽的操作站,通常是电脑名称或者手机名称
 //MaskInfo	char[160]	屏蔽信息,用户在确认时可能会输出一些屏蔽信息
 //MaskTime	double	屏蔽时间
 //EnableCancel	char	启用屏蔽期限,'1'-启用,'0'-不启用
 //CancelTime	char[25]	屏蔽期限,时间格式:2011:03:11 10:12:30
 /// <summary>
 /// 得到请求包
 /// </summary>
 /// <param name="ids"></param>
 /// <returns></returns>
 public Byte[] GetNotifyMaskBytes(NotifyMaskItem item)
 {
     Byte[] buffer = GetNotifyMaskContent(item);
     buffer = AppendNotifyMaskHeader(buffer);
     return buffer;
 }