Ejemplo n.º 1
0
        /// <summary>
        /// 更新指定ID的日志项
        /// </summary>
        /// <param name="msgID"></param>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool ModifyNotifylogItemBySpecificID(string msgID, NotifyContent itemInf)
        {
            if (itemInf == null)
            {
                return(false);
            }

            int itemCnt = GetNotifylogItemCount();

            for (int i = itemCnt - 1; i >= 0; i--)
            {
                NotifyContent newItemInf = new NotifyContent();
                if (GetNotifylogItem(i, ref newItemInf))
                {
                    if (newItemInf.MsgID == msgID)
                    {
                        UpdatePropertyValue(itemInf);

                        _scaleIndex[0] = 0;
                        _scaleIndex[1] = i;
                        return(ModifyXmlScaleElement(1, _scaleIndex, _propertyValue.Length, NotifyLogName, _propertyValue));
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 private void UpdatePropertyValue(NotifyContent itemInf)
 {
     _propertyValue[(int)NotifyLogInfoType.Context]     = itemInf.MsgContent;
     _propertyValue[(int)NotifyLogInfoType.Date]        = itemInf.MsgDate;
     _propertyValue[(int)NotifyLogInfoType.ID]          = itemInf.MsgID;
     _propertyValue[(int)NotifyLogInfoType.NotifyState] = itemInf.NotifyState.ToString();
     _propertyValue[(int)NotifyLogInfoType.NotifyType]  = itemInf.ErrNotifyType.ToString();
     _propertyValue[(int)NotifyLogInfoType.Receiver]    = itemInf.Receiver;
     _propertyValue[(int)NotifyLogInfoType.ScreenName]  = itemInf.ScreenName;
     _propertyValue[(int)NotifyLogInfoType.Title]       = itemInf.MsgTitle;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加一日志项
        /// </summary>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool AddNotifyLog(NotifyContent itemInf)
        {
            if (itemInf == null)
            {
                return(false);
            }
            UpdatePropertyValue(itemInf);

            _scaleIndex[0] = 0;
            _scaleIndex[1] = GetNotifylogItemCount();
            return(AddXmlScaleElement(1, _scaleIndex, _propertyValue.Length, NotifyLogName, _propertyValue));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取全部的日志信息
        /// </summary>
        /// <param name="itemInf"></param>
        public void GetAllNotifylogItem(out List <NotifyContent> itemList)
        {
            int itemCnt = GetNotifylogItemCount();

            itemList = new List <NotifyContent>();

            for (int i = 0; i < itemCnt; i++)
            {
                NotifyContent newItemInf = new NotifyContent();
                if (GetNotifylogItem(i, ref newItemInf))
                {
                    itemList.Add(newItemInf);
                }
            }
        }
Ejemplo n.º 5
0
        public int CompareTo(object obj)
        {
            if (!(obj is NotifyContent))
            {
                return(-1);
            }
            NotifyContent temp = (NotifyContent)obj;

            if (temp.NotifyState > temp.NotifyState)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 6
0
        public object Clone()
        {
            NotifyContent temp = new NotifyContent();

            temp._errNotifyType = this._errNotifyType;
            temp._msgContent    = this._msgContent;
            temp._msgDate       = this._msgDate;
            temp._msgID         = this._msgID;
            temp._msgTitle      = this._msgTitle;
            temp._notifyState   = this._notifyState;
            temp._receiver      = this._receiver;
            temp._screenName    = this._screenName;

            temp.AttachmentFileNameList = new List <string>();
            foreach (string att in _attachmentFileNameList)
            {
                temp.AttachmentFileNameList.Add(att);
            }
            return(temp);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 读取指定序号的日志项
        /// </summary>
        /// <param name="index"></param>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool GetNotifylogItem(int index, ref NotifyContent itemInf)
        {
            _scaleIndex[0] = 0;
            _scaleIndex[1] = index;

            string[] valueArray;
            if (!GetXmlScaleSpecElements(1, _scaleIndex, NotifyLogName, out valueArray))
            {
                return(false);
            }
            try
            {
                itemInf.NotifyState = (NotifyState)Enum.Parse(typeof(NotifyState),
                                                              valueArray[(int)NotifyLogInfoType.NotifyState]);
                if (!Enum.IsDefined(typeof(NotifyState), itemInf.NotifyState))
                {
                    return(false);
                }
                itemInf.ErrNotifyType = (NotifyType)Enum.Parse(typeof(NotifyType),
                                                               valueArray[(int)NotifyLogInfoType.NotifyType]);
                if (!Enum.IsDefined(typeof(NotifyType), itemInf.ErrNotifyType))
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }

            itemInf.MsgContent = valueArray[(int)NotifyLogInfoType.Context];
            itemInf.MsgDate    = valueArray[(int)NotifyLogInfoType.Date];
            itemInf.MsgID      = valueArray[(int)NotifyLogInfoType.ID];
            itemInf.Receiver   = valueArray[(int)NotifyLogInfoType.Receiver];
            itemInf.ScreenName = valueArray[(int)NotifyLogInfoType.ScreenName];
            itemInf.MsgTitle   = valueArray[(int)NotifyLogInfoType.Title];

            return(true);
        }
Ejemplo n.º 8
0
        public object Clone()
        {
            NotifyContent temp = new NotifyContent();
            temp._errNotifyType = this._errNotifyType;
            temp._msgContent = this._msgContent;
            temp._msgDate = this._msgDate;
            temp._msgID = this._msgID;
            temp._msgTitle = this._msgTitle;
            temp._notifyState = this._notifyState;
            temp._receiver = this._receiver;
            temp._screenName = this._screenName;

            temp.AttachmentFileNameList = new List<string>();
            foreach (string att in _attachmentFileNameList)
            {
                temp.AttachmentFileNameList.Add(att);
            }
            return temp;
        }
Ejemplo n.º 9
0
 private void UpdatePropertyValue(NotifyContent itemInf)
 {
     _propertyValue[(int)NotifyLogInfoType.Context] = itemInf.MsgContent;
     _propertyValue[(int)NotifyLogInfoType.Date] = itemInf.MsgDate;
     _propertyValue[(int)NotifyLogInfoType.ID] = itemInf.MsgID;
     _propertyValue[(int)NotifyLogInfoType.NotifyState] = itemInf.NotifyState.ToString();
     _propertyValue[(int)NotifyLogInfoType.NotifyType] = itemInf.ErrNotifyType.ToString();
     _propertyValue[(int)NotifyLogInfoType.Receiver] = itemInf.Receiver;
     _propertyValue[(int)NotifyLogInfoType.ScreenName] = itemInf.ScreenName;
     _propertyValue[(int)NotifyLogInfoType.Title] = itemInf.MsgTitle;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 更新指定ID的日志项
        /// </summary>
        /// <param name="msgID"></param>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool ModifyNotifylogItemBySpecificID(string msgID, NotifyContent itemInf)
        {
            if (itemInf == null)
            {
                return false;
            }

            int itemCnt = GetNotifylogItemCount();

            for (int i = itemCnt - 1; i >= 0; i--)
            {
                NotifyContent newItemInf = new NotifyContent();
                if (GetNotifylogItem(i, ref newItemInf))
                {
                    if (newItemInf.MsgID == msgID)
                    {
                        UpdatePropertyValue(itemInf);

                        _scaleIndex[0] = 0;
                        _scaleIndex[1] = i;
                        return ModifyXmlScaleElement(1, _scaleIndex, _propertyValue.Length, NotifyLogName, _propertyValue);
                    }
                }
            }
            return false;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 读取指定序号的日志项
        /// </summary>
        /// <param name="index"></param>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool GetNotifylogItem(int index, ref NotifyContent itemInf)
        {
            _scaleIndex[0] = 0;
            _scaleIndex[1] = index;

            string[] valueArray;
            if (!GetXmlScaleSpecElements(1, _scaleIndex, NotifyLogName, out valueArray))
            {
                return false;
            }
            try
            {
                itemInf.NotifyState = (NotifyState)Enum.Parse(typeof(NotifyState),
                                       valueArray[(int)NotifyLogInfoType.NotifyState]);
                if (!Enum.IsDefined(typeof(NotifyState), itemInf.NotifyState))
                {
                    return false;
                }
                itemInf.ErrNotifyType = (NotifyType)Enum.Parse(typeof(NotifyType),
                                       valueArray[(int)NotifyLogInfoType.NotifyType]);
                if (!Enum.IsDefined(typeof(NotifyType), itemInf.ErrNotifyType))
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }

            itemInf.MsgContent = valueArray[(int)NotifyLogInfoType.Context];
            itemInf.MsgDate = valueArray[(int)NotifyLogInfoType.Date];
            itemInf.MsgID = valueArray[(int)NotifyLogInfoType.ID];
            itemInf.Receiver = valueArray[(int)NotifyLogInfoType.Receiver];
            itemInf.ScreenName = valueArray[(int)NotifyLogInfoType.ScreenName];
            itemInf.MsgTitle = valueArray[(int)NotifyLogInfoType.Title];

            return true;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取全部的日志信息
        /// </summary>
        /// <param name="itemInf"></param>
        public void GetAllNotifylogItem(out List<NotifyContent> itemList)
        {
            int itemCnt = GetNotifylogItemCount();
            itemList = new List<NotifyContent>();

            for (int i = 0; i < itemCnt; i++)
            {
                NotifyContent newItemInf = new NotifyContent();
                if (GetNotifylogItem(i, ref newItemInf))
                {
                    itemList.Add(newItemInf);
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 添加一日志项
        /// </summary>
        /// <param name="itemInf"></param>
        /// <returns></returns>
        public bool AddNotifyLog(NotifyContent itemInf)
        {
            if (itemInf == null)
            {
                return false;
            }
            UpdatePropertyValue(itemInf);

            _scaleIndex[0] = 0;
            _scaleIndex[1] = GetNotifylogItemCount();
            return AddXmlScaleElement(1, _scaleIndex, _propertyValue.Length, NotifyLogName, _propertyValue);
        }