public ModelViewNotification Update(ModelViewNotification model)
        {
            EntityNotification data = new EntityNotification()
            {
                MessageID   = model.MessageID,
                Message     = model.Message,
                MessageRead = model.MessageRead,
                Title       = model.Title,
                Url         = model.Url,
                UserID      = model.UserID,
                Status      = model.Status,
                CreateDate  = model.CreateDate,
                ModifyDate  = DateTime.UtcNow
            };

            data = new RepositoryNotification().Update(data);
            return(model);
        }
        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 ModelViewNotification Insert(ModelViewNotification model)
        {
            EntityNotification data = new EntityNotification()
            {
                MessageID   = model.MessageID,
                Message     = model.Message,
                MessageRead = model.MessageRead,
                Title       = model.Title,
                Url         = model.Url,
                UserID      = model.UserID,
                Status      = true,
                CreateDate  = DateTime.UtcNow,
                ModifyDate  = DateTime.UtcNow
            };

            data            = new RepositoryNotification().Insert(data);
            model.MessageID = data.MessageID;

            return(model);
        }
예제 #4
0
 public static ModelViewNotification Update(ModelViewNotification model)
 {
     return(new BusinessNotification().Update(model));
 }
예제 #5
0
 public static ModelViewNotification Insert(ModelViewNotification model)
 {
     return(new BusinessNotification().Insert(model));
 }