public EditPropertyForm(DomainObjectInquiry inquiry, DomainObjectConfig obj, DomainPropertyConfig prop)
        {
            InitializeComponent();

            m_inquiry = inquiry;
            m_object = obj;
            m_property = prop;

            FillDataType();

            if (m_property != null)
            {
                txtCode.Text = m_property.Code;
                txtCode.Enabled = false;

                txtCodeName.Text = m_property.CodeName;
                txtDescription.Text = m_property.Description;

                txtDataType.SelectedItem = m_property.DataType;
                txtDataType.Enabled = false;

                txtLength.Value = m_property.Size;
                txtLength.Enabled = false;
            }
        }
Beispiel #2
0
        public EditLinkForm(DomainObjectInquiry inquiry, DomainLinkConfig link = null)
        {
            InitializeComponent();

            m_inquiry = inquiry;
            m_link = link;

            FillObjects();

            if (link != null)
            {
                txtLinkCode.Enabled = false;
                txtLinkTableName.Enabled = false;

                rgLeftRelation.Enabled = false;
                rgRightRelation.Enabled = false;

                txtLeftIdField.Enabled = false;
                txtRightIdField.Enabled = false;

                gridLeftObject.Enabled = false;
                gridRightObject.Enabled = false;

                txtLinkCode.Text = link.Code;
                txtLinkTableName.Text = link.LinkTable;

                rgLeftRelation.SelectedIndex = link.LeftRelation == eRelation.One ? 0 : 1;
                rgRightRelation.SelectedIndex = link.RightRelation == eRelation.One ? 0 : 1;

                txtLeftIdField.Text = link.LeftObjectIdField;
                txtRightIdField.Text = link.RightObjectIdField;

                gridLeftObjectCodeColumn.View.ActiveFilterString = String.Format("[Code] LIKE '{0}'", link.LeftObject.Code);
                gridRightObjectCodeColumn.View.ActiveFilterString = String.Format("[Code] LIKE '{0}'", link.RightObject.Code);

                cbIsLeftToRight.Checked = link.IsLeftToRightActive;
                cbIsRightToLeft.Checked = link.IsRightToLeftActive;

                txtLeftCollectionName.Text = link.LeftCollectionName;
                txtRightCollectionName.Text = link.RightCollectionName;

                txtLeftToRightDescription.Text = link.LeftToRightDescription;
                txtRightToLeftDescription.Text = link.RightToLeftDescription;
            }
            else
            {
                rgLeftRelation.SelectedIndex = 0;
                rgRightRelation.SelectedIndex = 1;
            }

            EnableControlByRelation();
        }
Beispiel #3
0
        public EditObjectForm(DomainObjectInquiry inquiry, DomainObjectConfig obj)
        {
            InitializeComponent();

            m_inquiry = inquiry;
            m_object = obj;

            if (obj != null)
            {
                txtCode.Enabled = false;
                txtCode.Text = obj.Code;
                txtCodeName.Text = obj.CodeName;
                txtDescription.Text = obj.Description;
            }
        }
        private void AppendObjectConfigNode(TreeListNode parentNode, DomainObjectInquiry inquiry, DomainObjectConfig objConfig)
        {
            TreeListNode objNode = AppendNode(parentNode, GetNodeTitle(objConfig), new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.ObjectConfig, objConfig));

            TreeListNode objPropertiesNode = AppendNode(objNode, ObjectExplorerControlLocalization.PropertiesNodeTitle, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.ObjectProperties, objConfig));

            foreach (DomainPropertyConfig prop in objConfig.Property)
            {
                AppendPropertyConfigNode(inquiry, objPropertiesNode, prop);
            }
        }
Beispiel #5
0
 public void EditLinkConfig(DomainObjectInquiry inquiry, DomainLinkConfig link)
 {
     using (EditLinkForm form = new EditLinkForm(inquiry, link))
     {
         form.ShowDialog();
     }
 }
 public void Init(DomainObjectInquiry inquiry, ObjectQuery query)
 {
     undoRedoManager = new UndoRedoManager();
     m_inquiry = inquiry;
     m_query = query;
 }
        private TreeListNode GetRootObjectsNode(DomainObjectInquiry inquiry)
        {
            TreeListNode dbNode = GetParentNode(inquiry);

            if (dbNode == null)
                throw new ApplicationException(ObjectExplorerControlLocalization.RootDbNodeNotFoundError);

            TreeListNode objectRootNode = GetNode(dbNode, eObjectExplorerNode.RootObjects);
            if (objectRootNode == null)
                throw new ApplicationException(ObjectExplorerControlLocalization.ObjectsRootNodeNotFoundError);

            return objectRootNode;
        }
 private TreeListNode GetParentNode(DomainObjectInquiry inquiry)
 {
     return GetParentNode(inquiry, objectTree);
 }
        private TreeListNode GetLinksNode(DomainObjectInquiry inquiry)
        {
            TreeListNode dbNode = GetParentNode(inquiry);

            if (dbNode == null)
                throw new ApplicationException(ObjectExplorerControlLocalization.RootDbNodeNotFoundError);

            TreeListNode linkCollectionNode = GetNode(dbNode, eObjectExplorerNode.RootLinks);

            if (linkCollectionNode == null)
                throw new ApplicationException(ObjectExplorerControlLocalization.LinkCollectionNodeNotFoundError);

            return linkCollectionNode;
        }
        private void BindData(DomainObjectInquiry inquiry)
        {
            try
            {
                inquiry.CreateObjectCompleted += ObjectInquiry_CreateObjectCompleted;
                inquiry.EditObjectCompleted += ObjectInquiry_EditObjectCompleted;
                inquiry.DeleteObjectCompleted += ObjectInquiry_DeleteObjectCompleted;

                inquiry.CreatePropertyCompleted += ObjectInquiry_CreatePropertyCompleted;
                inquiry.EditPropertyCompleted += ObjectInquiry_EditPropertyCompleted;
                inquiry.DeletePropertyCompleted += ObjectInquiry_DeletePropertyCompleted;

                inquiry.CreateLinkCompleted += ObjectInquiry_CreateLinkCompleted;
                inquiry.EditLinkCompleted += ObjectInquiry_EditLinkCompleted;
                inquiry.DeleteLinkCompleted += ObjectInquiry_DeleteLinkCompleted;

                inquiry.CreateObjectQueryCompleted += ObjectInquiry_CreateObjectQueryCompleted;
                inquiry.DeleteObjectQueryCompleted += ObjectInquiry_DeleteObjectQueryCompleted;

                inquiry.IsModifiedChanged += ObjectInquiry_IsEditedChanged;

                objectTree.BeginUpdate();

                TreeListNode dbRootNode = AppendNode(null, ObjectExplorerControlLocalization.DbNodeTitle, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.Database));

                TreeListNode objectRootNode = AppendNode(dbRootNode, ObjectExplorerControlLocalization.ObjectsNodeTitle, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.RootObjects));

                foreach (DomainObjectConfig objConfig in inquiry.AObject)
                {
                    AppendObjectConfigNode(objectRootNode, inquiry, objConfig);
                }

                TreeListNode linkRootNode = AppendNode(dbRootNode, ObjectExplorerControlLocalization.LinksNodeTitle, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.RootLinks));

                foreach (DomainLinkConfig link in inquiry.ALinks)
                {
                    AppendLinkConfigNode(inquiry, linkRootNode, link);
                }

                TreeListNode objectQueryRoot = AppendNode(dbRootNode, ObjectExplorerControlLocalization.ObjectQueryCollectionNodeTitle, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.RootObjectQuery));

                foreach (ObjectQuery query in inquiry.AQuery)
                {
                    AppendObjectQueryNode(objectQueryRoot, inquiry, query);
                }
            }
            finally
            {
                objectTree.EndUpdate();
            }
        }
Beispiel #11
0
 public ShowPropertyRequestArgs(object editValue, DomainObjectInquiry inquiry)
 {
     EditValue = editValue;
     Inquiry = inquiry;
 }
Beispiel #12
0
 public UIArgs(DomainObjectInquiry inquiry)
 {
     Inquiry = inquiry;
 }
Beispiel #13
0
 public void ShowProperty(object editValue, DomainObjectInquiry inquiry)
 {
     if (ShowPropertyRequest != null)
         ShowPropertyRequest(this, new ShowPropertyRequestArgs(editValue, inquiry));
 }
Beispiel #14
0
 public void ShowObjectSql(DomainObjectInquiry app, DomainObjectConfig obj, ObjectSqlArgs.eKind kind)
 {
     if (ObjectSqlRequest != null)
         ObjectSqlRequest(this, new ObjectSqlArgs(app, obj, kind));
 }
Beispiel #15
0
        public void EditPropertyConfig(DomainObjectInquiry inquiry, DomainPropertyConfig property)
        {
            DomainObjectConfig parentObject = inquiry.AObject[property.Owner.Code];

            using (EditPropertyForm form = new EditPropertyForm(inquiry, parentObject, property))
            {
                form.ShowDialog();
            }
        }
Beispiel #16
0
 public void EditObjectQuery(DomainObjectInquiry inquiry, ObjectQuery objQuery)
 {
     using (EditQueryForm form = new EditQueryForm(inquiry, objQuery))
     {
         form.ShowDialog();
     }
 }
Beispiel #17
0
 public void EditObjectConfig(DomainObjectInquiry inquiry, DomainObjectConfig obj = null)
 {
     using (EditObjectForm form = new EditObjectForm(inquiry, obj))
     {
         form.ShowDialog();
     }
 }
 private void AppendObjectQueryNode(TreeListNode objectQueryRoot, DomainObjectInquiry inquiry, ObjectQuery query)
 {
     AppendNode(objectQueryRoot, query.Code, new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.ObjectQueryConfig, query));
 }
 private void AppendPropertyConfigNode(DomainObjectInquiry inquiry, TreeListNode objPropertiesNode, DomainPropertyConfig prop)
 {
     AppendNode(objPropertiesNode, GetNodeTitle(prop), new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.ObjectPropertyConfig, prop));
 }
        private static void DomainObjectLinksCode(DomainObjectInquiry inquiry, DomainObjectConfig obj, CodeTypeDeclaration targetClass, CodeConstructor constructor, CodeConstructor newObjectConstructor)
        {
            foreach (DomainLinkConfig link in inquiry.ALinks)
            {
                if (link.LeftObject != obj && link.RightObject != obj)
                    continue;

                CodeMemberField linkCodeConst = DomainLinkCodeConstCode(link);
                targetClass.Members.Add(linkCodeConst);

                if (link.LeftObject == obj)
                {
                    CodeMemberField leftPrivateColl = LeftLinkPrivateCollection(link);
                    targetClass.Members.Add(leftPrivateColl);

                    CodeMemberProperty leftPropField = LeftLinkCollection(link, leftPrivateColl);
                    targetClass.Members.Add(leftPropField);

                    CodeMethodInvokeExpression linkFunc = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeThisReferenceExpression(), "GetLinkCollection"), new CodeVariableReferenceExpression(linkCodeConst.Name), new CodePropertyReferenceExpression(new CodeVariableReferenceExpression("eLinkSide"), eLinkSide.Left.ToString()));
                    CodeAssignStatement initCollectionStatement = new CodeAssignStatement(new CodeVariableReferenceExpression(leftPrivateColl.Name), linkFunc);

                    constructor.Statements.Add(initCollectionStatement);
                    newObjectConstructor.Statements.Add(initCollectionStatement);
                }

                if (link.RightObject == obj)
                {
                    //CodeMemberProperty rightPropField = RightLinkCollection(link);
                    //targetClass.Members.Add(rightPropField);
                }
            }

            //	throw new NotImplementedException();

            //bool isFirstLink = true;
            //CodeMemberProperty lastLink = null;
            //foreach (EntityLinkConfig linkConfig in obj.Link)
            //{
            //    CodeMemberField linkCodeConst = null;
            //    CodeMemberProperty link = null;
            //    EntityLinkCode(linkConfig, out linkCodeConst, out link);

            //    targetClass.Members.Add(linkCodeConst);

            //    // начало региона свойств
            //    if (isFirstLink)
            //    {
            //        CodeRegionDirective startLinksRegion = new CodeRegionDirective(CodeRegionMode.Start, LinkRegionName);
            //        linkCodeConst.StartDirectives.Add(startLinksRegion);
            //        isFirstLink = false;
            //    }

            //    targetClass.Members.Add(link);
            //    lastLink = link;
            //}

            //// закрываем регион свойств
            //if (lastLink != null)
            //{
            //    CodeRegionDirective endLinksRegion = new CodeRegionDirective(CodeRegionMode.End, string.Empty);
            //    lastLink.EndDirectives.Add(endLinksRegion);
            //}
        }
        private void CloseConnection(DomainObjectInquiry inquiry, bool deleteNodeFromTree = true)
        {
            if (inquiry.IsModified)
            {
                if (XtraMessageBox.Show(ObjectExplorerControlLocalization.SaveChangesQuestion, ParentForm.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    inquiry.Save();
            }

            if (deleteNodeFromTree)
            {
                TreeListNode parentNode = GetParentNode(inquiry);
                if (parentNode == null)
                    return;

                objectTree.Nodes.Remove(parentNode);
            }
        }
        public static string DomainObjectCode(DomainObjectInquiry inquiry, DomainObjectConfig obj)
        {
            CodeCompileUnit unit = new CodeCompileUnit();
            CodeNamespace targetNamespace = new CodeNamespace("NamespaceName");
            unit.Namespaces.Add(targetNamespace);

            targetNamespace.Imports.Add(new CodeNamespaceImport("System"));
            targetNamespace.Imports.Add(new CodeNamespaceImport("DomainCommonSE"));
            targetNamespace.Imports.Add(new CodeNamespaceImport("DomainCommonSE.Domain"));
            targetNamespace.Imports.Add(new CodeNamespaceImport("DomainCommonSE.DomainConfig"));

            // объявление класса
            CodeTypeDeclaration targetClass = new CodeTypeDeclaration(obj.CodeName)
            {
                IsClass = true,
                TypeAttributes = TypeAttributes.Public
            };
            targetNamespace.Types.Add(targetClass);

            // базовый класс
            targetClass.BaseTypes.Add(typeof(DomainObject));

            // комментарий - описание класса
            SetSummaryComment(targetClass, obj.Description);

            // строковая константа - код класса
            CodeMemberField objectNameConst = new CodeMemberField
            {
                Attributes = MemberAttributes.Public | MemberAttributes.Const,
                Name = ObjectCodeConstFieldName,
                Type = new CodeTypeReference(typeof(String)),
                InitExpression = new CodePrimitiveExpression(obj.Code)
            };

            targetClass.Members.Add(objectNameConst);

            #region Конструктор загрузки объекта из БД
            CodeConstructor loadObjectConstructor = new CodeConstructor();
            loadObjectConstructor.Attributes = MemberAttributes.Public;

            loadObjectConstructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof(SessionIdentifier), "sessionId"));
            loadObjectConstructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("sessionId"));

            loadObjectConstructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof(ObjectIdentifier), "objectId"));
            loadObjectConstructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("objectId"));

            targetClass.Members.Add(loadObjectConstructor);
            #endregion

            #region Конструктор создания нового объекта
            CodeConstructor newObjectConstructor = new CodeConstructor();
            newObjectConstructor.Attributes = MemberAttributes.Public;

            newObjectConstructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof(SessionIdentifier), "sessionId"));
            newObjectConstructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("sessionId"));
            newObjectConstructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(ObjectCodeConstFieldName));

            targetClass.Members.Add(newObjectConstructor);
            #endregion

            DomainObjectPropertiesCode(obj, targetClass);
            DomainObjectLinksCode(inquiry, obj, targetClass, loadObjectConstructor, newObjectConstructor);

            StringBuilder resultCode = new StringBuilder();
            using (StringWriter sourceWriter = new StringWriter(resultCode))
            {
                CreateProvider().GenerateCodeFromCompileUnit(unit, sourceWriter, CreateGeneratorOptions());
            }

            return resultCode.ToString();
        }
 private TreeListNode GetObjectConfigNode(DomainObjectInquiry inquiry, DomainObjectConfig objectConfig)
 {
     TreeListNode objectRootNode = GetRootObjectsNode(inquiry);
     return GetNodeByValue(objectRootNode, objectConfig);
 }
 public ObjectQueryParameterCollectionDeleteItemCommand(DomainObjectInquiry inquiry, ObjectQuery query, ObjectQueryParameter param)
 {
     m_inquiry = inquiry;
     Query = query;
     m_param = param;
 }
        private TreeListNode GetPropertiesNode(DomainObjectInquiry inquiry, DomainObjectConfig objectConfig)
        {
            TreeListNode objectConfigNode = GetObjectConfigNode(inquiry, objectConfig);
            TreeListNode propertyCollectionNode = GetNode(objectConfigNode, eObjectExplorerNode.ObjectProperties);

            if (propertyCollectionNode == null)
                throw new ApplicationException(ObjectExplorerControlLocalization.PropertyCollectionNodeNotFoundError);

            return propertyCollectionNode;
        }
Beispiel #26
0
 public void DeleteObjectQuery(DomainObjectInquiry inquiry, ObjectQuery query)
 {
     if (MessageBox.Show(String.Format(UILocalization.DeleteObjectQueryQuestion, query.Code), UILocalization.DeleteObjectQueryCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         inquiry.DeleteObjectQuery(query);
     }
 }
 public ObjectExplorerNodeTag(DomainObjectInquiry inquiry, eObjectExplorerNode kind, object value = null)
 {
     Inquiry = inquiry;
     Kind = kind;
     Value = value;
 }
 private void AppendLinkConfigNode(DomainObjectInquiry inquiry, TreeListNode objLinksNode, DomainLinkConfig link)
 {
     AppendNode(objLinksNode, GetNodeTitle(link), new ObjectExplorerNodeTag(inquiry, eObjectExplorerNode.LinkConfig, link));
 }
        private static TreeListNode GetParentNode(DomainObjectInquiry inquiry, TreeList tree)
        {
            for (int i = 0; i < tree.Nodes.Count; i++)
            {
                TreeListNode node = tree.Nodes[i];
                ObjectExplorerNodeTag tag = node.Tag as ObjectExplorerNodeTag;
                if (tag.Inquiry == inquiry)
                    return node;
            }

            return null;
        }
Beispiel #30
0
 public void DeletePropertyConfig(DomainObjectInquiry inquiry, DomainPropertyConfig property)
 {
     if (MessageBox.Show(String.Format(UILocalization.DeleteEntityObjectPropertyQuestion, property.Code), UILocalization.DeleteEntityObjectPropertyCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         inquiry.DeleteProperty(property);
     }
 }