public JsonResult GetNotificationUser(string data)
 {
     try
     {
         EntitySecurity model = new JavaScriptSerializer().Deserialize <EntitySecurity>(data);
         var            ls    = FacadeNotification.GetByToken(model);
         return(Json(ls, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         throw new Generic_Exception(ex, Generic_Exception.ErrorCodes.ErrorGoogleMaps);
     }
 }
        public JsonResult SetNotificationUser(string data)
        {
            try
            {
                ModelViewNotificationUpdate model = new JavaScriptSerializer().Deserialize <ModelViewNotificationUpdate>(data);
                FacadeNotification.Status(model);

                return(Json(new ModelViewResultREST()
                {
                    Result = "Success"
                }));
            }
            catch (Exception ex)
            {
                throw new Generic_Exception(ex, Generic_Exception.ErrorCodes.ErrorGoogleMaps);
            }
        }
        public ActionResult SetPublish(string ConfigurationIDs)
        {
            try
            {
                List <int> arr = ConfigurationIDs.Split(',').Select(Int32.Parse).ToList();
                foreach (var x in arr)
                {
                    var        envio = FacadeReceivers.GetAll().Where(p => p.ConfigurationID == x);
                    List <int> noti  = new List <int>();
                    var        confi = FacadeConfiguration.GetListAll().Where(p => p.ConfigurationID == x).FirstOrDefault();
                    confi.Publish = true;
                    ModelViewNotification message = new ModelViewNotification();

                    foreach (var y in envio)
                    {
                        noti.Add(y.UserID);
                        message.Message     = confi.Message;
                        message.Title       = confi.Title;
                        message.Url         = confi.Url;
                        message.UserID      = y.UserID;
                        message.MessageRead = false;
                        FacadeNotification.Insert(message);
                    }

                    FacadeNotification.SendPush(noti, confi.Title, confi.Message);
                    FacadeConfiguration.Update(confi);
                }



                //FacadeAudit.RegisterEntity("/ConfigPromotionTypes/Index", TransactionType.STATUS, "", "", user.IdUser);

                return(Json("Solicitud procesada con éxito", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                //if (ex.GetType().Name == "Duplicate_Exception") throw ex;
                //if (ex.GetType().Name == "CustomExceptions") throw ex;
                //throw new CustomExceptions(ex, CustomExceptions.ErrorCodes.E_C_Generic);
                throw ex;
            }
        }
        public ActionResult GetUserAll_Notification(string Employee)
        {
            var ls = FacadeNotification.GetAllNotificationUsers(Employee);

            return(Json(ls, JsonRequestBehavior.AllowGet));
        }
        public ActionResult GetUserAll_Actives(string ModuleID, string Name)
        {
            var ls = FacadeNotification.GetAllNotificationUsers(ModuleID, Name);

            return(Json(ls, JsonRequestBehavior.AllowGet));
        }