private void UpdateTradeSummaryGrid() { string tableName = "SummaryData"; DevExpress.XtraGrid.Views.Base.BaseView activeView = null; DevExpress.XtraGrid.GridControl activeGrid = null; try { foreach (DevExpress.XtraGrid.GridControl grid in managedGridList) { DevExpress.XtraGrid.GridControlViewCollection views = grid.Views; activeGrid = grid; foreach (DevExpress.XtraGrid.Views.Base.BaseView view in views) { DataView dv = (DataView)view.DataSource; if (dv.Table.TableName == tableName) { // view.BeginDataUpdate(); activeView = view; foreach (SummaryData sumData in sumDataCache) { DataRow rowFound = dv.Table.Rows.Find(sumData.Id); if (rowFound != null) { string qryCode = (string)rowFound["QryCode"]; CollectionHelper.UpdateDataRowFromObject <SummaryData>(sumData, ref rowFound); if (!((qryCode == null) || (qryCode == ""))) { rowFound["QryCode"] = qryCode; // so as to not overwrite any "Get All" results. } } else { DataRow newRow = dv.Table.NewRow(); newRow = CollectionHelper.CreateDataRowFromObject <SummaryData>(sumData, newRow); dv.Table.Rows.Add(newRow); } } } } } } catch (Exception ex) { throw new Exception("An error occurred while updating the Trade Summary grid." + Environment.NewLine + "Error CNF-356 in " + PROJ_FILE_NAME + ".UpdateTradeRqmtGrid(): " + ex.Message); } finally { if (activeView != null) { // activeGrid.Invoke(new EndDataGridUpdate(EndDataUpdate), activeView); sumDataCache.Clear(); } } }
private void UpdateTradeRqmtGrid() { string tableName = "RqmtData"; DevExpress.XtraGrid.Views.Base.BaseView activeView = null; DevExpress.XtraGrid.GridControl activeGrid = null; try { foreach (DevExpress.XtraGrid.GridControl grid in managedGridList) { DevExpress.XtraGrid.GridControlViewCollection views = grid.Views; activeGrid = grid; foreach (DevExpress.XtraGrid.Views.Base.BaseView view in views) { DataView dv = (DataView)view.DataSource; if (dv.Table.TableName == tableName) { // view.BeginDataUpdate(); activeView = view; foreach (RqmtData rqmtData in rqmtDataCache) { DataRow rowFound = dv.Table.Rows.Find(rqmtData.Id); if (rowFound != null) { CollectionHelper.UpdateDataRowFromObject <RqmtData>(rqmtData, ref rowFound); } else { DataRow newRow = dv.Table.NewRow(); newRow = CollectionHelper.CreateDataRowFromObject <RqmtData>(rqmtData, newRow); dv.Table.Rows.Add(newRow); } } } } } } catch (Exception ex) { throw new Exception("An error occurred while updating the Trade Rqmts grid." + Environment.NewLine + "Error CNF-355 in " + PROJ_FILE_NAME + ".UpdateTradeRqmtGrid(): " + ex.Message); } finally { if (activeView != null) { // activeGrid.Invoke(new EndDataGridUpdate(EndDataUpdate), activeView); rqmtDataCache.Clear(); } } }
private void UpdateInboundDocGrid() { string tableName = "InboundDocsView"; DevExpress.XtraGrid.Views.Base.BaseView activeView = null; DevExpress.XtraGrid.GridControl activeGrid = null; try { foreach (DevExpress.XtraGrid.GridControl grid in managedGridList) { DevExpress.XtraGrid.GridControlViewCollection views = grid.Views; activeGrid = grid; foreach (DevExpress.XtraGrid.Views.Base.BaseView view in views) { DataView dv = (DataView)view.DataSource; if (dv.Table.TableName == tableName) { // view.BeginDataUpdate(); activeView = view; foreach (InboundDocsView data in inbDocViewCache) { DataRow rowFound = dv.Table.Rows.Find(data.Id); if (rowFound != null) { // because inbound_doc_user_flag data is not include, we must copy this data to // the "data" object that is being used to update the data row found. if (rowFound["IgnoreFlag"] != System.DBNull.Value) { data.IgnoreFlag = rowFound["IgnoreFlag"].ToString(); } if (rowFound["BookmarkFlag"] != System.DBNull.Value) { data.BookmarkFlag = rowFound["BookmarkFlag"].ToString(); } if (rowFound["CommentFlag"] != System.DBNull.Value) { data.CommentFlag = rowFound["CommentFlag"].ToString(); } if (rowFound["CommentUser"] != System.DBNull.Value) { data.CommentUser = rowFound["CommentUser"].ToString(); } CollectionHelper.UpdateDataRowFromObject <InboundDocsView>(data, ref rowFound); } else { DataRow newRow = dv.Table.NewRow(); newRow = CollectionHelper.CreateDataRowFromObject <InboundDocsView>(data, newRow); dv.Table.Rows.Add(newRow); } } } } } } catch (Exception ex) { throw new Exception("An error occurred while updating the Inbound Documents grid." + Environment.NewLine + "Error CNF-353 in " + PROJ_FILE_NAME + ".UpdateInboundDocGrid(): " + ex.Message); } finally { if (activeView != null) { // activeGrid.Invoke(new EndDataGridUpdate(EndDataUpdate), activeView); inbDocViewCache.Clear(); } } }