本文整理汇总了C#中DevInfo.Lib.DI_LibDAL.Connection.DIConnection.ExecuteReader方法的典型用法代码示例。如果您正苦于以下问题:C# DIConnection.ExecuteReader方法的具体用法?C# DIConnection.ExecuteReader怎么用?C# DIConnection.ExecuteReader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevInfo.Lib.DI_LibDAL.Connection.DIConnection
的用法示例。
在下文中一共展示了DIConnection.ExecuteReader方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateNIdsFromGIds
/// <summary>
/// Update / Save NIds on the basis of GIds
/// </summary>
/// <param name="DIConnection"></param>
/// <param name="DIQueries"></param>
public void UpdateNIdsFromGIds(DIConnection DIConnection, DIQueries DIQueries)
{
IDataReader IDataReader;
StringBuilder IDValues = new StringBuilder();
string sSql = string.Empty;
string[] ColumnField = new string[0];
StringBuilder Values = new StringBuilder();
#region Indicator
if (this._IndicatorGIds.Length > 0)
{
string[] IndicatorValues = DIQueries.GetSplittedValues(this._IndicatorGIds, Delimiter.TEXT_DELIMITER);
StringBuilder IndicatorText = new StringBuilder();
for (int i = 0; i < IndicatorValues.Length; i++)
{
if (i > 0)
{
IndicatorText.Append(Delimiter.NUMERIC_DELIMITER);
}
IndicatorText.Append("'" + IndicatorValues[i] + "'");
}
if (this._ShowIUS)
{
sSql = DIQueries.IUS.GetIUSNIds(IndicatorText.ToString(), DIConnection.ConnectionStringParameters.ServerType);
}
else
{
sSql = DIQueries.Indicators.GetIndicator(FilterFieldType.GId, IndicatorText.ToString(), FieldSelection.NId);
}
IDataReader = DIConnection.ExecuteReader(sSql);
while (IDataReader.Read())
{
if (IDValues.Length > 0)
{
IDValues.Append(Delimiter.NUMERIC_DELIMITER);
}
if (this._ShowIUS == true)
{
IDValues.Append(IDataReader[Indicator_Unit_Subgroup.IUSNId]);
}
else
{
IDValues.Append(IDataReader[Indicator.IndicatorNId]);
}
}
IDataReader.Close();
this._IndicatorNIds = IDValues.ToString();
}
else
{
//-- Clear the NId, if GId is blank
this._IndicatorNIds = string.Empty;
}
#endregion
#region Unit
if (this._UnitGIds.Length > 0)
{
sSql = DIQueries.Unit.GetUnit(FilterFieldType.GId, this._UnitGIds);
IDataReader = DIConnection.ExecuteReader(sSql);
IDValues.Length = 0;
while (IDataReader.Read())
{
if (IDValues.Length > 0)
{
IDValues.Append(Delimiter.NUMERIC_DELIMITER);
}
IDValues.Append(IDataReader[Unit.UnitNId]);
}
IDataReader.Close();
this._UnitNIds = IDValues.ToString();
}
else
{
//-- Clear the NId, if GId is blank
this._UnitNIds = string.Empty;
}
#endregion
#region SubgroupVal
if (this._SubgroupValGIds.Length > 0)
{
sSql = DIQueries.Subgroup.GetSubgroupVals(FilterFieldType.GId, this._SubgroupValGIds);
IDataReader = DIConnection.ExecuteReader(sSql);
IDValues.Length = 0;
//.........这里部分代码省略.........
示例2: AutoSelectedTimePeriods
private string[] AutoSelectedTimePeriods(DIConnection dbConnection, DIQueries dbQueries, UserSelection dbUserSelection)
{
string[] Retval = new string[0];
try
{
string TimePeriods = string.Empty;
IDataReader TimePeriodReader;
if (string.IsNullOrEmpty(this._FromTimePeriod))
{
TimePeriodReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectTimeperiod(dbUserSelection.IndicatorNIds, dbUserSelection.ShowIUS, dbUserSelection.AreaNIds, dbUserSelection.SourceNIds));
}
else
{
if (this._IsToMRD)
{
TimePeriodReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectedTimePeriodsRange(this._FromTimePeriod, string.Empty, dbUserSelection));
}
else
{
TimePeriodReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectedTimePeriodsRange(this._FromTimePeriod, this._ToTimePeriod, dbUserSelection));
}
}
while (TimePeriodReader.Read())
{
TimePeriods += "," + TimePeriodReader[Timeperiods.TimePeriod].ToString();
}
TimePeriodReader.Close();
if (!string.IsNullOrEmpty(TimePeriods))
{
TimePeriods = TimePeriods.Substring(1);
}
Retval = DICommon.SplitString(TimePeriods, ",");
}
catch (Exception)
{
}
return Retval;
}
示例3: UpdateGIdsFromNIds
/// <summary>
/// Update / Save GIds on the basis of NIds
/// </summary>
/// <param name="DIConnection"></param>
/// <param name="DIQueries"></param>
public void UpdateGIdsFromNIds(DIConnection DIConnection, DIQueries DIQueries)
{
IDataReader IDataReader;
string IdValue = string.Empty;
string sSql = string.Empty;
#region Indicator GId
if (this._IndicatorNIds.Length > 0)
{
if (this._ShowIUS == true)
{
sSql = DIQueries.IUS.GetIUSGIds(this._IndicatorNIds, DIConnection.ConnectionStringParameters.ServerType);
}
else
{
sSql = DIQueries.Indicators.GetIndicator(FilterFieldType.NId, this._IndicatorNIds, FieldSelection.Light);
}
IDataReader = DIConnection.ExecuteReader(sSql);
while (IDataReader.Read())
{
if (IdValue.Length > 0)
{
IdValue += Delimiter.TEXT_DELIMITER;
}
if (this._ShowIUS == true)
{
IdValue += IDataReader[0].ToString(); // Expression column with concatinated I_U_S Gids
}
else
{
IdValue += IDataReader[Indicator.IndicatorGId].ToString();
}
}
IDataReader.Close();
this._IndicatorGIds = IdValue;
}
else
{
//-- Clear the GID, if NID is blank
this._IndicatorGIds = string.Empty;
}
#endregion
#region Unit GId
if (this._UnitNIds.Length > 0)
{
sSql = DIQueries.Unit.GetUnit(FilterFieldType.NId, this._UnitNIds);
IDataReader = DIConnection.ExecuteReader(sSql);
IdValue = string.Empty;
while (IDataReader.Read())
{
if (IdValue.Length > 0)
{
IdValue += Delimiter.NUMERIC_DELIMITER;
}
IdValue += IDataReader[Unit.UnitGId].ToString();
}
IDataReader.Close();
this._UnitGIds = IdValue;
}
else
{
//-- Clear the GID, if NID is blank
this._UnitGIds = string.Empty;
}
#endregion
#region SubgroupVal GId
if (this._SubgroupValNIds.Length > 0)
{
sSql = DIQueries.Subgroup.GetSubgroupVals(FilterFieldType.NId, this._SubgroupValNIds);
IDataReader = DIConnection.ExecuteReader(sSql);
IdValue = string.Empty;
while (IDataReader.Read())
{
if (IdValue.Length > 0)
{
IdValue += Delimiter.NUMERIC_DELIMITER;
}
IdValue += IDataReader[SubgroupVals.SubgroupValGId].ToString();
}
IDataReader.Close();
this._SubgroupValGIds = IdValue;
}
else
{
//.........这里部分代码省略.........
示例4: UpdateTimePeriods
public string UpdateTimePeriods(DIConnection dbConnection, DIQueries dbQueries, UserSelection dbUserSelection)
{
string RetVal = string.Empty;
try
{
IDataReader TimeReader = null;
//'-- Set the MRD filter to true
if (this._IsToMRD | this._MRD)
{
dbUserSelection.DataViewFilters.MostRecentData = true;
}
else
{
dbUserSelection.DataViewFilters.MostRecentData = false;
}
if (this._IsToMRD || !string.IsNullOrEmpty(this._ToTimePeriod) || string.IsNullOrEmpty(dbUserSelection.TimePeriodNIds.Trim()))
{
if (this._IsToMRD)
{
//'-- Get all the time period greater then TO time period
TimeReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectedTimePeriodsRange(this._FromTimePeriod, "", dbUserSelection));
}
else if (!string.IsNullOrEmpty(this._ToTimePeriod))
{
//'-- Get auto selected time period between from and two
TimeReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectedTimePeriodsRange(this._FromTimePeriod, this._ToTimePeriod, dbUserSelection));
}
else if (string.IsNullOrEmpty(dbUserSelection.TimePeriodNIds.Trim()))
{
//-- Get auto selected time periods
TimeReader = dbConnection.ExecuteReader(dbQueries.Timeperiod.GetAutoSelectByIndicatorAreaSource(string.Empty, dbUserSelection.AreaNIds, dbUserSelection.SourceNIds, dbUserSelection.IndicatorNIds));
}
while (TimeReader.Read())
{
RetVal += "," + TimeReader[Timeperiods.TimePeriodNId];
}
if (!string.IsNullOrEmpty(RetVal))
{
RetVal = RetVal.Substring(1);
}
else
{
RetVal = "-1";
}
TimeReader.Close();
}
//-- Exclude the TimePeriod from the selections.
//this.ExcludeTimePeriodsFromUserSelection(dbConnection, dbQueries, dbUserSelection);
}
catch (Exception)
{
}
return RetVal;
}
示例5: GetParentLevel
/// <summary>
/// Get the parent levels of selected level
/// </summary>
/// <param name="levels"></param>
/// <param name="dbConnection"></param>
/// <param name="dbQueries"></param>
/// <returns></returns>
private string GetParentLevel(string levels,DIConnection dbConnection, DIQueries dbQueries)
{
string RetVal = string.Empty;
try
{
int MaxLevel = -1;
IDataReader LevelReader;
string[] Levels = new string[0];
Levels = DICommon.SplitString(levels, ",");
//-- Get the maximum level from the selected level.
MaxLevel = Convert.ToInt32(Levels[0]);
foreach (string SecondaryLevel in Levels)
{
if (Convert.ToInt32(MaxLevel) < Convert.ToInt32(SecondaryLevel))
{
MaxLevel = Convert.ToInt32(SecondaryLevel);
}
}
RetVal=MaxLevel.ToString();
//-- Get the parent levels.
LevelReader = dbConnection.ExecuteReader(dbQueries.Area.GetAreaLevel());
while (LevelReader.Read())
{
if (MaxLevel > Convert.ToInt32(LevelReader[Area_Level.AreaLevel]))
{
RetVal += "," + LevelReader[Area_Level.AreaLevel].ToString();
}
}
LevelReader.Close();
}
catch (Exception)
{
}
return RetVal;
}
示例6: GetAreaLevel
/// <summary>
/// Get all the area levels
/// </summary>
/// <returns></returns>
/// <remarks></remarks>
private List<Int32> GetAreaLevel(DIConnection dbConnection, DIQueries dbQueries)
{
List<Int32> Retval = new List<Int32>();
IDataReader LevelReader = null;
try
{
LevelReader = dbConnection.ExecuteReader(dbQueries.Area.GetAreaLevel(Lib.DI_LibDAL.Queries.FilterFieldType.None, ""));
while (LevelReader.Read())
{
Retval.Add(Convert.ToInt32(LevelReader[Area_Level.AreaLevel]));
}
}
catch (Exception ex)
{
}
finally
{
LevelReader.Close();
}
return Retval;
}
示例7: GetSubNationals
/// <summary>
/// Get all the AreaNIds of the selected level and update the user selection.
/// </summary>
/// <param name="selectedAreaNIds"></param>
/// <param name="levels"></param>
/// <remarks></remarks>
public void GetSubNationals(DIConnection dbConnection, DIQueries dbQueries, UserSelection dbUserSelection, string selectedAreaNIds, string levels)
{
try
{
if (!string.IsNullOrEmpty(this._SecondryAreaLevels))
{
StringBuilder sbArea = new StringBuilder();
string[] SelectedLevel = new string[0];
string sLevels = string.Empty;
DataTable Areadt = new DataTable();
DataRow[] Rows = null;
string SelectedAreaNId = string.Empty;
Areas = new Dictionary<int, string>();
foreach (Int32 Level in GetAreaLevel(dbConnection, dbQueries))
{
IDataReader AreaReader;
//'-- Get Area NIDs of the levles
AreaReader = dbConnection.ExecuteReader(dbQueries.Area.GetAreaNIdByAreaLevel(dbUserSelection.AreaNIds, Level));
while (AreaReader.Read())
{
sbArea.Append("," + AreaReader[Area.AreaNId].ToString());
}
//'-- Add the selected AreaNIDs according to their level
if (sbArea.Length > 0)
{
Areas.Add(Level, sbArea.ToString().Substring(1));
}
AreaReader.Close();
sbArea.Length = 0;
}
//'-- Get the Levels.
sLevels = this.GetParentLevel(this._SecondryAreaLevels, dbConnection, dbQueries);
this._AreaLevels = sLevels;
SelectedLevel = DICommon.SplitString(sLevels, ",");
//'-- Insert all the required level to build the comma seprated AreaNIds of selected levels
for (int Index = GetMaxKey(Areas); Index <= GetMinSelectedLevel(SelectedLevel) - 1; Index++)
{
Array.Resize(ref SelectedLevel, SelectedLevel.Length + 1);
SelectedLevel[SelectedLevel.Length - 1] = Index.ToString();
}
//'-- Sort on the all the required levels
SelectedLevel = Sort(SelectedLevel);
//'-- Comma seprated required levels.
sLevels = string.Empty;
foreach (string NewLevel in SelectedLevel)
{
sLevels += "," + NewLevel;
}
if (!string.IsNullOrEmpty(sLevels))
{
sLevels = sLevels.Substring(1);
}
if (!string.IsNullOrEmpty(this._SecondryAreaLevels))
{
//'-- Get all the areas of the required levels
Areadt = dbConnection.ExecuteDataTable(dbQueries.Area.GetAreasByAreaLevels(sLevels));
foreach (string sLevel in SelectedLevel)
{
sbArea.Length = 0;
if (string.IsNullOrEmpty(GetSelectedAreaNId(Areas, Convert.ToInt32(sLevel))))
{
//'-- Get the saved AreaNIds
if (Convert.ToInt32(sLevel) > 1)
{
SelectedAreaNId = GetSelectedAreaNId(Areas, Convert.ToInt32(sLevel) - 1);
}
//'-- Get the AreaNIds on the basis of selected areas and level
if (!string.IsNullOrEmpty(SelectedAreaNId))
{
Rows = Areadt.Select(Area.AreaLevel + " = " + Convert.ToInt32(sLevel) + " AND " + Area.AreaParentNId + " IN (" + SelectedAreaNId + ")");
}
else
{
Rows = Areadt.Select(Area.AreaLevel + " = " + Convert.ToInt32(sLevel));
}
//'-- Add the AreaNIds in the collection.
foreach (DataRow Row in Rows)
{
sbArea.Append("," + Row[Area.AreaNId].ToString());
}
if (sbArea.Length > 0)
{
Areas.Add(Convert.ToInt32(sLevel), sbArea.ToString().Substring(1));
//.........这里部分代码省略.........
示例8: GetTransformedDeletedSourceNIDs
/// <summary>
/// Transforms deleted source nids from IUS_SourceNIDs format into SourceNIDs format and vice a versa
/// Also updates selected field value in Source / IUSSource table
/// After transformation, calling routine should explicitly toggle the status of ShowSourceByIUS property
/// </summary>
/// <param name="userSelection">UserSelection</param>
/// <returns>transformed deleted source nids</returns>
public static string GetTransformedDeletedSourceNIDs(UserSelection userSelection, DataTable dtIUSSource, DIConnection dbConnection, DIQueries dbQueries)
{
// -- moDIDataView.IUSSource - Available IUS _ Source
string sNewDelSourceNIDs = string.Empty;
DataRow[] Rows = new DataRow[0];
string DelSourceNIDs = string.Empty;
System.Text.StringBuilder sbNewDelSourceNIDs = new System.Text.StringBuilder();
string retVal = string.Empty;
string[] DistinctColumns = new string[1];
string[] IUSDistinctColumns = new string[2];
if (userSelection.DataViewFilters.ShowSourceByIUS || string.IsNullOrEmpty(userSelection.DataViewFilters.DeletedSourceNIds))
{
// -- Do Nothing
retVal = sNewDelSourceNIDs;
}
else
{
try
{
IDataReader IUSReader;
IUSReader = dbConnection.ExecuteReader(dbQueries.Data.GetDataViewDataByDataNIDs(userSelection.DataViewFilters.DeletedSourceNIds));
while (IUSReader.Read())
{
sNewDelSourceNIDs = "'" + IUSReader[Data.IUSNId].ToString() + "_" + IUSReader[IndicatorClassifications.ICNId].ToString() + "'";
retVal += "," + sNewDelSourceNIDs;
Rows = dtIUSSource.Select(Indicator_Unit_Subgroup.IUSNId + " + '_' + " + IndicatorClassifications.ICNId + " IN (" + sNewDelSourceNIDs + ")");
foreach (DataRow Row in Rows)
{
Row[DataExpressionColumns.Selected] = false;
}
}
IUSReader.Close();
if (!string.IsNullOrEmpty(retVal))
{
retVal = retVal.Substring(1);
}
}
catch (Exception)
{
}
}
return retVal;
}