我正在为一个项目构建一个客户服务模块。我将用户提交的所有投诉存储在数据库中,并获取它们以显示在管理屏幕上。我的两个实体类代表投诉详情和投诉提出者详情如下
public class Complaint
{
#region Fields of the class
/// <summary>
/// List of Complaints
/// </summary>
private List<Complaint> complaints = new List<Complaint>();
#endregion
#region Properties of the class
public int Id { get; set; }
public string Type { get; set; }
public string Description { get; set; }
public string ActionTaken { get; set; }
public bool Status { get; set; }
public DateTime Date { get; set; }
public CSRInfo CsrId { get; set; }
public ComplaintRaiserInfo complaintraiser { get; set; }
#endregion
#region Methods of the class
/// <summary>
/// Gets all the complaints from the List of complaints
/// </summary>
/// <returns>Returns the list of the complaints</returns>
public List<Complaint> GetComplaints()
{
return complaints;
}
/// <summary>
/// Adds a complaint to List of Complaints
/// </summary>
/// <param name="newComplaint"></param>
public void AddComplaint(Complaint newComplaint)
{
complaints.Add(newComplaint);
}
#endregion
}
public class ComplaintRaiserInfo
{
#region Fields of the class
public List<int> ComplaintIds = new List<int>();
#endregion
#region Properties of the class
public FlightBooking BookingId { get; set; }
public string Name { get; set; }
public string MobileNo { get; set; }
public string EmailId { get; set; }
#endregion
#region Methods of the class
/// <summary>
/// Gets all the complaint ids from the List of complaint Ids
/// </summary>
/// <returns>Returns the list of the complaint ids</returns>
public List<int> GetComplaintIds()
{
return ComplaintIds;
}
/// <summary>
/// Adds a complaint id to List of Complaint Ids
/// </summary>
/// <param name="complaintId"></param>
public void AddComplaint(int complaintId)
{
ComplaintIds.Add(complaintId);
}
#endregion
}
成功从数据库中获取数据,我将其绑定到 ASP.net 网页中的 GridView,如下所示,
ComplaintManager complaintManager = new ComplaintManager();
List<Complaint> complaints = new List<Complaint>();
complaints = complaintManager.GetComplaints();
GridView1.DataSource = complaints;
GridView1.DataBind();
我的问题是显示了 Complaint 类的属性,但没有显示 ComplaintRaiserInfo 类的属性。请帮我解决问题。