Ejemplo n.º 1
0
        public void ReloadEntries()
        {
            RecordsManager manager = DataContext as RecordsManager;

            if (DataContext == null)
            {
                return;
            }
            List <Record> l = manager.Select(Conditions, StartOffset, MaxPerPage);

            if (l.Count == 0)
            {
                ParentContent.OnInfo("No more entries");
                return;
            }
            Results.Clear();
            List <RecordDescription> d = manager.Description;

            foreach (Record r in l)
            {
                BindableDynamicDictionary o = new BindableDynamicDictionary();
                o["ID"] = r.ID;
                for (int i = 0; i < d.Count; i++)
                {
                    o[d[i].Name] = d[i].ShowText(r.GetValue(i));
                }
                Results.Add(o);
            }
        }
Ejemplo n.º 2
0
        public async Task DeleteAsync(CreateOrDeleteParentInput input)
        {
            var parentContent = new ParentContent {
                IdParentContent = input.IdParent, IdContent = input.IdContent
            };

            _context.Entry(parentContent).State = EntityState.Deleted;
            await _context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
        static int scanTargetFolder(string TargetFolder)
        {
            int i = 0;

            if (TargetFolder != "")
            {
                Content[] array = new Content[10000000];

                // ADD MANIFEST AT THE TOP

                string[] parentDirectory = new string[] { TargetFolder };
                string[] subDirectories  = Directory.GetDirectories(TargetFolder, "*", SearchOption.AllDirectories).Where(x => !x.Contains("\\.")).ToArray();
                subDirectories = parentDirectory.Concat(subDirectories).ToArray();

                foreach (var subdir in subDirectories)
                {
                    string folderName = subdir.Split('\\').Last().ToLower().Trim();
                    if (folderName.Length > 0 && folderName[0] != '.')
                    {
                        var txtFiles = Directory.EnumerateFiles(subdir, "*.*", SearchOption.TopDirectoryOnly);
                        foreach (string currentFile in txtFiles)
                        {
                            if (Path.GetFileName(currentFile)[0] != '.' && Path.GetExtension(currentFile).ToLower() != "json" && Path.GetExtension(currentFile).ToLower() != "exe" &&
                                Path.GetExtension(currentFile).ToLower() != "zip" && Path.GetExtension(currentFile).ToLower() != "rar" && Path.GetExtension(currentFile).ToLower() != "7z")
                            {
                                FileInfo info = new System.IO.FileInfo(currentFile);
                                array[i] = new Content(currentFile.Replace(TargetFolder, "").Replace("\\", "/").Trim('/'), info.Length, info.LastWriteTimeUtc.ToFileTimeUtc());

                                i++;
                            }
                        }
                    }
                }

                // CLEAR UNUSED ARRAY ITEMS
                Content[] truncArray = new Content[i];
                Array.Copy(array, truncArray, truncArray.Length);

                // ENCODE AND SAVE JSON
                ParentContent obj  = new ParentContent(truncArray);
                string        json = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented);

                try { File.WriteAllText(TargetFolder + "\\layout.json", json); }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return(0);
                }
            }

            return(i);
        }
Ejemplo n.º 4
0
        private void AddRecord(object sender, RoutedEventArgs e)
        {
            RecordsManager manager = DataContext as RecordsManager;
            StackPanel     c       = FindName("Entries") as StackPanel;
            int            count   = manager.Description.Count;
            Record         rec     = new Record(count);

            for (int index = 0, i = 0; i < c.Children.Count; i++)
            {
                ControlValue val = c.Children[i] as ControlValue;
                if (val == null)
                {
                    continue;
                }
                rec.SetValue(val.ConvertToValue(), index);
                index++;
            }
            ParentContent.OnInfo("Added record");
            manager.AddRecord(rec);
            CreateNewForm();
        }