Created
January 3, 2011 18:52
-
-
Save emad-elsaid/763772 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace API1 | |
{ | |
class Program | |
{ | |
static List<int?> history; | |
static String sw = null; | |
static int index = 0; | |
static String getS(String entityName) | |
{ | |
List<int> lst;//back the Entity Id | |
List<int?> lst1; //back refEntityRefId | |
List<String> lst2 = null;//back the ifcRecord | |
List<String> lst4 = null; | |
List<String> lst3; | |
int EntID; | |
string[] arr = new string[] {}; | |
Entities2 e = new Entities2(); | |
lst = (from temp in e.Ifc_Entity | |
where temp.entityName == entityName | |
select temp.entityId).ToList(); | |
EntID = lst.ElementAt(0); | |
Console.WriteLine("EntID" + EntID); | |
lst1 = (from temp in e.Ifc_References | |
where temp.refEntityId == EntID | |
select temp.refEntityRefId).ToList(); | |
Console.WriteLine("lst1.Count" + lst1.Count); | |
lst.Add(EntID); | |
// history.Concat(lst1); | |
//history.Union(lst1);) | |
if (lst1.Count == 0) | |
{ | |
int? Idd = history.ElementAt(index); | |
String EntName = (from temp1 in e.Ifc_Entity | |
where temp1.entityId == Idd | |
select temp1.entityName).ToString(); | |
return getS(EntName); | |
history.Clear(); | |
} | |
// arr = new string[lst1.Count]; | |
String j; | |
for (int i = 0; i < lst1.Count; i++) | |
{ | |
int? temp = lst1.ElementAt(i); | |
//Predicate<string> x = temp.ToString; | |
lst2 = (from temp1 in e.Ifc | |
where temp1.ifcEntityRefId == temp | |
select temp1.ifcRecord).ToList(); | |
// Console.WriteLine(temp); | |
//Console.WriteLine(lst2.Last()); | |
//lst2.Concat(lst2); | |
} | |
//Console.WriteLine("lst2.Count"+lst2.Count); | |
for (int i = 0; i < lst1.Count; i++) | |
{ | |
sw = sw + "#( " + lst1.ElementAt(i)+ " )" + "\n"; | |
} | |
// history.Union(lst2); | |
//int? Id = lst1.ElementAt(index); | |
//lst3 = (from temp1 in e.Ifc_Entity | |
// where temp1.entityId == Id | |
// select temp1.entityName).ToList(); | |
//Console.WriteLine("lst3.Count" + lst3.Count); | |
//Console.WriteLine("index " + index); | |
//index = index + 1; | |
//if (lst1.Count <= index) | |
//{ | |
// return getS(lst3.ElementAt(index)); | |
//} | |
//else | |
//{ | |
// return sw; | |
//} | |
//return getS(lst3.ElementAt(0)); | |
return sw; | |
} | |
static String getObject(int offset) | |
{ | |
String s = getS("IFCAPPROVALPROPERTYRELATIONSHIP"); | |
char[] arr = sw.ToCharArray(); | |
return new String(arr, offset, 3); | |
} | |
static void Main(string[] args) | |
{ | |
getObject(0); | |
Console.WriteLine(sw); | |
// Console.WriteLine(getObject(0)); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment