#region private DataTable CreateDataSource
private DataTable dtReferrals = null;
private DataTable CreateDataSource
{
get
{
this.dtReferrals = createDataSource();
return this.dtReferrals;
}
}
private DataTable createDataSource()
{
// return (DataTable)(Referrals + Children);
DataTable dt = new DataTable("scheduledContacts");
dt.Columns.Add("ChildID", typeof(string));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Age", typeof(string));
dt.Columns.Add("Gender", typeof(string));
dt.Columns.Add("ContactDate", typeof(DateTime));
dt.Columns.Add("LastContactDate", typeof(DateTime));
dt.Columns.Add("NextToLastContactDate", typeof(DateTime));
dt.Columns.Add("ServiceComponent", typeof(string));
dt.Columns.Add("CareGiver", typeof(string));
dt.Columns.Add("PlacementAddressLine1", typeof(string));
dt.Columns.Add("PlacementAddressLine2", typeof(string));
dt.Columns.Add("PhoneNoFormat", typeof(string));
dt.Columns.Add("FacilityType", typeof(string));
dt.Columns.Add("IsReferral",typeof(bool));
DataRow row = null;
//add children to dt
foreach(LiveChain.CSW.CommonData.ChildData child in children)
{
row = dt.NewRow();
row["ChildID"] = child.ChildId;
row["Name"] = child.Name;
row["Age"] = child.Age;
row["Gender"] = child.Gender;
row["ContactDate"] = child.ContactDate;
row["LastContactDate"] = child.LastContactDate;
row["NextToLastContactDate"] = child.NextToLastContactDate;
row["ServiceComponent"] = child.ServiceComponent;
row["CareGiver"] = child.Caregiver;
row["PlacementAddressLine1"] = child.PlacementAddressLine1;
row["PlacementAddressLine2"] = child.PlacementAddressLine2 ;
row["PhoneNoFormat"] = child.PhoneNoFormat;
row["FacilityType"] = child.FacilityType;
row["IsReferral"] = false;
dt.Rows.Add(row);
}
foreach(LiveChain.CSW.CommonData.CurrentReferralData referral in Referrals)
{
row = dt.NewRow();
row["ChildID"] = referral.ReferralId + RefMark;
row["Name"] = referral.ReferralName;
row["Age"] = string.Empty;
row["Gender"] = string.Empty;
row["ContactDate"] = referral.ContactDate;
row["LastContactDate"] = referral.Last_Contact;
row["NextToLastContactDate"] = referral.Next_To_Last_Contact;
row["ServiceComponent"] = "ER";
row["CareGiver"] = string.Empty;
row["PlacementAddressLine1"] = referral.Address1 ;
row["PlacementAddressLine2"] = referral.Address2 ;
row["PhoneNoFormat"] = referral.TelephoneFormat;
row["FacilityType"] = string.Empty;
row["IsReferral"] = true;
dt.Rows.Add(row);
}
return dt;
}
#endregion