Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
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);

        }
Ejemplo n.º 4
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);
        }
        public XWPKeyCommandContext(XWPKeyCommand DefaultKey, XElement XElement) 
            : base(XElement, true)
        {
            _defaultKeyCommand = DefaultKey;

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

            _contextType = reader.ReadAttributeEnum("context", XWPKeyContextType.undefined);
        }
Ejemplo n.º 6
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");
        }
Ejemplo n.º 7
0
        public XWPAppView(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _menuItems = reader.GetChildren("MenuItems", new Range(1, 1)).Select(p=>new XWPMenuItems(p)).FirstOrDefault();

            _misc = reader.GetChildren("Misc", new Range(0, 1)).Select(p => new XWPMisc(p)).FirstOrDefault();

            _keys = reader.GetChildren("Keys", new Range(0, 1)).Select(p => new XWPKeyCommands(p)).FirstOrDefault();
        }
        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();
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        public XSPApplication(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

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

            if (_mode == XOMode.None)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, "mode", "Mode for application None, in this case project won't have any functionality.", false);

            _tables = reader.GetChildren("Table", Range.NotBound).Select(p => new XSPTable(p)).ToArray();
        }
        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);
        }
Ejemplo n.º 13
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();
        }
Ejemplo n.º 14
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);

        }
Ejemplo n.º 15
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();
        }
Ejemplo n.º 16
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();

        }
Ejemplo n.º 17
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 ", ","); 
            }

        }
Ejemplo n.º 18
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();

        }