Ejemplo n.º 1
0
 public void RefreshProducts()
 {
     this.Products.Data = DbLinq.Objects <Product>()
                          .OrderBy(x => x.Name)
                          .ThenBy(x => x.GetObjectNo())
                          .ToList();
 }
Ejemplo n.º 2
0
 public virtual void OnDelete()
 {
     foreach (Property property in DbLinq.Objects <Property>().Where(x => x.Item == this).ToList())
     {
         property.Delete();
     }
 }
Ejemplo n.º 3
0
        public override void OnDelete()
        {
            foreach (Module module in DbLinq.Objects <Module>().Where(x => x.Product == this).ToList())
            {
                module.Delete();
            }

            base.OnDelete();
        }
Ejemplo n.º 4
0
        public static GltfRef TryCreatingGltfRef(string ifcObjectGuid, B5dProjectNode project, B5dObject b5dObject)
        {
            var existingRef = DbLinq.Objects <GltfRef>().FirstOrDefault(o => o.BelongsTo == b5dObject);

            if (existingRef != null)
            {
                return(existingRef);
            }

            string documentsDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
            string conversionPath     = $"{documentsDirectory}\\Conversions";

            var projectName   = project.Name;
            var b5dObjectType = b5dObject.TypeSpecifier.ToLower();

            b5dObjectType = b5dObjectType.Replace("ifc", "");
            // The ifcTo3DTiles conversion renames WallStandardCase to Wall
            b5dObjectType = b5dObjectType.Replace("wallstandardcase", "wall");

            var ifcDirectory = $"{conversionPath}\\Conversion_{projectName}\\IFCs";
            var files        = Directory.GetFiles(ifcDirectory);
            var ifcFiles     = files.Where(f => f.ToLower().Contains(b5dObjectType));

            if (ifcFiles.Count() == 0)
            {
                return(null);
            }

            foreach (string ifcFilePath in ifcFiles)
            {
                var ifcModel  = IfcStore.Open(ifcFilePath);
                var ifcObject = ifcModel.Instances.FirstOrDefault() as IIfcObject;
                if (ifcObject.GlobalId == ifcObjectGuid)
                {
                    var        gltfFilepath = ifcFilePath.Replace("IFCs", "GLTFs").Replace(".ifc", ".gltf");
                    FileStream gltfFile     = File.Open(gltfFilepath, FileMode.Open);
                    var        filename     = Path.GetFileName(gltfFilepath);

                    if (ifcObject != null && gltfFile != null)
                    {
                        var fileRef = new GltfRef()
                        {
                            BelongsTo = b5dObject,
                            Extension = "gltf",
                            FileId    = ifcObjectGuid,
                            FileName  = filename,
                            MimeType  = "model/gltf+json",
                            FileSize  = gltfFilepath.Length,
                        };
                        return(fileRef);
                    }
                    break;
                }
            }

            return(null);
        }
 public void TestGetEnumerator_IEnumerable()
 {
     Scheduling.RunTask(() =>
     {
         var enumerable = (IEnumerable)DbLinq.Objects <Person>();
         var enumerator = enumerable.GetEnumerator();
         Assert.NotNull(enumerator);
     }).Wait();
 }
Ejemplo n.º 6
0
 public void Init()
 {
     this.DataTable = new DataTableBuilder <DataTableRow>()
                      .WithDataSource(DbLinq.Objects <Person>(), data => data.WithConverter(CreateDataTableRow))
                      .WithColumns(columns =>
                                   columns
                                   .AddColumn(b => b.FirstName, column => column.DisplayName("First Name").Sortable().Filterable())
                                   .AddColumn(b => b.LastName, column => column.Sortable().DisplayName("Last Name"))
                                   .AddColumn(b => b.Email, column => column.Filterable().Sortable().DisplayName("Email")))
                      .WithInitialPageSize(20)
                      .Build();
 }
Ejemplo n.º 7
0
        public void OnDelete()
        {
            foreach (Branch branch in DbLinq.Objects <Branch>().Where(x => x.Parent == this).ToList())
            {
                branch.Delete();
            }

            foreach (Commit commit in this.OwnCommits.ToList())
            {
                commit.Delete();
            }
        }