Exemplo n.º 1
0
 public static Value GetFieldValue(Field field)
 {
     Value value = new Value();
     switch (field.Type)
     {
         case FieldTypeEnum.INPUT:
             InputField inputField = (InputField) field;
             value.PropertyValue = inputField.Value;
             break;
         case FieldTypeEnum.MULTIINPUT:
             value = null;
             break;
         case FieldTypeEnum.SINGLECHECK:
             SingleCheckField singleCheckField = (SingleCheckField) field;
             value = singleCheckField.GetValue();
             break;
         case FieldTypeEnum.MULTICHECK:
             value = null;
             break;
         case FieldTypeEnum.COMPLEX:
             value = null;
             break;
         case FieldTypeEnum.MULTICOMPLEX:
             value = null;
             break;
         case FieldTypeEnum.LABEL:
             value = null;
             break;
         default:
             value = null;
             break;
     }
     return value;
 }
Exemplo n.º 2
0
 public void AddValue(Value value)
 {
     if (value == null)
     {
         return;
     }
     this.values.Add(value);
 }
Exemplo n.º 3
0
 public void AddValue(string value)
 {
     if (value == null)
     {
         return;
     }
     Value v = new Value();
     v.PropertyValue = value;
     this.AddValue(v);
 }
Exemplo n.º 4
0
        public void AddDefaultValueDO(Value value)
        {
            if (value == null)
            {
                return;
            }

            if (base.defaultValueField == null)
            {
                this.InitDefaultField();
            }
            MultiCheckField defaultField = (MultiCheckField)base.defaultValueField;
            defaultField.AddValue(value);
        }
Exemplo n.º 5
0
 public static List<Value> GetValueListFromString(List<String> values)
 {
     if (values == null)
     {
         return null;
     }
     List<Value> result = new List<Value>();
     foreach (string v in values)
     {
         Value value = new Value();
         value.PropertyValue = v;
         result.Add(value);
     }
     return result;
 }
Exemplo n.º 6
0
 private static SingleCheckField ElementToSingleCheckField(XmlElement fieldElm, string fieldId, string fieldName)
 {
     if (fieldElm == null)
     {
         return null;
     }
     SingleCheckField singleCheckField = (SingleCheckField) SchemaFactory.CreateField(FieldTypeEnum.SINGLECHECK);
     singleCheckField.Id = fieldId;
     singleCheckField.Name = fieldName;
     //rules
     XmlElement rulesEle = XmlUtils.GetChildElement(fieldElm, "rules");
     if (rulesEle != null)
     {
         List<XmlElement> ruleEleList = XmlUtils.GetChildElements(rulesEle, "rule");
         foreach (XmlElement ruleEle in ruleEleList)
         {
             Rule rule = ElementToRule(ruleEle, singleCheckField.Id);
             singleCheckField.Add(rule);
         }
     }
     //option
     XmlElement optionsEle = XmlUtils.GetChildElement(fieldElm, "options");
     if (optionsEle != null)
     {
         List<XmlElement> optionEleList = XmlUtils.GetChildElements(optionsEle, "option");
         foreach (XmlElement optionEleEle in optionEleList)
         {
             Option op = ElementToOption(optionEleEle, singleCheckField.Id);
             singleCheckField.Add(op);
         }
     }
     //property
     XmlElement propertiesEle = XmlUtils.GetChildElement(fieldElm, "properties");
     if (propertiesEle != null)
     {
         List<XmlElement> propertyEleList = XmlUtils.GetChildElements(propertiesEle, "property");
         foreach (XmlElement propertyEle in propertyEleList)
         {
             Property.Property property = ElementToProperty(propertyEle, singleCheckField.Id);
             singleCheckField.Add(property);
         }
     }
     //defaultValue
     XmlElement defaultValueEle = XmlUtils.GetChildElement(fieldElm, "default-value");
     if (defaultValueEle != null)
     {
         Value value = new Value();
         String dvalue = defaultValueEle.InnerText;
         value.PropertyValue = dvalue;
         singleCheckField.SetDefaultValueDO(value);
     }
     //value
     XmlElement valueEle = XmlUtils.GetChildElement(fieldElm, "value");
     if (valueEle != null)
     {
         Value value = new Value();
         value.PropertyValue = XmlUtils.GetElementValue(valueEle);
         singleCheckField.SetValue(value);
     }
     return singleCheckField;
 }
Exemplo n.º 7
0
 private static MultiInputField ElementToMultiInputField(XmlElement fieldElm, string fieldId, string fieldName)
 {
     if (fieldElm == null)
     {
         return null;
     }
     MultiInputField multiInputField = (MultiInputField) SchemaFactory.CreateField(FieldTypeEnum.MULTIINPUT);
     multiInputField.Id = fieldId;
     multiInputField.Name = fieldName;
     //rules
     XmlElement rulesEle = XmlUtils.GetChildElement(fieldElm, "rules");
     if (rulesEle != null)
     {
         List<XmlElement> ruleEleList = XmlUtils.GetChildElements(rulesEle, "rule");
         foreach (XmlElement ruleEle in ruleEleList)
         {
             Rule rule = ElementToRule(ruleEle, multiInputField.Id);
             multiInputField.Add(rule);
         }
     }
     //property
     XmlElement propertiesEle = XmlUtils.GetChildElement(fieldElm, "properties");
     if (propertiesEle != null)
     {
         List<XmlElement> propertyEleList = XmlUtils.GetChildElements(propertiesEle, "property");
         foreach (XmlElement propertyEle in propertyEleList)
         {
             Property.Property property = ElementToProperty(propertyEle, multiInputField.Id);
             multiInputField.Add(property);
         }
     }
     //defaultValue
     XmlElement defaultValuesEle = XmlUtils.GetChildElement(fieldElm, "default-values");
     if (defaultValuesEle != null)
     {
         List<XmlElement> defaultValueEleList = XmlUtils.GetChildElements(defaultValuesEle, "default-value");
         foreach (XmlElement defaultValueEle in defaultValueEleList)
         {
             string dvalue = defaultValueEle.InnerText;
             multiInputField.AddDefaultValue(dvalue);
         }
     }
     //value
     XmlElement valuesEle = XmlUtils.GetChildElement(fieldElm, "values");
     if (valuesEle != null)
     {
         List<XmlElement> valueEleList = XmlUtils.GetChildElements(valuesEle, "value");
         foreach (XmlElement valueEle in valueEleList)
         {
             Value value = new Value();
             value.PropertyValue = XmlUtils.GetElementValue(valueEle);
             multiInputField.AddValue(value);
         }
     }
     return multiInputField;
 }
Exemplo n.º 8
0
 public void SetSingleCheckFieldValue(string fieldId, Value value)
 {
     SingleCheckField field = new SingleCheckField();
     field.Id = fieldId;
     field.SetValue(value);
     this.fieldMap[fieldId] = field;
 }
Exemplo n.º 9
0
 public void AddValue(Value value)
 {
     this.values.Add(value);
 }
Exemplo n.º 10
0
 public void SetValues(List<String> values)
 {
     if (values == null)
     {
         return;
     }
     this.values.Clear();
     foreach (string value in values)
     {
         Value v = new Value();
         v.PropertyValue = value;
         this.values.Add(v);
     }
 }
Exemplo n.º 11
0
        public void SetDefaultValueDO(Value value)
        {
            if (value == null)
            {
                return;
            }

            if (base.defaultValueField == null)
            {
                this.InitDefaultField();
            }
            SingleCheckField defaultField = (SingleCheckField)base.defaultValueField;
            defaultField.SetValue(value);
        }
Exemplo n.º 12
0
 public void SetValue(Value value)
 {
     if (value == null)
     {
         return;
     }
     this.value = value;
 }