public bool Open() { if (this.IsOpen) { throw new InvalidOperationException("DataConnector is already open."); } if (this.m_cmd == null) { throw new ArgumentNullException("Command", "No Command set."); } if (this.m_cmd.Connection == null) { throw new ArgumentNullException("Connection", "No database connection set."); } this.m_bWasOpen = this.m_cmd.Connection.State == ConnectionState.Open; try { if (!this.m_bWasOpen) { this.m_cmd.Connection.Open(); } this.m_reader = this.m_cmd.ExecuteReader(CommandBehavior.SequentialAccess); this.m_map = new Resco.Controls.AdvancedList.Mapping(this.m_reader); } finally { if (((this.m_reader == null) && !this.m_bWasOpen) && (this.m_cmd.Connection.State == ConnectionState.Open)) { this.m_cmd.Connection.Close(); } } return(this.IsOpen); }
public Row(int templateIndex, int selectedTemplateIndex, ICollection dataList, Resco.Controls.AdvancedList.Mapping fieldNames) : this(templateIndex, selectedTemplateIndex, -1, -1) { int num = Math.Max(fieldNames.FieldCount, dataList.Count); this.m_htMap = fieldNames; this.m_oData = new object[num]; dataList.CopyTo(this.m_oData, 0); }
public Row(int templateIndex, int selectedTemplateIndex, int activeTempalteIndex, int alternateTempalteIndex, ICollection dataList, Resco.Controls.AdvancedList.Mapping fieldNames) : this(templateIndex, selectedTemplateIndex, activeTempalteIndex, alternateTempalteIndex) { int num = Math.Max(fieldNames.FieldCount, dataList.Count); this.m_htMap = fieldNames; this.m_oData = new object[num]; dataList.CopyTo(this.m_oData, 0); }
protected Row(int templateIndex, int selectedTemplateIndex, int activeTempalteIndex, int alternateTemplateIndex) { this.ActualHeight = -1; this.m_recalculationNeeded = true; this.m_index = -1; this.m_pressedButtonIndex = -1; this.m_iTemplate = templateIndex; this.m_iSelectedTemplate = selectedTemplateIndex; this.m_iActiveTemplate = activeTempalteIndex; this.m_iAlternateTemplate = alternateTemplateIndex; this.m_htMap = null; this.m_oData = null; this.m_rowSpecificCellProperties = new Hashtable(); }
public int RemoveByMapping(Resco.Controls.AdvancedList.Mapping fieldNames) { int num = -1; for (int i = base.List.Count - 1; i >= 0; i--) { Row row = (Row)base.InnerList[i]; if (row.FieldNames == fieldNames) { base.List.RemoveAt(i); num = i; } } return(num); }
public void Close() { try { if (this.m_reader != null) { this.m_reader.Close(); if (!this.m_bWasOpen && (this.m_cmd.Connection.State == ConnectionState.Open)) { this.m_cmd.Connection.Close(); } } } finally { this.m_reader = null; this.m_map = null; this.m_data = null; } }
public Row(int templateIndex, int selectedTemplateIndex, int fieldCount) : this(templateIndex, selectedTemplateIndex, -1, -1) { this.m_oData = new object[fieldCount]; this.m_htMap = Resco.Controls.AdvancedList.Mapping.Empty; }
public Row(int templateIndex, int selectedTemplateIndex, Resco.Controls.AdvancedList.Mapping fieldNames) : this(templateIndex, selectedTemplateIndex, -1, -1) { this.m_htMap = fieldNames; this.m_oData = new object[fieldNames.FieldCount]; }
private bool DoDelayLoad() { bool flag = true; if (this.m_connector.IsOpen) { Cursor.Current = Cursors.WaitCursor; this.BeginUpdate(); try { if (this.LoadDataChunk(true)) { this.CloseConnector(); flag = false; } } catch { this.CloseConnector(); flag = false; } this.EndUpdate(); Cursor.Current = Cursors.Default; this.OnDataLoaded(new DataLoadedEventArgs(!flag)); } else { Rectangle rectangle = this.CalculateClientRect(); if ((!this.m_bManualDataLoading && (((this.m_enumerator == null) || !(this.m_dataSource is IEnumerable)) || !this.m_enumeratorNeedLoad)) && (((this.m_dataSource == null) || (this.m_listManager == null)) || (this.m_nRowsLoaded >= this.m_listManager.List.Count))) { flag = false; } else { int height; Cursor.Current = Cursors.WaitCursor; this.BeginUpdate(); if (this.m_bManualDataLoading) { for (height = rectangle.Height; height > 0; height -= this.m_rcRows[this.m_rcRows.Count - 1].GetHeight(this.Templates)) { this.m_bManualDataLoading = !this.AddRowManually(); if (!this.m_bManualDataLoading) { flag = false; break; } } } else if (this.m_enumerator != null) { height = rectangle.Height; while (flag = this.m_enumeratorNeedLoad = this.m_enumerator.MoveNext()) { if (this.m_boundMap == Resco.Controls.AdvancedList.Mapping.Empty) { this.m_boundMap = new PropertyMapping(this.m_enumerator.Current.GetType()); } Row row = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_enumerator.Current, this.m_boundMap as PropertyMapping); row.AlternateTemplateIndex = this.AlternateTemplateIndex; row.ActiveTemplateIndex = this.ActiveTemplateIndex; this.m_nRowsInserted = this.m_rcRows.Count; int num2 = this.InsertRow(row, this.m_nRowsInserted); this.m_nRowsLoaded++; if (num2 != this.m_nRowsInserted) { height -= this.m_rcRows[this.m_nRowsInserted].GetHeight(this.Templates); if (height < 0) { break; } } } } else { height = rectangle.Height; while (this.m_nRowsLoaded < this.m_listManager.List.Count) { Row row2 = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_listManager.List[this.m_nRowsLoaded], this.m_boundMap as PropertyMapping); row2.AlternateTemplateIndex = this.AlternateTemplateIndex; row2.ActiveTemplateIndex = this.ActiveTemplateIndex; this.m_nRowsInserted = this.m_rcRows.Count; if (this.InsertRow(row2, this.m_nRowsInserted) != this.m_nRowsInserted) { height -= this.m_rcRows[this.m_nRowsInserted].GetHeight(this.Templates); if (height < 0) { this.m_nRowsLoaded++; break; } } this.m_nRowsLoaded++; } if (this.m_listManager.List.Count == this.m_nRowsLoaded) { flag = false; } } if (this.m_nRowsLoaded >= this.m_iExpectedRows) { this.m_iExpectedRows = -1; } this.EndUpdate(); Cursor.Current = Cursors.Default; this.OnDataLoaded(new DataLoadedEventArgs(!flag)); } } if (!flag) { this.ExpectedRows = -1; } return flag; }
internal static void DisposeEmptyMapping() { s_Empty = null; }
public Row(Resco.Controls.AdvancedList.Mapping fieldNames) : this(0, 0, fieldNames) { }
private void ReloadDataSource() { if (this.m_boundMap != Resco.Controls.AdvancedList.Mapping.Empty) { this.DataRows.RemoveByMapping(this.m_boundMap); } if (this.m_listManager != null) { this.m_boundMap = new PropertyMapping(this.m_listManager.GetItemProperties()); if (!this.m_bDelayLoad) { int insertIndex = 0; for (int i = 0; i < this.m_listManager.List.Count; i++) { Row row = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_listManager.List[i], this.m_boundMap as PropertyMapping); row.AlternateTemplateIndex = this.AlternateTemplateIndex; row.ActiveTemplateIndex = this.ActiveTemplateIndex; int num3 = this.InsertRow(row, insertIndex); if (num3 != insertIndex) { insertIndex = num3; } } } else { this.m_nRowsLoaded = 0; this.DoDelayLoad(); } } else if (this.m_enumerator != null) { this.m_boundMap = Resco.Controls.AdvancedList.Mapping.Empty; if (!this.m_bDelayLoad) { int num4 = 0; while (this.m_enumerator.MoveNext()) { if (this.m_boundMap == Resco.Controls.AdvancedList.Mapping.Empty) { this.m_boundMap = new PropertyMapping(this.m_enumerator.Current.GetType()); } Row row2 = new BoundRow(this.TemplateIndex, this.SelectedTemplateIndex, this.m_enumerator.Current, this.m_boundMap as PropertyMapping); row2.AlternateTemplateIndex = this.AlternateTemplateIndex; row2.ActiveTemplateIndex = this.ActiveTemplateIndex; int num5 = this.InsertRow(row2, num4); if (num5 != num4) { num4 = num5; } } this.m_enumeratorNeedLoad = false; } else { this.m_nRowsLoaded = 0; this.DoDelayLoad(); } } else { this.m_boundMap = Resco.Controls.AdvancedList.Mapping.Empty; } }
public BoundRow(int templateIndex, int selectedTemplateIndex, System.Data.DataRow row, Resco.Controls.AdvancedList.Mapping fieldNames) : base(templateIndex, selectedTemplateIndex, fieldNames) { this.m_data = row; this.m_properties = ((ITypedList)row.Table.DefaultView).GetItemProperties(null); }
public Resco.Controls.AdvancedList.Mapping LoadData(int iInsertIndex) { if (this.m_connector == null) { return null; } try { this.CloseConnector(); if (!this.m_connector.Open()) { return null; } this.m_mapLast = this.m_connector.Mapping; this.BeginUpdate(); this.m_iInsertIndex = iInsertIndex; if (this.LoadDataChunk(this.m_bDelayLoad && (iInsertIndex <= this.m_rcRows.Count))) { this.CloseConnector(); } else if (this.LoadDataChunk(this.m_bDelayLoad && (iInsertIndex <= this.m_rcRows.Count))) { this.CloseConnector(); } } catch (Exception exception) { this.CloseConnector(); throw exception; } finally { this.EndUpdate(); } return this.m_mapLast; }