Hi I want to find relationship between two members,First time I am finding the Bottom Members
of Source_member,Then I am Taking each member and pushing every one on the stack(List<>) and try to find its
bottom members.If Destination_Member Doesn't found I want to remove this Member From List<>,How to remove this Members from List<>
DS = new DataSet();
da = new OdbcDataAdapter(sSQL, conn);
da.Fill(DS);
if(DS.Tables.Count > 0)
{
if (DS.Tables["table"].Rows.Count > 0)
{
for(int i = 0; i < DS.Tables["table"].Rows.Count; i++)
{
alRelationPath.Add(DS.Tables["table"].Rows[i]["AF_MemberID"].ToString());
lsFamilyMemberID.Add(DS.Tables["table"].Rows[i]["AF_MemberID"].ToString());
AllFamilyID(lsFamilyMemberID, 0);
lsFamilyMemberID.RemoveAt(lsFamilyMemberID.Count-1);
}
}
}
protected List<String> AllFamilyID(List<String> Member, int depth)
{
List<String> lsAllFamilyID = new List<String>();
if (++depth < 5)
{
String strMember = String.Join(",", Member.ToArray());
DS1 = new DataSet();
da1 = new OdbcDataAdapter(sSQL, conn);
da1.Fill(DS1);
if (DS1.Tables.Count > 0)
{
if (DS1.Tables["table"].Rows.Count > 0)
{
for (int j = 0; j < DS1.Tables["table"].Rows.Count; j++)
{
bool WhetherContains = lsAllFamilyID.Contains(DS1.Tables["table"].Rows[j]["AF_FamilyID"].ToString());
{
if (!WhetherContains)
{
lsAllFamilyID.Add(DS1.Tables["table"].Rows[j]["AF_FamilyID"].ToString());
}
}
AllMemberID(lsAllFamilyID, depth);
}
}
}
DS1.Dispose();
da1.Dispose();
}
return lsAllFamilyID;
}
List<String> lsAllMemberID = new List<String>();
protected List<String> AllMemberID(List<String> Family, int depth)
{
if (++depth < 5)
{
String strFamily = String.Join(",", Family.ToArray());
sSQL = "SELECT AF_MemberID FROM AllFamily_Master";
sSQL = sSQL + " WHERE AF_FamilyID IN (" + strFamily + ")";
sSQL = sSQL + " AND AF_MemberType IN ('S','D')";
DS2 = new DataSet();
da2 = new OdbcDataAdapter(sSQL, conn);
da2.Fill(DS2);
if (DS2.Tables.Count > 0)
{
if (DS2.Tables["table"].Rows.Count > 0)
{
for (int k = 0; k < DS2.Tables["table"].Rows.Count; k++)
{
bool WhetherContains = lsAllMemberID.Contains(DS2.Tables["table"].Rows[k]["AF_MemberID"].ToString());
{
if (!WhetherContains)
{
lsAllMemberID.Add(DS2.Tables["table"].Rows[k]["AF_MemberID"].ToString());
}
}
alRelationPath.Add(DS2.Tables["table"].Rows[k]["AF_MemberID"].ToString());
if (CheckMember(lsAllMemberID, lblUserToMemberID.Text))
{
return lsAllMemberID;
}
else
{
AllFamilyID(lsAllMemberID, depth);
}
}
}
}
DS2.Dispose();
da2.Dispose();
}
return lsAllMemberID;
}