Example #1
0
        public HttpResponseMessage MarkAsRead(Guid notificationId)
        {
            try
            {
                var currentUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();

                if (!currentUser.IsInRole("Registered Users"))
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized));
                }

                NotificationComponent notificationComponent = new NotificationComponent(notificationId);
                if (notificationComponent.Notification.UserId == currentUser.UserID)
                {
                    notificationComponent.Notification.Read = DateTime.Now;
                    if (notificationComponent.Save() > 0)
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, "Successful Operation"));
                    }
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
                }
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (HttpResponseException e)
            {
                throw e;
            }
            catch (Exception ee)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ee);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
Example #2
0
        protected void Session_Start(object sender, EventArgs e)
        {
            NotificationComponent NC = new NotificationComponent();
            var CurrentTime          = DateTime.Now;

            HttpContext.Current.Session["LastUpdated"] = CurrentTime;
        }
Example #3
0
        public override void Draw(SpriteBatch spriteBatch, SpriteFont spriteFont)
        {
            List <Entity> notifications = world.GetEntities(new[] { typeof(NotificationComponent) });

            foreach (Entity notification in notifications)
            {
                NotificationComponent notificationComponent = (NotificationComponent)notification.components[typeof(NotificationComponent)];
                if (notificationComponent.centerText)
                {
                    spriteBatch.DrawString(
                        spriteFont,
                        notificationComponent.text,
                        new Vector2(
                            world.screenRect.Width / 2 - spriteFont.MeasureString(notificationComponent.text).X / 2,
                            world.screenRect.Height / 3 - spriteFont.MeasureString(notificationComponent.text).Y / 2
                            ),
                        notificationComponent.color
                        );
                }
                else
                {
                    if (notification.HasComponent(typeof(PositionComponent)))
                    {
                        PositionComponent pc = (PositionComponent)notification.components[typeof(PositionComponent)];
                        spriteBatch.DrawString(spriteFont, notificationComponent.text, pc.position, notificationComponent.color);
                    }
                }
            }
        }
        protected void Session_Start(object sender, EventArgs e)
        {
            NotificationComponent nc = new NotificationComponent();
            var currentTime          = DateTime.Now;

            HttpContext.Current.Session["LastUpdated"] = currentTime;
            nc.RegisterNotification(currentTime);
        }
Example #5
0
        protected void Session_Start(object sender, EventArgs e)
        {
            NotificationComponent notiComponent = new NotificationComponent();
            var currentTime = DateTime.Now;

            HttpContext.Current.Session["FeedbackTime"] = currentTime;
            HttpContext.Current.Session["UserTime"]     = currentTime;
            notiComponent.RegisterNotification(currentTime);
        }
Example #6
0
        public JsonResult listar(int id, int?pagina)
        {
            NotificationComponent NC = new NotificationComponent();
            var list = NC.getNotificacoes(id, pagina);

            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #7
0
        public JsonResult addLast(int id)
        {
            NotificationComponent NC = new NotificationComponent();
            var list = NC.getUltimaNotificacao(id);

            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #8
0
        public JsonResult GetNotificationWidget()
        {
            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetNotifications(User.Identity.Name);

            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #9
0
        public JsonResult GetNotifications()
        {
            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent nc = new NotificationComponent();
            var list = nc.GetMessages(notificationRegisterTime);

            Session["LastUpdate"] = DateTime.Now;

            return(Json(list));
        }
        /// <summary>
        /// Get Notification
        /// </summary>
        /// <returns>Returns JSON Result of recent changes</returns>
        public JsonResult GetNotification()
        {
            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent notificationComponent = new NotificationComponent();
            var list = notificationComponent.GetRecentChanges(notificationRegisterTime);

            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #11
0
        public JsonResult GetNotificationContacts()
        {
            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetContacts(notificationRegisterTime);

            Session["LastUpdated"] = DateTime.Now;
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult GetNotificationContacts()
        {
            //var notificationRegisterTime = Session["LastUpdated"] != null ? Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;
            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetContacts(2);

            //update session here for get only new added contacts (notification)
            //Session["LastUpdate"] = DateTime.Now;
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #13
0
        public JsonResult GetNotification()
        {
            var notificationRegisterTime = Session["LastTimeNotified"] != null?Convert.ToDateTime(Session["LastTimeNotified"]) : DateTime.Now;

            NotificationComponent notiCom = new NotificationComponent();
            var list = notiCom.GetPersonInfo(notificationRegisterTime);

            //UPDATE SESSION FOR GETTING NEWLY ADDED INFORMATION ONLY
            Session["LastTimeNotified"] = DateTime.Now;
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #14
0
        protected void Session_Start(object sender, EventArgs e)
        {
            int Id = 1;
            NotificationComponent NC = new NotificationComponent();
            var currentTime          = DateTime.Now;

            HttpContext.Current.Session["LastUpdated"] = currentTime;

            //Id = Int32.Parse(User.Identity.GetUserId());


            NC.RegisterNotification(currentTime);
        }
Example #15
0
        protected async void Session_Start(object sender, EventArgs e)
        {
            NotificationComponent       NC  = new NotificationComponent();
            ApplicationMandatoryService obj = new ApplicationMandatoryService();
            var userId = HttpContext.Current.Session["UserId"] as string;

            if (userId != null)
            {
                var data = await obj.GetLastLogindb(userId);

                var currentTime = data.CreatedDateandTime;
                HttpContext.Current.Session["LastUpdated"] = currentTime;
                NC.RegisterNotification(currentTime);
            }
        }
Example #16
0
        public override void Update(GameTime gametime)
        {
            List <Entity> notifications = world.GetEntities(new[] { typeof(NotificationComponent) });

            foreach (Entity notification in notifications)
            {
                NotificationComponent notificationComponent = (NotificationComponent)notification.components[typeof(NotificationComponent)];
                notificationComponent.elapsedTime += gametime.ElapsedGameTime.Milliseconds;
                if (notificationComponent.elapsedTime > notificationComponent.maxLife)
                {
                    world.RemoveEntity(notification);
                    continue;
                }
            }
        }
Example #17
0
        public static void TakeInvites()
        {
            var jsonList = LoginForm.Server.GetInvited(_MyClient.Id);

            if (jsonList != null)
            {
                foreach (var json in jsonList)
                {
                    var invite = JsonConvert.DeserializeObject <Friend>(json);                                     //Deserializa json para classe friend para pegar o id do invite
                    var person = JsonConvert.DeserializeObject <Client>(LoginForm.Server.FindById(invite.UserId)); //Deserializa json para classe client para pegar o nome pelo friendid no invite
                    if (!NotificationsFLP.Controls.ContainsKey(person.Name))
                    {
                        NotificationsFLP.Controls.Add(NotificationComponent.CreateBlock(person.Name, invite.Id));
                    }
                }
            }
        }
Example #18
0
        public void Run()
        {
            if (_notifications.IsEmpty() || _gameService.GameIsPaused)
            {
                return;
            }

            float delta = GswExtensions.GetDeltaTime();
            NotificationSettingsComponent settings = _settings.Components1[0];

            if (settings.CombineToOne)
            {
                string finalMessage = "";
                foreach (int i in _notifications)
                {
                    NotificationComponent notification = _notifications.Components1[i];
                    notification.Delay -= delta;
                    if (notification.Delay <= 0)
                    {
                        finalMessage += notification.Message + "~n~";
                        _ecsWorld.RemoveComponent <NotificationComponent>(_notifications.Entities[i]);
                    }
                }

                if (!string.IsNullOrEmpty(finalMessage))
                {
                    Game.DisplayNotification(finalMessage);
                }
            }
            else
            {
                foreach (int i in _notifications)
                {
                    NotificationComponent notification = _notifications.Components1[i];
                    notification.Delay -= delta;
                    if (notification.Delay <= 0)
                    {
                        if (!string.IsNullOrEmpty(notification.Message))
                        {
                            Game.DisplayNotification(notification.Message);
                        }
                        _ecsWorld.RemoveComponent <NotificationComponent>(_notifications.Entities[i]);
                    }
                }
            }
        }
Example #19
0
        public JsonResult GetNotificationContacts(string WhenCalled)
        {
            string user = User.Identity.GetUserName();
            string name = dbContext.Users.Where(x => x.Email == user).FirstOrDefault().Name;

            var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now;

            NotificationComponent NC = new NotificationComponent();
            var list = NC.GetNotifications(Convert.ToDateTime(Session["LastUpdated"]), name);

            //update session here for get only new added contacts (notification)
            if (WhenCalled == "update")
            {
                Session["LastUpdated"] = DateTime.Now;
            }
            return(new JsonResult {
                Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #20
0
        public JsonResult GetNotifications()
        {
            var userID = (int)Session["userID"];

            try
            {
                NotificationComponent NC = new NotificationComponent();
                var notifications        = NC.GetNotifications(userID);
                var output = notifications.Select(s => new { Message = s.Message + " " + s.DateNotification.ToShortDateString() + " " + s.DateNotification.ToShortTimeString(), s.URL, s.ID, s.Avatar, s.ID_Project });
                return(new JsonResult {
                    Data = output, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Example #21
0
        public static int SetNotification(string indicatorType, string objectType, Guid objectId, int toUserId, int?fromUserId, string tag)
        {
            NotificationComponent notificationComponent = new NotificationComponent();

            notificationComponent.Notification.Code       = indicatorType;
            notificationComponent.Notification.Created    = DateTime.Now;
            notificationComponent.Notification.UserId     = toUserId;
            notificationComponent.Notification.Message    = "V1";
            notificationComponent.Notification.ToolTip    = "V1";
            notificationComponent.Notification.Link       = objectId.ToString();
            notificationComponent.Notification.ObjectType = objectType;
            notificationComponent.Notification.Tag        = tag;

            if (fromUserId.HasValue == true)
            {
                notificationComponent.Notification.UserNotificationConnections.Add(new UserNotificationConnection()
                {
                    UserNotificationConnection1 = Guid.NewGuid(),
                    UserId = fromUserId.Value,
                    Rol    = string.Empty
                });
            }
            return(notificationComponent.Save());
        }
Example #22
0
        //[ValidateAntiForgeryToken]
        public ActionResult ResetPassword(MaintenanceModel maintenance)
        {
            DBConnection();
            DBMaintenance dBMaintenance = new DBMaintenance();

            var result = dBMaintenance.ResetPassword(maintenance);

            maintenance = dBMaintenance.PopulateUserInformationDB(maintenance.UserID);

            //ViewBag.LoginAuthentication = "Login";
            //ViewBag.HeaderSuccess = string.Format("New password set.");
            //ViewBag.MessageSuccess = string.Format("Your Password has been changed.");

            Session["UserID"]          = maintenance.UserID;
            Session["Fullname"]        = maintenance.Fullname;
            Session["UserRoleID"]      = maintenance.RoleID;
            Session["UserRole"]        = maintenance.RoleName;
            Session["Department"]      = maintenance.DepartmentID;
            Session["GroupID"]         = maintenance.GroupID;
            Session["DesignationID"]   = maintenance.DesignationID;
            Session["GroupName"]       = maintenance.Group;
            Session["DesignationName"] = maintenance.Designation;

            FormsAuthentication.SetAuthCookie(Session["UserID"].ToString(), false); // render Session into Authentication Cookie
            SqlDependency.Start(con);
            SqlDependency.Start(con2);
            SqlDependency.Start(con3);
            NotificationComponent NC = new NotificationComponent();

            NC.group = maintenance.DesignationID;
            NC.Notificaton(maintenance.DesignationID);
            NC.UpdateItemRequestNotificaton();
            NC.NotificatonItem();
            NC.NotificatonUpdateItem();
            return(Json(result));
        }
Example #23
0
        public ActionResult LoginAuthentication(MaintenanceModel maintenance)
        {
            var username = maintenance.Username;
            var password = maintenance.Password;

            //if (User.Identity.IsAuthenticated)
            //{
            //    return RedirectToAction("Dashboard", "Home");
            //}
            //System.Web.Helpers.AntiForgery.Validate();
            try
            {
                DBConnection();

                DBMaintenance dBMaintenance = new DBMaintenance();
                maintenance = dBMaintenance.UserAuthentication(maintenance);
            }
            catch
            {
                ViewBag.LoginAuthentication = "Login";
                ViewBag.HeaderError         = string.Format("Unable  to connect to server.");
                ViewBag.MessageError        = string.Format("Check your server connection settings.");

                ViewBag.UserField = username;
                return(View());
            }

            if (maintenance != null)
            {
                if (maintenance.Status == "2")
                {
                    ViewBag.LoginAuthentication = "Login";
                    ViewBag.HeaderError         = string.Format("Account Issue.");
                    ViewBag.MessageError        = string.Format("Your account has been inactive.");

                    ViewBag.UserField = username;
                    return(View());
                }

                else if (maintenance.ResetPassword == 1)
                {
                    if (maintenance.Code.Trim() == password || maintenance.Password.Trim() == "P@ssw0rd")
                    {
                        ViewBag.LoginAuthentication = "ResetPassword";
                        AllModels models = new AllModels();
                        models.Maintenance = maintenance;
                        return(View(models));
                    }
                    else
                    {
                        ViewBag.LoginAuthentication = "Login";
                        ViewBag.HeaderWarning       = string.Format("Reset Password.");
                        ViewBag.MessageWarning      = string.Format("Please Enter Code.");

                        ViewBag.UserField = username;
                        return(View());
                    }
                }
                else
                {
                    if (maintenance.Code == password)
                    {
                        ViewBag.LoginAuthentication = "Login";
                        ViewBag.HeaderError         = string.Format("Login Failed.");
                        ViewBag.MessageError        = string.Format("Username or Password is incorrect.");

                        ViewBag.UserField = username;
                        return(View());
                    }
                    else
                    {
                        Session["UserID"]          = maintenance.UserID;
                        Session["Fullname"]        = maintenance.Fullname;
                        Session["UserRoleID"]      = maintenance.RoleID;
                        Session["UserRole"]        = maintenance.RoleName;
                        Session["Department"]      = maintenance.DepartmentID;
                        Session["GroupID"]         = maintenance.GroupID;
                        Session["DesignationID"]   = maintenance.DesignationID;
                        Session["GroupName"]       = maintenance.Group;
                        Session["DesignationName"] = maintenance.Designation;

                        FormsAuthentication.SetAuthCookie(Session["UserID"].ToString(), false); // render Session into Authentication Cookie

                        SqlDependency.Start(con);
                        SqlDependency.Start(con2);
                        SqlDependency.Start(con3);
                        NotificationComponent NC = new NotificationComponent();
                        NC.group = maintenance.GroupID;
                        NC.Notificaton(maintenance.GroupID);
                        NC.UpdateItemRequestNotificaton();
                        NC.NotificatonItem();
                        NC.NotificatonUpdateItem();
                        return(RedirectToAction("Dashboard", "Home"));
                    }
                }
            }
            else
            {
                ViewBag.LoginAuthentication = "Login";
                ViewBag.HeaderError         = string.Format("Login Failed.");
                ViewBag.MessageError        = string.Format("Username or Password is incorrect.");

                ViewBag.UserField = username;
                return(View());
            }
        }
Example #24
0
        public static string GetNotificationText(this NotificationComponent notificationComponent)
        {
            Thread.Sleep(1000);

            return(notificationComponent.Notification.Text);
        }
Example #25
0
 public NotificationController(GlobalContext context, NotificationModel model, NotificationComponent component)
 {
     _context   = context;
     _model     = model;
     _component = component;
 }
 public FoldersAndLabelsPage(IWebDriver driver) : base(driver)
 {
     FolderComponent       = new FolderComponent(driver);
     LabelComponent        = new LabelComponent(driver);
     NotificationComponent = new NotificationComponent(driver);
 }
 private void HandleNoti(object sender, NotificationComponent e)
 {
 }