Пример #1
0
        public PostActionRepo Exec(XDocument xDoc, string arg = null)
        {
            var time = DateTime.Now;

            time = time.AddDays(-1);
            string Time = time.ToString("d", CultureInfo.CreateSpecificCulture("fr-FR"));

            IEnumerable <XElement> XElementsFilterByTime =
                from el in xDoc.Descendants(TASK)
                from attr in el.Attributes()
                where attr.Name.ToString().Equals(TIME)
                where attr.Value.ToString().Contains(Time)
                select el;

            var taskRepos = XElementsFilterByTime.Select(n => new TaskRepo
            {
                Content  = n.Value,
                DataTime = n.Attribute(TIME).Value
            }).ToList();

            var postActionRepo = new PostActionRepo()
            {
                TaskRepos = taskRepos
            };

            return(postActionRepo);
        }
Пример #2
0
        public void Save(PostActionRepo postActionRepo)
        {
            if (postActionRepo.XDoc != null && postActionRepo.TaskRepos != null)
            {
                foreach (var task in postActionRepo.TaskRepos)
                {
                    task.Content = EncryptController.GetInstance().EncryptXDoc(task.Content);
                    postActionRepo.XDoc.Element(TASKS).Add(task.GetXElement());
                }

                postActionRepo.XDoc.Save(FilePath);
            }
        }
Пример #3
0
        public PostActionRepo Exec(XDocument xDoc, string arg)
        {
            var postActionRepo = new PostActionRepo()
            {
                XDoc      = xDoc,
                TaskRepos = new List <TaskRepo>()
                {
                    new TaskRepo()
                    {
                        Content = arg
                    }
                }
            };

            return(postActionRepo);
        }
Пример #4
0
        public PostActionRepo Exec(XDocument xDoc, string criteria = null)
        {
            var firstElement = xDoc.Root.Descendants(TASK).First();


            var postActionRepo = new PostActionRepo()
            {
                TaskRepos = new List <TaskRepo>
                {
                    new TaskRepo()
                    {
                        Content  = firstElement.Value,
                        DataTime = firstElement.Attribute(TIME).Value
                    }
                }
            };

            return(postActionRepo);
        }
Пример #5
0
        public PostActionRepo Exec(XDocument xDoc, string time)
        {
            IEnumerable <XElement> XElementsFilterByTime =
                from el in xDoc.Descendants(TASK)
                from attr in el.Attributes()
                where attr.Name.ToString().Equals(TIME)
                where attr.Value.ToString().Contains(time)
                select el;

            var taskRepos = XElementsFilterByTime.Select(n => new TaskRepo
            {
                Content  = n.Value,
                DataTime = n.Attribute(TIME).Value
            }).ToList();

            var postActionRepo = new PostActionRepo()
            {
                TaskRepos = taskRepos
            };

            return(postActionRepo);
        }