public ObservableCollection <ListViewContactsInfo> GetContactDetails(int count) { DataTable dt = new DataTable("Student"); dt.Columns.Add("ContactID", typeof(Int32)); dt.Columns.Add("ContactName", typeof(string)); dt.Columns.Add("ContactType", typeof(string)); dt.Columns.Add("ContactNumber", typeof(string)); //Data for (int i = 0; i < count; i++) { dt.Rows.Add(i, CustomerNames[i], contactType[random.Next(0, 5)], random.Next(100, 400).ToString() + "-" + random.Next(500, 800).ToString() + "-" + random.Next(1000, 2000).ToString()); } ObservableCollection <ListViewContactsInfo> studentList = new ObservableCollection <ListViewContactsInfo>(); for (int i = 0; i < dt.Rows.Count; i++) { var student = new ListViewContactsInfo(); student.ContactID = Convert.ToInt32(dt.Rows[i]["ContactID"]); student.ContactName = dt.Rows[i]["ContactName"].ToString(); student.ContactType = dt.Rows[i]["ContactType"].ToString(); student.ContactNumber = dt.Rows[i]["ContactNumber"].ToString(); studentList.Add(student); } return(studentList); }
public ObservableCollection <ListViewContactsInfo> GetContactDetails(int count) { ObservableCollection <ListViewContactsInfo> customerDetails = new ObservableCollection <ListViewContactsInfo>(); Assembly assembly = typeof(GroupingPage).GetTypeInfo().Assembly; for (int i = 0; i < CustomerNames.Count(); i++) { var details = new ListViewContactsInfo() { ContactType = contactType[random.Next(0, 5)], ContactNumber = random.Next(100, 400).ToString() + "-" + random.Next(500, 800).ToString() + "-" + random.Next(1000, 2000).ToString(), ContactName = CustomerNames[i], }; customerDetails.Add(details); } return(customerDetails); }
public void GenerateSource() { ContactsInfo = new ObservableCollection <ListViewContactsInfo>(); Assembly assembly = typeof(GroupingPage).GetTypeInfo().Assembly; Random random = new Random(); for (int i = 0; i < CustomerNames.Count(); i++) { var details = new ListViewContactsInfo() { ContactType = contactType[random.Next(0, 5)], ContactNumber = random.Next(100, 400).ToString() + "-" + random.Next(500, 800).ToString() + "-" + random.Next(1000, 2000).ToString(), ContactName = CustomerNames[i], ContactImage = ImageSource.FromResource("Grouping.Images.Image" + random.Next(0, 28) + ".png", assembly), }; ContactsInfo.Add(details); } }