Exemplo n.º 1
0
        public void Release(Notice notice)
        {
            if (notice == null)
            {
                throw new ApplicationException("通知为空");
            }
            database.Notice.Add(notice);
            database.SaveChanges();
            User user = database.User.Where(t => t.Id == notice.Sender).FirstOrDefault();

            if (user == null)
            {
                throw new ApplicationException("用户为空");
            }
            List <string> list = database.County.Where(t => t.ParentId == user.CountyId).Select(t => t.Id).ToList();

            if (list == null || list.Count == 0)
            {
                return;
            }
            var receivers = database.User.Where(t => list.Contains(t.CountyId)).ToList();

            foreach (var item in receivers)
            {
                NoticeReceiver detail = new NoticeReceiver();
                detail.NoticeId = notice.Id;
                detail.Receiver = item.Id;
                database.NoticeReceiver.Add(detail);
            }
            database.SaveChanges();
        }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //Get a reference to the creature and hold it so we only have to get it once
        creature       = (CreatureScript)GameObject.Find("Creature").GetComponent("CreatureScript");
        platformBridge = (NoticeReceiver)GameObject.Find("PlatformBridge").GetComponent("NoticeReceiver");

        // Assume the service is on when we start if there is no saved value.
        serviceToggle = (1 == PlayerPrefs.GetInt(SERVICE_TOGGLE, 1));

        // Don't display the privacy policy at start.
        displayPrivacyPolicy = false;
    }
Exemplo n.º 3
0
        public ActionResult ReceiveDetail()
        {
            string idStr = Request["id"];

            if (string.IsNullOrEmpty(idStr))
            {
                throw new ApplicationException("未传入指定参数");
            }
            int id = int.Parse(idStr);
            NoticeReceiverDao dao  = new NoticeReceiverDao();
            NoticeReceiver    item = dao.get(id);

            if (item == null)
            {
                throw new ApplicationException("未找到该通知信息" + id);
            }
            if (item.Status == NoticeStatus.Unread)
            {
                dao.setToRead(id);
            }
            dao.Dispose();
            return(View(item));
        }