public void AddEmail(int id) { Email email = EmailList[id]; GameObject obj = Instantiate(emailPrefab, content); obj.transform.SetAsFirstSibling(); EmailGrid emailGrid = obj.GetComponent <EmailGrid>(); emailGrid.UpdateEmail(email); }
private void Bind(int pageIndex) { try { using (RockyingDataClassesDataContext db = new RockyingDataClassesDataContext(Utility.ConnectionString)) { string query = "SELECT [ID], [ToAddress], [LastAttempt], [ToName], [ReadDate], [EmailGroup], [EmailType], [IsSent], [IsRead], [CreateDate], [SentDate], [Subject] FROM [EmailMessage] WHERE 1=1 "; if (TypeDropDown.SelectedValue != "") { query = string.Format("{0} AND([EmailType] = {1})", query, TypeDropDown.SelectedValue); } if (GroupDropDown.SelectedValue != "") { query = string.Format("{0} AND(EmailGroup = '{1}')", query, GroupDropDown.SelectedValue); } if (SentDropDown.SelectedValue != "") { query = string.Format("{0} AND([IsSent] = {1})", query, SentDropDown.SelectedValue); } if (ReadDropDown.SelectedValue != "") { query = string.Format("{0} AND([IsRead] = {1})", query, ReadDropDown.SelectedValue); } query = string.Format("{0} ORDER BY CreateDate desc ", query); EmailGrid.DataSource = db.ExecuteQuery <EmailMessage>(query, new object[] { }).ToList <EmailMessage>(); EmailGrid.PageIndex = pageIndex; EmailGrid.DataBind(); } } catch (Exception ex) { Trace.Write("Unable to fetch email records."); Trace.Write(ex.Message); Trace.Write(ex.StackTrace); } }