Home > Net >  C # to judge whether the collection contains B collection data
C # to judge whether the collection contains B collection data

Time:12-15

Requirements: the DataGrid in the interface binding ItemResult MultiItemAbnormal is abnormal diagnosis, MultiItemAbnormalDetail project is associated with abnormal diagnosis table,

According to the interface shows the value of the match out correct diagnosis suggested ?

Is not only a project Id to the same is also enabled judgment conditions,

 
Public class ItemResult
{
Public ItemResult (int id, string name, bool isEnable)
{
Enclosing the ItemId=id;
This. Name=Name;
Enclosing IsEnable=IsEnable;
}

///& lt; Summary>
///project Id
///& lt;/summary>
Public int ItemId {get; The set; }

///& lt; Summary>
///project name
///& lt;/summary>
Public string Name {get; The set; }

///& lt; Summary>
///whether to enable
///& lt;/summary>
Public bool IsEnable {get; The set; }

Public static List The DataSource
{
The get
{
Return new List ()
{
New ItemResult (10001, "the CEA", false),
New ItemResult (10002, "AFP", true),
New ItemResult (10003, "TPSA", true),
New ItemResult (10005, "CA72 4", false),
New ItemResult (10007, "CTFRA21-1", true),
New ItemResult (10008, "CA - 125", true)
};
}
}
}

Public class MultiItemAbnormal
{
Public MultiItemAbnormal (int id, int dId, int the sId, List The list)
{
Enclosing AbnormalId=id;
Enclosing DiagnosisId=dId;
Enclosing SuggestionId=sId;
Enclosing the Details=list;
}

///& lt; Summary>
///anomaly Id
///& lt;/summary>
Public int AbnormalId {get; The set; }

///& lt; Summary>
///diagnosis Id
///& lt;/summary>
Public int DiagnosisId {get; The set; }

///& lt; Summary>
///proposal Id
///& lt;/summary>
Public int SuggestionId {get; The set; }

Private List The details;
Public List The Details
{
The get
{
return details;
}
Set
{
If (the details==null)
The details=new List (a);
The details=value;
}
}

Public static List The DataSource
{
The get
{
Return new List ()
{
New MultiItemAbnormal (3831, 9447, 6, MultiItemAbnormalDetail DataSourceFirst),
New MultiItemAbnormal (4106, 26474, 8, MultiItemAbnormalDetail DataSourceSecond),
New MultiItemAbnormal (5126, 26513, 6, MultiItemAbnormalDetail DataSourceThird)
};
}
}
}

Public class MultiItemAbnormalDetail
{
IId public MultiItemAbnormalDetail (int id, int, Boolean isEnable)
{
Enclosing AbnormalId=id;
Enclosing the ItemId=iId;
Enclosing IsEnable=IsEnable;
}

///& lt; Summary>
///anomaly Id
///& lt;/summary>
Public int AbnormalId {get; The set; }

///& lt; Summary>
///project Id
///& lt;/summary>
Public int ItemId {get; The set; }

///& lt; Summary>
///whether to enable
///& lt;/summary>
Public bool IsEnable {get; The set; }

Public static List DataSourceFirst
{
The get
{
Return new List ()
{
New MultiItemAbnormalDetail (3100-02, true),
New MultiItemAbnormalDetail (3100-01, false),
New MultiItemAbnormalDetail (3100-03, true)
};
}
}

Public static List DataSourceSecond
{
The get
{
Return new List ()
{
New MultiItemAbnormalDetail (4100-02, true),
New MultiItemAbnormalDetail (4100-01, false)
};
}
}

Public static List DataSourceThird
{
The get
{
Return new List ()
{
New MultiItemAbnormalDetail (5100-05, false),
New MultiItemAbnormalDetail (08 5100, true)
};
}
}
}

CodePudding user response:

Missed a condition: if the result in [including] relationship, the project quantity output more diagnostic information
For example, A 10001100, 02100, 03 {}, {} 10001100 02 B meet at the same time, the output of A diagnostic information
  •  Tags:  
  • C#
  • Related