コード例 #1
0
ファイル: ReportElement.cs プロジェクト: whx76/Seal-Report
        /// <summary>
        /// Get the sort value for an enumerated list
        /// </summary>
        public string GetEnumSortValue(string enumValue, bool useDisplayValue)
        {
            string   result = enumValue;
            MetaEnum en     = EnumEL;

            bool   elementSortPosition = (IsSorted && en.UsePosition);
            MetaEV value = null;

            if (useDisplayValue)
            {
                value = en.Values.FirstOrDefault(i => i.DisplayValue == enumValue);
            }
            else
            {
                value = en.Values.FirstOrDefault(i => i.Id == enumValue);
            }

            if (value != null)
            {
                string sortPrefix = elementSortPosition ? string.Format("{0:000000}", en.Values.LastIndexOf(value)) : "";
                result = sortPrefix + Report.EnumDisplayValue(en, value.Id);
            }
            else
            {
                string sortPrefix = elementSortPosition ? "000000" : "";
                result = sortPrefix + result;
            }
            return(result);
        }
コード例 #2
0
ファイル: MetaSource.cs プロジェクト: radtek/Seal-Report
        /// <summary>
        /// Helper to create a MetaEnum for a given MetaColumn
        /// </summary>
        public MetaEnum CreateEnumFromColumn(MetaColumn column)
        {
            MetaEnum result = AddEnum();

            result.IsEditable = true;
            result.Name       = column.DisplayName;
            if (!IsNoSQL)
            {
                result.IsDynamic = true;
                result.Sql       = string.Format("SELECT DISTINCT \r\n{0} \r\nFROM {1} \r\nORDER BY 1", column.Name, column.MetaTable.FullSQLName);
                result.RefreshEnum();
            }
            else
            {
                result.IsDynamic = false;
                column.MetaTable.BuildNoSQLTable(true);
                foreach (DataRow row in column.MetaTable.NoSQLTable.Rows)
                {
                    result.Values.Add(new MetaEV()
                    {
                        Id = row[column.Name].ToString()
                    });
                }
            }
            return(result);
        }
コード例 #3
0
ファイル: MetaSource.cs プロジェクト: radtek/Seal-Report
        /// <summary>
        /// Add a MetaEnum to the MetaData
        /// </summary>
        public MetaEnum AddEnum()
        {
            MetaEnum result = MetaEnum.Create();

            result.Name = "Enum";
            result.Name = Helper.GetUniqueName(result.Name, (from i in MetaData.Enums select i.Name).ToList());
            MetaData.Enums.Add(result);
            result.Source = this;
            return(result);
        }
コード例 #4
0
ファイル: MetaSource.cs プロジェクト: radtek/Seal-Report
 /// <summary>
 /// Remove a MetaEnum from the MetaData
 /// </summary>
 public void RemoveEnum(MetaEnum item)
 {
     //Clean up enum references from columns
     foreach (MetaTable table in MetaData.Tables)
     {
         foreach (MetaColumn column in table.Columns.Where(i => i.EnumGUID == item.GUID))
         {
             column.EnumGUID = "";
         }
     }
     MetaData.Enums.Remove(item);
 }
コード例 #5
0
ファイル: HelperEditor.cs プロジェクト: cnark/Seal-Report
 void setContext(ITypeDescriptorContext context)
 {
     _metaConnection = context.Instance as MetaConnection;
     _metaEnum = context.Instance as MetaEnum;
     _metaTable = context.Instance as MetaTable;
     _metaColumn = context.Instance as MetaColumn;
     _metaJoin = context.Instance as MetaJoin;
     _reportView = context.Instance as ReportView;
     _reportOutput = context.Instance as ReportOutput;
     _reportSchedule = context.Instance as ReportSchedule;
     _parameter = context.Instance as Parameter;
     _security = context.Instance as SealSecurity;
     _emailDevice = context.Instance as OutputEmailDevice;
 }
コード例 #6
0
ファイル: MetaSource.cs プロジェクト: orchis0312/Seal-Report
        /// <summary>
        /// Helper to create a MetaEnum for a given MetaColumn
        /// </summary>
        public MetaEnum CreateEnumFromColumn(MetaColumn column)
        {
            MetaEnum result = AddEnum();

            result.IsEditable = true;
            result.Name       = column.DisplayName;
            result.IsDynamic  = true;
            if (!IsNoSQL)
            {
                result.Sql = string.Format("SELECT DISTINCT \r\n{0} \r\nFROM {1} \r\nORDER BY 1", column.Name, column.MetaTable.FullSQLName);
            }
            else
            {
                result.Script = @"@using System.Data
@{
    MetaEnum enumList = Model;
    MetaSource source = enumList.Source;
    MetaTable table = source.MetaData.Tables.FirstOrDefault(i => i.Name == TableName);
    if (table != null)
    {
        DataTable dataTable = table.BuildNoSQLTable(true);
        enumList.Values.Clear();
        foreach (DataRow val in dataTable.Rows)
        {
            if (!enumList.Values.Exists(i => i.Id == val[ColumnName].ToString()))
            {
                enumList.Values.Add(new MetaEV() { Id = val[ColumnName].ToString() });
            }
        }
    }
}
";
                result.Script = result.Script.Replace("TableName", Helper.QuoteDouble(column.MetaTable.Name));
                result.Script = result.Script.Replace("ColumnName", Helper.QuoteDouble(column.Name));
            }
            result.RefreshEnum();
            return(result);
        }
コード例 #7
0
ファイル: Report.cs プロジェクト: yw0903/Seal-Report
 public string EnumDisplayValue(MetaEnum instance, string id)
 {
     string result = instance.GetDisplayValue(id);
     if (instance.Translate) result = Repository.RepositoryTranslate(ExecutionView.CultureInfo.TwoLetterISOLanguageName, "Enum", instance.Name, result);
     return result;
 }
コード例 #8
0
ファイル: MetaSource.cs プロジェクト: cnark/Seal-Report
 public void RemoveEnum(MetaEnum item)
 {
     //Clean up enum references from columns
     foreach (MetaTable table in MetaData.Tables)
     {
         foreach (MetaColumn column in table.Columns.Where(i => i.EnumGUID == item.GUID))
         {
             column.EnumGUID = "";
         }
     }
     MetaData.Enums.Remove(item);
 }