Exemplo n.º 1
0
        private static RvsSavedProperties LoadFrom(DB_RvsSettingsDataContext db, RVS_Property row)
        {
            if (row == null)
            {
                return(null);
            }
            var properties = new RvsSavedProperties
            {
                Grouping         = row.Grouping.Elements("GroupColumn").Select(r => (GroupColumn)r.Value).ToList(),
                OrderByColumns   = row.OrderByColumns == null ? null : string.Join(",", row.OrderByColumns.Elements("OrderColumn").Select(r => r.Value).ToArray()),
                PageUrl          = row.Filter == null ? null : row.Filter.Value,
                ReportPluginName = row.ReportPluginName,
                NameRu           = row.nameRu,
                NameKz           = row.nameKz,
                JournalTypeName  = row.JournalTypeName,
            };

            ReadFixedHeader(row, properties);
            ReadColumnHierarchy(row, properties);
            ReadRowsProperties(row, properties);
            ReadStorageValues(row, properties);
            ReadCellsProperties(row, properties);
            ReadOtherParameters(row, properties);
            return(properties);
        }
Exemplo n.º 2
0
 private static void WriteStorageValues(RVS_Property row, RvsSavedProperties properties)
 {
     if (properties.StorageValues != null)
     {
         row.StorageValues = new Binary(properties.StorageValues.Serialize());
     }
 }
Exemplo n.º 3
0
 private static void ReadStorageValues(RVS_Property row, RvsSavedProperties properties)
 {
     if (row.StorageValues != null && row.StorageValues.Length > 0)
     {
         properties.StorageValues = StorageValues.Deserialize(row.StorageValues.ToArray());
     }
 }
Exemplo n.º 4
0
 private static void WriteFixedHeader(RVS_Property row, RvsSavedProperties properties)
 {
     row.FixedHeader = new XElement("Root",
                                    new XElement("IsFixedHeader", properties.IsFixedHeader.ToString()),
                                    new XElement("FixedRowsCount", properties.FixedRowsCount.ToString()),
                                    new XElement("FixedColumnsCount", properties.FixedColumnsCount.ToString()));
 }
Exemplo n.º 5
0
        public static RvsSavedProperties GetFromJournal(BaseJournalUserControl journal)
        {
            journal.PrepareSettings();
            var properties =
                new RvsSavedProperties
            {
                Grouping             = journal.BaseJournal.GroupColumns.ToList(),
                PageUrl              = journal.Url.CreateUrl(true, true, true),
                ReportPluginName     = journal.ReportPluginName,
                IsFixedHeader        = journal.FixedHeader,
                FixedColumnsCount    = journal.FixedColumnsCount,
                FixedRowsCount       = journal.FixedRowsCount,
                ColumnHierarchy      = journal.BaseJournal.BaseInnerHeader.ColumnHierarchy,
                StorageValues        = journal.StorageValues,
                HeaderRowsProperties = journal.BaseJournal.BaseInnerHeader.RowsProperties,
                DataRowsProperties   = journal.BaseJournal.RowsProperties,
                DataCellProperties   = journal.BaseJournal.CellsProperties,
                ConcatenateColumns   = journal.BaseJournal.SelectingColumnControl != null
                                                 ? journal.BaseJournal.SelectingColumnControl.GetConcatenateColumnTransporters()
                                                 : null,
                NameRu          = journal.HeaderRu,
                NameKz          = journal.HeaderKz,
                JournalTypeName = GetJournalTypeName(journal),
                OrderByColumns  = journal.BaseJournal.DefaultOrder,
            };

            return(properties);
        }
Exemplo n.º 6
0
        private static void WriteCellsProperties(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <CellProperties>));
            var xmlDoc     = new XDocument();

            using (var writer = xmlDoc.CreateWriter())
                serializer.Serialize(writer, properties.DataCellProperties);
            row.CellsStyle = new XElement("CellsProperties", xmlDoc.Root);
        }
Exemplo n.º 7
0
        private static void ReadColumnHierarchy(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <ColumnHierarchy>));
            List <ColumnHierarchy> colH;

            using (var stream = row.ColumnsStyle.CreateReader())
                colH = (List <ColumnHierarchy>)serializer.Deserialize(stream);
            properties.ColumnHierarchy = colH;
        }
Exemplo n.º 8
0
        private static void WriteOtherParameters(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <ConcatenateColumnTransporter>));
            var xmlDoc     = new XDocument();

            using (var writer = xmlDoc.CreateWriter())
                serializer.Serialize(writer, properties.ConcatenateColumns);
            row.OtherParameters = new XElement("Root",
                                               new XElement("ConcatenateColumns", xmlDoc.Root));
        }
Exemplo n.º 9
0
        private static void WriteColumnHierarchy(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <ColumnHierarchy>));
            var xmlDoc     = new XDocument();

            using (var writer = xmlDoc.CreateWriter())
            {
                serializer.Serialize(writer, properties.ColumnHierarchy);
                writer.Flush();
                writer.Close();
                row.ColumnsStyle = xmlDoc.Root;
            }
        }
Exemplo n.º 10
0
        private static void ReadCellsProperties(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <CellProperties>));

            if (row.CellsStyle == null)
            {
                return;
            }
            var element = row.CellsStyle.Elements().FirstOrDefault();

            if (element != null)
            {
                using (var stream = element.CreateReader())
                    properties.DataCellProperties = (List <CellProperties>)serializer.Deserialize(stream);
            }
        }
Exemplo n.º 11
0
        private static void ReadRowsProperties(RVS_Property row, RvsSavedProperties properties)
        {
            var serializer = new XmlSerializer(typeof(List <RowProperties>));
            var eHR        = row.RowsStyle.Element("HeaderRowsProperties");

            if (eHR != null)
            {
                using (var stream = eHR.Elements().First().CreateReader())
                    properties.HeaderRowsProperties = (List <RowProperties>)serializer.Deserialize(stream);
            }
            var eDR = row.RowsStyle.Element("DataRowsProperties");

            if (eDR != null)
            {
                using (var stream = eDR.Elements().First().CreateReader())
                    properties.DataRowsProperties = (List <RowProperties>)serializer.Deserialize(stream);
            }
        }
Exemplo n.º 12
0
        private static void ReadOtherParameters(RVS_Property row, RvsSavedProperties properties)
        {
            if (row.OtherParameters == null)
            {
                return;
            }

            var serializer = new XmlSerializer(typeof(List <ConcatenateColumnTransporter>));
            var element    = row.OtherParameters.Element("ConcatenateColumns");

            if (element != null)
            {
                var doc = element.Elements().FirstOrDefault();
                if (doc != null)
                {
                    using (var stream = doc.CreateReader())
                        properties.ConcatenateColumns =
                            (List <ConcatenateColumnTransporter>)serializer.Deserialize(stream);
                }
            }
        }
Exemplo n.º 13
0
        private static void WriteRowsProperties(RVS_Property row, RvsSavedProperties properties)
        {
            var      serializer = new XmlSerializer(typeof(List <RowProperties>));
            var      xmlDoc     = new XDocument();
            XElement eHR;
            XElement eDR;

            using (var writer = xmlDoc.CreateWriter())
            {
                serializer.Serialize(writer, properties.HeaderRowsProperties);
                writer.Flush();
                writer.Close();
                eHR = new XElement("HeaderRowsProperties", xmlDoc.Root);
            }
            xmlDoc = new XDocument();
            using (var writer = xmlDoc.CreateWriter())
            {
                serializer.Serialize(writer, properties.DataRowsProperties);
                writer.Flush();
                writer.Close();
                eDR = new XElement("DataRowsProperties", xmlDoc.Root);
            }
            row.RowsStyle = new XElement("Root", eHR, eDR);
        }
Exemplo n.º 14
0
 private static void ReadFixedHeader(RVS_Property row, RvsSavedProperties properties)
 {
     properties.IsFixedHeader     = row.FixedHeader.GetElementValue <bool>("IsFixedHeader") ?? true;
     properties.FixedRowsCount    = row.FixedHeader.GetElementValue <int>("FixedRowsCount") ?? 0;
     properties.FixedColumnsCount = row.FixedHeader.GetElementValue <int>("FixedColumnsCount") ?? 1;
 }