Example #1
0
        protected override void WriteConfiguration(IConfigurationElement sourceElement)
        {
            if (null == sourceElement) throw new ArgumentNullException("sourceElement");

            sourceElement.AddAttribute("table").Value = this.TableName;

            base.WriteConfiguration(sourceElement);
        }
Example #2
0
 protected virtual void SaveConfiguration()
 {
     if (null != this.ConfigurationSaving)
     {
         this.ConfigurationSaving(this, new EventArgs());
     }
     if (this.EnableConfigurationProvider)
     {
         if (null == this._table)
         {
             throw new InvalidOperationException("Table is null");
         }
         IConfigurationSection configSection = this.GetConfigurationReference();
         if (null != configSection)
         {
             configSection.Elements.Clear();
             foreach (TableRow row in this._table.Rows)
             {
                 int num = this._table.Rows.GetRowIndex(row);
                 IConfigurationElement configRow = configSection.AddElement(num.ToString());
                 foreach (TableCell cell in row.Cells)
                 {
                     num = row.Cells.GetCellIndex(cell);
                     IConfigurationElement configCell = configRow.AddElement(num.ToString());
                     configCell.AddAttribute("span").Value    = ((cell.ColumnSpan == 0) ? 1 : cell.ColumnSpan);
                     configCell.AddAttribute("rowspan").Value = ((cell.RowSpan == 0) ? 1 : cell.RowSpan);
                     string containerID = this.CreateContainerID(cell.ID);
                     if (this._containersParts.ContainsKey(containerID))
                     {
                         configCell.AddAttribute("part").Value = this._containersParts[containerID];
                     }
                     else
                     {
                         configCell.AddAttribute("part").Value = string.Empty;
                     }
                     this.SaveCellProperties(cell, configCell);
                 }
             }
         }
     }
     if (null != this.ConfigurationSaved)
     {
         this.ConfigurationSaved(this, new EventArgs());
     }
 }
Example #3
0
        protected virtual void WriteConfiguration(IConfigurationElement sourceElement)
        {
            if (null == sourceElement)
            {
                throw new ArgumentNullException("sourceElement");
            }

            sourceElement.AddAttribute("field").Value = this.FieldName;
        }
Example #4
0
        protected override void WriteConfiguration(IConfigurationElement sourceElement)
        {
            if (null == sourceElement)
            {
                throw new ArgumentNullException("sourceElement");
            }

            sourceElement.AddAttribute("view").Value = this.ViewName;

            base.WriteConfiguration(sourceElement);
        }
Example #5
0
        public override void ToConfiguration(IConfigurationElement config)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }

            IConfigurationElement sourceElement = config.AddElement("source");

            sourceElement.AddAttribute("parameter").Value = this.ParameterName;
        }
Example #6
0
 protected virtual void SaveCellProperties(TableCell cell, IConfigurationElement configCell)
 {
     if (ControlFactory.Instance.KnownTypes.ContainsKey("TableCell"))
     {
         ControlFactory.ControlDescriptor descriptor = ControlFactory.Instance.KnownTypes["TableCell"];
         foreach (string name in descriptor.EditableProperties.Keys)
         {
             configCell.AddAttribute(name).Value = ReflectionServices.ToString(ReflectionServices.ExtractValue(cell, name));
         }
     }
 }
Example #7
0
        public static void ToConfiguration(this IToken token, IConfigurationElement config)
        {
            if (!config.Attributes.ContainsKey("type"))
                config.AddAttribute("type").Value = token.Key;
            else if ((string)config.GetAttributeReference("type").Value != token.Key)
                config.GetAttributeReference("type").Value = token.Key;

            IExpression expression = token as IExpression;
            if (null != expression)
            {
                IConfigurationElement operandsElement = config.AddElement("operands");
                int index = 0;
                foreach (IToken operand in expression.Operands.Where(o => null != o))
                {
                    IConfigurationElement operandElement = operandsElement.AddElement(index.ToString());
                    operand.ToConfiguration(operandElement);
                    index++;
                }
            }
            else
            {
                IBasicToken basicToken = token as IBasicToken;
                if (null != basicToken)
                {
                    IConfigurationElement sourceElement = config.AddElement("source");
                    if (null != basicToken.Source)
                    {
                        if (basicToken.Source is Control)
                            sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID;
                        else
                            sourceElement.AddAttribute("id").Value = basicToken.Source;

                        if (!String.IsNullOrEmpty(basicToken.Member))
                            sourceElement.AddAttribute("member").Value = basicToken.Member;
                    }
                    else if (null != basicToken.Value)
                        sourceElement.AddAttribute("value").Value = basicToken.Source;
                }
                else
                {
                    System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) });
                    if (null != concreteMethod)
                        concreteMethod.Invoke(token, new object[] { config });
                }
            }
        }
Example #8
0
        protected virtual void WriteConfiguration(IConfigurationElement sourceElement)
        {
            if (null == sourceElement) throw new ArgumentNullException("sourceElement");

            sourceElement.AddAttribute("field").Value = this.FieldName;
        }
Example #9
0
        public static void ToConfiguration(this IToken token, IConfigurationElement config)
        {
            if (!config.Attributes.ContainsKey("type"))
            {
                config.AddAttribute("type").Value = token.Key;
            }
            else if ((string)config.GetAttributeReference("type").Value != token.Key)
            {
                config.GetAttributeReference("type").Value = token.Key;
            }

            IExpression expression = token as IExpression;

            if (null != expression)
            {
                IConfigurationElement operandsElement = config.AddElement("operands");
                int index = 0;
                foreach (IToken operand in expression.Operands.Where(o => null != o))
                {
                    IConfigurationElement operandElement = operandsElement.AddElement(index.ToString());
                    operand.ToConfiguration(operandElement);
                    index++;
                }
            }
            else
            {
                IBasicToken basicToken = token as IBasicToken;
                if (null != basicToken)
                {
                    IConfigurationElement sourceElement = config.AddElement("source");
                    if (null != basicToken.Source)
                    {
                        if (basicToken.Source is Control)
                        {
                            sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID;
                        }
                        else
                        {
                            sourceElement.AddAttribute("id").Value = basicToken.Source;
                        }

                        if (!String.IsNullOrEmpty(basicToken.Member))
                        {
                            sourceElement.AddAttribute("member").Value = basicToken.Member;
                        }
                    }
                    else if (null != basicToken.Value)
                    {
                        sourceElement.AddAttribute("value").Value = basicToken.Source;
                    }
                }
                else
                {
                    System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) });
                    if (null != concreteMethod)
                    {
                        concreteMethod.Invoke(token, new object[] { config });
                    }
                }
            }
        }
Example #10
0
 protected virtual void SaveCellProperties(TableCell cell, IConfigurationElement configCell)
 {
     if (ControlFactory.Instance.KnownTypes.ContainsKey("TableCell"))
     {
         ControlFactory.ControlDescriptor descriptor = ControlFactory.Instance.KnownTypes["TableCell"];
         foreach (string name in descriptor.EditableProperties.Keys)
         {
             configCell.AddAttribute(name).Value = ReflectionServices.ToString(ReflectionServices.ExtractValue(cell, name));
         }
     }
 }
Example #11
0
 private void AddAttributes(IConfigurationElement commandElement)
 {
     commandElement.AddAttribute("text").Value = "";
     commandElement.AddAttribute("type").Value = SqlDataSourceCommandType.Text;
 }
 private void AddAttributes(IConfigurationElement commandElement)
 {
     commandElement.AddAttribute("text").Value = "";
     commandElement.AddAttribute("type").Value = SqlDataSourceCommandType.Text;
 }