Ejemplo n.º 1
0
        public override void ToJSON(JObject ParentObject)
        {
            ParentObject[_SelectedNodeTypeIdsSubField.ToXmlNodeName().ToLower()] = SelectedNodeTypeIds.ToString();
            ParentObject["selectmode"]      = SelectMode.ToString();
            ParentObject[_ElemName_Options] = new JObject();

            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();

            CBAOptions.Columns.Add("Include");

            DataTable Data = Options;

            foreach (DataRow Row in Data.Rows)
            {
                bool isSelected = SelectedNodeTypeIds.Contains(Row[KeyColumn]);
                if (IsEditModeEditable || isSelected)
                {
                    CswCheckBoxArrayOptions.Option Option = new CswCheckBoxArrayOptions.Option();
                    Option.Key   = CswConvert.ToString(Row[KeyColumn]);
                    Option.Label = CswConvert.ToString(Row[NameColumn]);
                    Option.Values.Add(CswConvert.ToBoolean(Row[ValueColumn]));
                    CBAOptions.Options.Add(Option);
                }
            }

            CBAOptions.ToJSON((JObject)ParentObject[_ElemName_Options]);
        } // ToJSON()
        public override void ToJSON( JObject ParentObject )
        {
            ParentObject[_SelectedViewIdsSubField.ToXmlNodeName()] = SelectedViewIds.ToString();
            ParentObject["selectmode"] = SelectMode.ToString();
            ParentObject[_CachedViewNameSubField.ToXmlNodeName()] = CachedViewNames.ToString();
            ParentObject[ElemName_Options] = new JObject();

            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();
            CBAOptions.Columns.Add( "Include" );

            DataTable ViewsTable = ViewsForCBA();
            foreach( DataRow ViewRow in ViewsTable.Rows )
            {
                bool isSelected = SelectedViewIds.Contains( ViewRow[KeyColumn] );
                if( IsEditModeEditable || isSelected )
                {
                    CswCheckBoxArrayOptions.Option Option = new CswCheckBoxArrayOptions.Option();
                    Option.Key = ViewRow[KeyColumn].ToString();
                    Option.Label = ViewRow[NameColumn].ToString();
                    Option.Values.Add( CswConvert.ToBoolean( ViewRow[ValueColumn] ) );
                    CBAOptions.Options.Add( Option );
                }
            }
            CBAOptions.ToJSON( (JObject) ParentObject[ElemName_Options] );

        } // ToJSON()
Ejemplo n.º 3
0
        //private string _TableName = "logicalsetitem";

        // ToXml()

        public override void ToJSON(JObject ParentObject)
        {
            ParentObject[_ElemName_LogicalSetJson] = new JObject();

            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();

            DataTable Data = GetDataAsTable(_NameColumn, _KeyColumn);

            foreach (DataColumn Column in Data.Columns)
            {
                if (Column.ColumnName != _NameColumn &&
                    Column.ColumnName != _KeyColumn &&
                    false == CBAOptions.Columns.Contains(Column.ColumnName))
                {
                    CBAOptions.Columns.Add(Column.ColumnName);
                }
            }
            foreach (DataRow Row in Data.Rows)
            {
                CswCheckBoxArrayOptions.Option Option = new CswCheckBoxArrayOptions.Option();
                Option.Key   = Row[_KeyColumn].ToString();
                Option.Label = Row[_NameColumn].ToString();
                for (Int32 i = 0; i < CBAOptions.Columns.Count; i++)
                {
                    Option.Values.Add(CswConvert.ToBoolean(Row[CBAOptions.Columns[i]].ToString()));
                }
                CBAOptions.Options.Add(Option);
            }

            CBAOptions.ToJSON((JObject)ParentObject[_ElemName_LogicalSetJson]);
        } // ToJSON()