Exemple #1
0
 public static bool IsValid(WSParamList xp)
 {
     return(!IsEmpty(xp) && xp.FirstOrDefault(x => !WSParam.IsValid(x)) == null);
 }
Exemple #2
0
        public void WriteXml(XmlWriter writer)
        {
            try
            {
                writer.WriteStartElement(Name);
                Type type           = GetType();
                bool writeAllFields = WSParamList.IsEmpty(outFields);

                foreach (PropertyInfo x in type.GetProperties())
                {
                    string xName = x.Name.ToLower();

                    WSParam xParam = GetParam(x.Name, x.PropertyType);
                    if (xParam != null && role >= xParam.READ_ACCESS_MODE.ACCESS_LEVEL)
                    {
                        if (writeAllFields)
                        {
                            writer.WriteStartElement(xName);
                            WriteXmlValue(x.GetValue(this, null), null, x.PropertyType, writer);
                            writer.WriteEndElement();
                        }
                        else
                        {
                            WSParam outputParam = outFields.FirstOrDefault(a => a.Match(xName));
                            if (outputParam != null)
                            {
                                writer.WriteStartElement(xName);
                                WriteXmlValue(x.GetValue(this, null), outputParam, x.PropertyType, writer);
                                writer.WriteEndElement();
                            }
                        }
                    }
                }
                foreach (FieldInfo x in type.GetFields())
                {
                    string xName = x.Name.ToLower();

                    WSParam xParam = GetParam(x.Name, x.FieldType);
                    if (xParam != null && role >= xParam.READ_ACCESS_MODE.ACCESS_LEVEL)
                    {
                        if (writeAllFields)
                        {
                            writer.WriteStartElement(xName);
                            WriteXmlValue(x.GetValue(this), null, x.FieldType, writer);
                            writer.WriteEndElement();
                        }
                        else
                        {
                            WSParam outputParam = outFields.FirstOrDefault(a => a.Match(xName));
                            if (outputParam != null)
                            {
                                writer.WriteStartElement(xName);
                                WriteXmlValue(x.GetValue(this), outputParam, x.FieldType, writer);
                                writer.WriteEndElement();
                            }
                        }
                    }
                }
                writer.WriteEndElement();
            }
            catch (Exception e) { WSStatus status = WSStatus.NONE.clone(); CFunc.RegError(GetType(), e, ref status); }
        }