Пример #1
0
        public XOPTable(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _source = reader.ReadAttribute("source");

            _sourceUpdate = reader.ReadAttribute("sourceUpdate");

            _schemeName = reader.ReadAttribute("schemeName");

            _autoFill = reader.ReadAttributeBool("autoFill", true);

            _persistFill = reader.ReadAttributeBool("persistFill", true);

            _stdCommandsType = reader.ReadAttributeEnumFlags<XOPTableCommandType>("stdCommandsType", XOPTableCommandType.All, XOPTableCommandType.Default);

            XElement xFields = reader.GetChildren("Fields", new DataAvail.Utils.Range(1)).FirstOrDefault();

            _fields = new XOPFields(xFields);

            XElement xFuncs = reader.GetChildren("Functions", new DataAvail.Utils.Range(0, 1)).FirstOrDefault();

            _functions = new XOPFunctions(xFuncs);

        }
Пример #2
0
        public XOPField(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _type = new XOPFieldType(XElement);

            _isPk = reader.ReadAttributeBool("pk", false);

            _isPkAutoGenertaed = reader.ReadAttributeBool("isPkAutoGenertaed", true);

            if (!_isPk && _isPkAutoGenertaed)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Field {0} is not primary key but isPKAutoGenerated is set to true, it will be ignored.", _name), false);

            _defaultValue = reader.ReadAttributeValue("defaultValue", _type.Type);

            _nullable = reader.ReadAttributeBool("nullable", true);

            _isMapped = reader.ReadAttributeBool("isMapped", true);

            _mappedParamName = reader.ReadAttribute("mappedParamName");

            if (!_isMapped && !string.IsNullOrEmpty(_mappedParamName))
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Field {0} is not mapped but it contains mappedParamName, it will be ignored.", _name), false);

            _isMappedTypeConverted = reader.ReadAttributeBool("isMappedTypeConverted", false);

            _calculator = reader.ReadAttribute("calculator");
        }
Пример #3
0
        public XWPRelation(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _relationName = reader.ReadAttribute("name", true);

            _isShown = reader.ReadAttributeBool("showChildren", false);

            _serializationName = reader.ReadAttribute("serializationName");
        }
        public XOPFunctionParam(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name");

            _paramType = new XOPFieldType(XElement, false);

            _mappedColumn = reader.ReadAttribute("mappedColumn");

            _direction = reader.ReadAttributeEnum("direction", System.Data.ParameterDirection.Input);

            _value = reader.ReadAttributeValue("value", _paramType.Type);
        }
Пример #5
0
        public XOPFunction(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _commandType = reader.ReadAttributeEnumFlags("type", XOPTableCommandType.All, XOPTableCommandType.None);

            _params = reader.GetChildren("Param", new Range(1, -1)).Select(p => new XOPFunctionParam(p)).ToArray();  

            if (!(CommandType == (XOPTableCommandType.Insert | XOPTableCommandType.Update)))
            {
                if (_commandType == XOPTableCommandType.None)
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} is None. Command won't be used in project.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Select))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Select and another command. Command of this type can't be mixed, will be used as Select.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Delete))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Delete and another command. Command of this type can't be mixed, will be used as Delete.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Insert))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Insert and command of type diffrent from Update. Command of this type can't be mixed, will be used as Insert.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Update))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Update and command of type diffrent from Insert. Command of this type can't be mixed, will be used as Update.", _name), false);
                }
            }
        }
Пример #6
0
        public XWPMenuItem(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _caption = reader.ReadAttribute("caption", true);

            _tableName = reader.ReadAttribute("tableName");

            _children = reader.GetChildren("MenuItem", Range.NotBound).Select(p=>new XWPMenuItem(p)).ToArray();

            if (!string.IsNullOrEmpty(_tableName) && _children.Length > 0)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, (string)null, "Menu item can't have tableName not null along with children menu items, tableName will be ignored.", false);

            if (string.IsNullOrEmpty(_tableName) && _children.Length == 0)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, (string)null, "Menu item tableName is empty and doesn't contain children menu items.", false);

            _key = new XWPKeyCommand(XElement, false);

        }
Пример #7
0
        public XSPTable(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _tableName = reader.ReadAttribute("name", true);

            _mode = reader.ReadAttributeEnumFlags("mode", XOMode.All, XOMode.All);

            _fields = reader.GetChildren("Field", Range.NotBound).Select(p => new XSPField(p)).ToArray();
        }
        public XWPApplication(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name");

            _dataView = reader.GetChildren("DataView", new Range(0, 1)).Select(p=>new XWPDataView(p)).FirstOrDefault();

            _appView = reader.GetChildren("AppView", new Range(0, 1)).Select(p => new XWPAppView(p)).FirstOrDefault();
        }
Пример #9
0
        public XSPField(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _fieldName = reader.ReadAttribute("name", true);

            _mode = reader.ReadAttributeEnumFlags("mode", XOMode.All, XOMode.View | XOMode.Edit);

            if (EnumFlags.IsContain(_mode, XOMode.Add | XOMode.Delete))
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, "mode", "Field mode can't be nor Add neither Remove, they will be ignored", false);
        }
Пример #10
0
        public XWPTable(XWPDataView XWPDataView, XElement XElement)
        {
            _xWPDataView = XWPDataView;

            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _tableName = reader.ReadAttribute("name", true);

            _caption = reader.ReadAttribute("caption");

            _itemCaption = reader.ReadAttribute("itemCaption");

            _separateSerialization = reader.ReadAttributeBool("separateSerialization", true);

            _saveMode = reader.ReadAttributeEnumFlags("saveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _childSaveMode = reader.ReadAttributeEnumFlags("childSaveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _fields = reader.GetChildren("Fields", new Range(0, 1)).Select(p => new XWPFields(this, p)).FirstOrDefault();
        }
Пример #11
0
        public XWPDataView(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _parentDisplayField = reader.ReadAttribute("parentDisplayField");

            _saveMode = reader.ReadAttributeEnumFlags("saveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _childSaveMode = reader.ReadAttributeEnumFlags("childSaveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _tables = reader.GetChildren("Table", Range.NotBound).Select(p => new XWPTable(this, p)).ToArray();

            _relations = reader.GetChildren("Relations", new Range(0, 1)).Select(p => new XWPRelations(p)).FirstOrDefault();
        }
Пример #12
0
        public XOPDataSet(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _adapterPath = reader.ReadAttribute("adapterPath");

            _adapterType = reader.ReadAttributeEnum<XOPDataSetAdapterType>("adapterType", XOPDataSetAdapterType.Custom);

            if (string.IsNullOrEmpty(_adapterPath) && _adapterType == XOPDataSetAdapterType.Custom)
            {
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, "Either adapterType or adapterPath should be set for DataSet", true);
            }

            _connectionString = reader.ReadAttribute("connectionString", true);

            _schemeName = reader.ReadAttribute("schemeName");

            _useStdCommands = reader.ReadAttributeBool("useStdCommands", true);

            _tables = reader.GetChildren("Table", new Range(1, -1)).Select(p => new XOPTable(p)).ToArray();

            _relations = reader.GetChildren("Relations", new Range(-1, 1)).Select(p=>new XOPRelations(p)).FirstOrDefault();

        }
Пример #13
0
        public XWPKeyCommand(XElement XElement, bool Obrigatory)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            string keyAttr = reader.ReadAttribute("key", Obrigatory);

            if (!string.IsNullOrEmpty(keyAttr))
            {
                _keys = keyAttr.Split(';').Select(p => new XWPKey(this, p)).ToArray();
            }
            else
            {
                _keys = new XWPKey[] { };
            }
            
            _command = reader.ReadAttributeEnum("command", XWPKeyCommandType.none);

            if (_command == XWPKeyCommandType.none)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, "command", "Command can't have None type. It will be omitted.", false);

            _keyContexts = reader.GetChildren("KeyContext", Range.NotBound).Select(p => new XWPKeyCommandContext(this, p)).ToArray();

        }
Пример #14
0
        public XOPRelation(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _parentTable = reader.ReadAttribute("parentTable", true);

            _parentField = reader.ReadAttribute("parentField", true);

            _childTable = reader.ReadAttribute("childTable", true);

            _childField = reader.ReadAttribute("childField", true);

            _filter = reader.ReadAttribute("filter");

            _defaultValues = reader.ReadAttribute("defaultValues");

            if (_defaultValues == null && !string.IsNullOrEmpty(Filter))
            {
                _defaultValues = Filter.Replace("'", "").Replace(" AND ", ","); 
            }

        }
Пример #15
0
        public XWPField(XWPFields XWPFields, XElement XElement)
        {
            _xWPFields = XWPFields;

            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _fieldName = reader.ReadAttribute("name", true);

            _caption = reader.ReadAttribute("caption");

            _readOnly = reader.ReadAttributeBool("readOnly", false);

            _mask = new XWPFieldMask(XElement);

            _controlType = reader.ReadAttribute("controlType");

            _parentDisplayField = reader.ReadAttribute("parentDisplayField");

            _fkInterfaceType = reader.ReadAttributeEnumFlags("fkInterface", XWPFieldFkInterfaceType.All, XWPFieldFkInterfaceType.Default);

            _fkSelectItemMode = reader.ReadAttributeEnumFlags("fkSelectItemMode", XOMode.All, XOMode.View);

            _bindingField = reader.ReadAttribute("bindingProperty");

            _displayType = reader.ReadAttributeEnumFlags("displayType", XWPFieldDisplayType.Anywhere, XWPFieldDisplayType.Anywhere);
        }