Exemple #1
0
        int ExportDataGrid(Stream stream, UnicontaBaseEntity[] corasauBaseEntity, Dictionary <string, int> mappedItems)
        {
            Type RecordType;

            if (corasauBaseEntity.Length > 0)
            {
                RecordType = corasauBaseEntity[0].GetType();
            }
            else
            {
                return(0);
            }

            var Props       = new List <PropertyInfo>();
            var Headers     = new List <string>();
            var sortedItems = (from l in mappedItems where l.Value > 0 orderby l.Value ascending select l).ToList();

            foreach (var strKey in sortedItems)
            {
                var pInfo = RecordType.GetProperty(strKey.Key);
                if (pInfo != null)
                {
                    Headers.Add(UtilFunctions.GetDisplayNameFromPropertyInfo(pInfo));
                    Props.Add(pInfo);
                }
            }
            int cnt = 0;

#if !SILVERLIGHT
            var writer = new StreamWriter(stream, Encoding.Default);
            cnt = CSVHelper.ExportDataGridToExcel(stream, Headers, corasauBaseEntity, Props, spreadSheet, ".xlsx", "Intrastat");
            writer.Flush();
#endif
            return(cnt);
        }
Exemple #2
0
        private List <string> CreatePropertySource(BankImportFormatClient bankImportFormatClient)
        {
            var propertyInfos = UtilFunctions.GetDisplayAttributeNonReadOnlyPropertiesFromType(bankImportFormatClient.GetType(), true);

            List <string> propertySource = new List <string>(propertyInfos.Count);

            foreach (var propInfo in propertyInfos)
            {
                if (propInfo.PropertyType == typeof(byte))
                {
                    if (propInfo.Name == "SkipLines")
                    {
                        continue;
                    }

                    propertySource.Add(string.Format("{0} ({1})", propInfo.Name, UtilFunctions.GetDisplayNameFromPropertyInfo(propInfo)));
                }
            }
            return(propertySource);
        }