コード例 #1
0
        public ModelViewConfiguration UpdateURLY(ModelViewConfiguration data, int[] Usuarios)
        {
            var objRepository    = new RepositoryConfiguration();
            var objRepositoryMsj = new RepositoryReceivers();
            var config           = objRepository.Get(data.ConfigurationID);

            config.Title      = data.Title;
            config.Message    = data.Message;
            config.Url        = data.Url;
            config.ModifyDate = DateTime.UtcNow;
            objRepository.Update(config);

            List <int> IDS = objRepositoryMsj.GetByConfiguration(config.ConfigurationID).Select(a => a.UserID).ToList();

            objRepositoryMsj.Delete(IDS, config.ConfigurationID);
            foreach (var item in Usuarios)
            {
                EntityReceivers receivers = new EntityReceivers()
                {
                    ConfigurationID = config.ConfigurationID,
                    UserID          = item,
                    MessageCreate   = true,
                    CreateDate      = DateTime.Now,
                    ModifyDate      = DateTime.UtcNow
                };
                receivers = objRepositoryMsj.Insert(receivers);
            }

            return(data);
        }
コード例 #2
0
        public ModelViewConfiguration InsertURLY(ModelViewConfiguration data, int[] Usuarios)
        {
            var objRepository          = new RepositoryConfiguration();
            var objRepositoryMsj       = new RepositoryReceivers();
            EntityConfiguration config = new EntityConfiguration()
            {
                ConfigurationID = data.ConfigurationID,
                Title           = data.Title,
                Message         = data.Message,
                Url             = data.Url,
                Status          = true,
                CreateDate      = DateTime.Now,
                ModifyDate      = DateTime.UtcNow
            };

            config = objRepository.Insert(config);
            foreach (var item in Usuarios)
            {
                EntityReceivers receivers = new EntityReceivers()
                {
                    ConfigurationID = config.ConfigurationID,
                    UserID          = item,
                    MessageCreate   = true,
                    CreateDate      = DateTime.Now,
                    ModifyDate      = DateTime.UtcNow
                };
                receivers = objRepositoryMsj.Insert(receivers);
            }

            return(data);
        }
コード例 #3
0
        public ModelViewConfiguration Insert(string fileUpload, ModelViewConfiguration data, string path, int[] Usuarios)
        {
            string fileName    = data.Url;
            string combinePath = path + fileName;

            System.IO.File.Copy(fileUpload, combinePath, true);
            System.IO.File.Delete(fileUpload);
            var objRepository          = new RepositoryConfiguration();
            var objRepositoryMsj       = new RepositoryReceivers();
            EntityConfiguration config = new EntityConfiguration()
            {
                ConfigurationID = data.ConfigurationID,
                Title           = data.Title,
                Message         = data.Message,
                Url             = GlobalConfiguration.urlRequest + "Content/Notification/" + fileName,
                Status          = true,
                CreateDate      = DateTime.Now,
                ModifyDate      = DateTime.UtcNow
            };

            config = objRepository.Insert(config);
            foreach (var item in Usuarios)
            {
                EntityReceivers receivers = new EntityReceivers()
                {
                    ConfigurationID = config.ConfigurationID,
                    UserID          = item,
                    MessageCreate   = true,
                    CreateDate      = DateTime.Now,
                    ModifyDate      = DateTime.UtcNow
                };
                receivers = objRepositoryMsj.Insert(receivers);
            }
            return(data);
        }
コード例 #4
0
        public ModelViewConfiguration Update(string fileUpload, ModelViewConfiguration data, string path, int[] Usuarios)
        {
            string fileName = data.Url;

            if (File.Exists(fileUpload))
            {
                string combinePath = path + fileName;
                System.IO.File.Copy(fileUpload, combinePath, true);
                System.IO.File.Delete(fileUpload);
            }

            var objRepository    = new RepositoryConfiguration();
            var objRepositoryMsj = new RepositoryReceivers();
            var config           = objRepository.Get(data.ConfigurationID);

            config.Title      = data.Title;
            config.Message    = data.Message;
            config.Url        = File.Exists(fileUpload) ? GlobalConfiguration.urlRequest + "Content/Notification/" + data.Url: config.Url;
            config.ModifyDate = DateTime.UtcNow;
            objRepository.Update(config);
            List <int> IDS = objRepositoryMsj.GetByConfiguration(config.ConfigurationID).Select(a => a.UserID).ToList();

            objRepositoryMsj.Delete(IDS, config.ConfigurationID);
            foreach (var item in Usuarios)
            {
                EntityReceivers receivers = new EntityReceivers()
                {
                    ConfigurationID = config.ConfigurationID,
                    UserID          = item,
                    MessageCreate   = true,
                    CreateDate      = DateTime.Now,
                    ModifyDate      = DateTime.UtcNow
                };
                receivers = objRepositoryMsj.Insert(receivers);
            }
            return(data);
        }
コード例 #5
0
 public ModelViewReceivers Update(EntityReceivers data)
 {
     return((ModelViewReceivers) new RepositoryReceivers().Update((EntityReceivers)data));
 }