Ejemplo n.º 1
0
        public override void ReadJSON(JObject JObject, Dictionary <Int32, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            CswCommaDelimitedString NewSelectedNodeTypeIds = SelectedNodeTypeIds;

            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();

            if (null != JObject[_ElemName_Options])
            {
                CBAOptions.ReadJson((JObject)JObject[_ElemName_Options]);
            }
            foreach (CswCheckBoxArrayOptions.Option Option in CBAOptions.Options)
            {
                if (Option.Values.Count > 0)
                {
                    if (Option.Values.Count > 0 && true == Option.Values[0])
                    {
                        NewSelectedNodeTypeIds.Add(Option.Key);
                    }
                    else if (false == Option.Values[0])
                    {
                        NewSelectedNodeTypeIds.Remove(Option.Key);
                    }
                }
            }
            SelectedNodeTypeIds = NewSelectedNodeTypeIds;
        } // ReadJSON()
Ejemplo n.º 2
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()
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()
Ejemplo n.º 4
0
        } // ToJSON()

        public override void ReadJSON(JObject JObject, Dictionary <Int32, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();

            if (null != JObject[_ElemName_LogicalSetJson])
            {
                CBAOptions.ReadJson((JObject)JObject[_ElemName_LogicalSetJson]);
            }
            foreach (CswCheckBoxArrayOptions.Option Option in CBAOptions.Options)
            {
                for (Int32 i = 0; i < Option.Values.Count; i++)
                {
                    //TODO: this hasn't worked in a LOOOOOOONG Time. Case 29477.
                    SetValue(CBAOptions.Columns[i], Option.Label, Option.Values[i]);
                }
            }
            Save();
        } // ReadJSON()