示例#1
0
        public Task UpdateKapasitas(int id_kelas, bool val)
        {
            notif n = new notif();

            n.id_kelas = id_kelas;
            n.val      = val;
            return(Clients.All.InvokeAsync("UpdateKelas", n));
        }
示例#2
0
 public void init(TextAsset text, notif ntf)
 {
     transform.SetParent(GameObject.Find("Canvas").transform, false);
     transform.SetAsLastSibling();
     this.text = text;
     this.noti = ntf;
     textword  = new Talk_Separate().Separate(text);
     max       = new Talk_Separate().row(text);
     set       = true;
     transform.GetChild(0).GetComponent <Text>().text = textword[i, 1];
     wait_flag = false;
     wait_start();
 }
        public ActionResult notification(notif nf)
        {
            //try
            //{
            notification notif = new notification();

            notif.date = DateTime.Now;
            if (nf.type == "Task")
            {
                notif.userId       = nf.assignTo;
                notif.type         = nf.type;
                notif.notifcontent = nf.createdBy + " assigned you a task in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Task Submit")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Task";
                notif.notifcontent = nf.createdBy + " finished the task in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Task Cancel")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Task";
                notif.notifcontent = nf.createdBy + " cancelled the submission of task in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Task Approve")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Task";
                notif.notifcontent = nf.createdBy + " approved the submission of your task in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Task Return")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Task";
                notif.notifcontent = nf.createdBy + " returned your task in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Project")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Project";
                notif.notifcontent = nf.createdBy + " added you in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }
            else if (nf.type == "Project Remove")
            {
                notif.userId       = nf.assignTo;
                notif.type         = "Project";
                notif.notifcontent = nf.createdBy + " removed you in " + nf.projTitle + " Project";
                notif.id           = nf.projId;
                notif.status       = "New";
            }

            db.notifications.Add(notif);
            db.SaveChanges();


            var connectionId = db.users.Where(e => e.userId == notif.userId).Select(e => e.connectionid).First();
            var multipleVal  = new { connId = connectionId, content = notif.notifcontent, type = notif.type, id = notif.id };

            return(Json(multipleVal, JsonRequestBehavior.AllowGet));
            //}
            //catch (Exception e)
            //{
            //    return Json("Error", JsonRequestBehavior.AllowGet);
            //}
        }