Exemplo n.º 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)
    }
Exemplo n.º 2
0
        public ActionResult EditShortMessage(SMMessage message)
        {
            if (ModelState.IsValid)
            {
                string str;
                bool   toAllNewStudents;
                bool   toAllVolunteers;

                str = Request["toAllNewStudents"];
                if (str == "on")
                {
                    toAllNewStudents = true;
                    message.Type     = SystemNoticeType.SetBit(message.Type, SystemNoticeType.NewStudentNotice);
                }
                else
                {
                    toAllNewStudents = false;
                }
                str = Request["toAllVolunteers"];
                if (str == "on")
                {
                    toAllVolunteers = true;
                    message.Type    = SystemNoticeType.SetBit(message.Type, SystemNoticeType.VolunteerNotice);
                }
                else
                {
                    toAllVolunteers = false;
                }

                message.PostDate        = DateTime.Now;
                db.Entry(message).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Index", "Manage"));
        }
Exemplo n.º 3
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);
    }