/// <summary> /// Функция считывания с БД /// </summary> /// <param name="listAttributeRef"> Список </param> /// <param name="listSqlRefTable"></param> private void GetCollectionOfVariandsForBD(List <PgAtM.PgAttributeM> listAttributeRef, List <string> listSqlRefTable) { List <IParams> ParamsArray = new List <IParams>(); for (int i = 0; i < listAttributeRef.Count; i++) { var item = listAttributeRef[i]; ParamsArray.Add(new Params(":value" + item.Field.Id, PgAtM.PgAttributeM.GetValue(item), (item.Field as PgM.PgFieldM).DbType)); } if (listSqlRefTable.Count > 0) { using (var sqlCmd = new SqlWork(_connect, _isDebug)) { sqlCmd.sql = string.Join(";\n", listSqlRefTable.ToArray()); sqlCmd.ExecuteMultipleReader(ParamsArray); int i = 0; do { var item = listAttributeRef[i++]; item.Variants.Clear(); while (sqlCmd.CanRead()) { var id = sqlCmd.GetValue <object>((item.Field as PgM.PgFieldM).RefTable.PrimaryKeyField.Name); var fieldName = sqlCmd.GetValue <string>((item.Field as PgM.PgFieldM).RefFieldName.Name); var idValue = sqlCmd.GetValue <object>((item.Field as PgM.PgFieldM).RefField.Name); PgM.PgStyleObjectM style = null; if ((item.Field as PgM.PgFieldM).RefTable.IsMapStyle && LoadStyle) { style = new PgM.PgStyleObjectM((item.Field as PgM.PgFieldM).RefTable, id); style.SetFont( name: sqlCmd.GetString("!fontname"), color: sqlCmd.GetValue <int>("!fontcolor"), frameColor: sqlCmd.GetValue <int>("!fontframecolor"), size: sqlCmd.GetInt32("!fontsize")); style.SetSymbol( shape: sqlCmd.GetValue <int>("!symbol")); style.SetPen( color: sqlCmd.GetValue <int>("!pencolor"), type: sqlCmd.GetValue <int>("!pentype"), width: sqlCmd.GetValue <int>("!penwidth")); style.SetBrush( bgColor: sqlCmd.GetValue <int>("!brushbgcolor"), fgColor: sqlCmd.GetValue <int>("!brushfgcolor"), style: sqlCmd.GetValue <int>("!brushstyle"), hatch: sqlCmd.GetValue <int>("!brushhatch")); } if ((item.Field as PgM.PgFieldM).RefType == AbsM.ERefType.Reference) { item.Variants.Add(new PgAtM.PgAttributeReferenceM(item, fieldName, style, idValue)); } else if ((item.Field as PgM.PgFieldM).RefType == AbsM.ERefType.Interval) { var intervalMin = ExtraFunctions.Converts.To <double>(idValue); var intervalMax = sqlCmd.GetValue <double>((item.Field as PgM.PgFieldM).RefFieldEnd.Name); item.Variants.Add(new PgAtM.PgAttributeIntervalM(item, fieldName, style, id, intervalMin, intervalMax)); } else if ((item.Field as PgM.PgFieldM).RefType == AbsM.ERefType.Data) { item.Variants.Add(new PgAtM.PgAttributeReferenceM(item, fieldName, style, idValue)); } } } while (sqlCmd.CanNextResult()); } } }