예제 #1
0
    public void SetSystemNotDic(string title, NoticeIdentify identify, NoticeState state, int sort, string content)
    {
        SystemNoticeType notice = new SystemNoticeType();

        notice.SetSystemNotice(title, identify, state, sort, content);

        List <KeyValuePair <int, SystemNoticeType> > myList = new List <KeyValuePair <int, SystemNoticeType> >(systemNotDic);

        myList.Sort(delegate(KeyValuePair <int, SystemNoticeType> s1, KeyValuePair <int, SystemNoticeType> s2)
        {
            return(s1.Value.mNoticeSort.CompareTo(s2.Value.mNoticeSort));
        });

        systemNotDic.Clear();

        foreach (KeyValuePair <int, SystemNoticeType> pair in myList)
        {
            systemNotDic.Add(pair.Key, pair.Value);
        }

        //foreach(string key in dic.Keys)
        // {
        //     Response.Write(dic[key] +"<br />");
        // }
        //foreach(var item in systemNotDic.OrderByDescending)
    }
예제 #2
0
    public void SetSystemNotList(string title, NoticeIdentify identify, NoticeState state, int sort, string content)
    {
        SystemNoticeType notice = new SystemNoticeType();

        notice.SetSystemNotice(title, identify, state, sort, content);
        SystemNoticeType temp = null;

        foreach (var item in systemNotList)
        {
            if (item.mNoticeSort == sort)
            {
                item.SetNoticChildSort(item.mNoticChildSort);
            }
        }
        for (int i = 0; i < systemNotList.Count; i++)
        {
            if (systemNotList[i].mNoticeSort <= notice.mNoticeSort &&
                systemNotList[i].mNoticChildSort > notice.mNoticChildSort)//当新公告优先级高于
            {
                temp             = systemNotList[i];
                systemNotList[i] = notice;
                notice           = temp;
            }
        }
        systemNotList.Add(notice);
    }