public void UpdateTable(SessionSalesPages pages, SessionSalesInfo sessions, DataRow current) { this.Clear(); filling = true; if (current != null) { DataRow[] pagerows = pages.Select(null, "Page"); foreach (DataRow page in pagerows) { bool found = false; DataRow[] rows = page.GetChildRows(pages.ChildRelations[0]); DataRow myrow = NewRow(); myrow[0] = current[1]; myrow[1] = page[1]; myrow[2] = page[2]; myrow[3] = page[3]; foreach (DataRow row in rows) { DataRow session = row.GetParentRow(sessions.ChildRelations[0]); // compare session ID with stuff. if (Convert.ToInt32(session[0]) == Convert.ToInt32(current[0])) { found = true; break; } } myrow[4] = found; myrow[5] = page; Rows.Add(myrow); } } filling = false; AcceptChanges(); }
public SessionSalesInfo( ) : base("session_sales_info", false, true) { initializing = true; AddDefaultColumns(true, false, true); infoset = new DataSet(); _pages = new SessionSalesPages(this); infoset.Tables.Add(this); infoset.Tables.Add(_pages); _page_view = new SessionPageView(); Create(); Fill(); // have to fill this before creating the relation... _pages_in_session = new MySQLRelationTable2 <SessionSalesInfo, SessionSalesPages>(this, _pages); this.RowChanged += new DataRowChangeEventHandler(SessionSalesInfo_RowChanged); _images = new SessionImageTable(this); //_images_in_session = new MySQLRelationTable( this, _images ); initializing = false; }