public static bool openSelectedMethodSDM(EA.Diagram actDiag, SQLMethod meth, SQLRepository sqlRepository, out SQLElement methParent, out SQLElement container)
        {
            SQLTaggedValue aTag = null;

            methParent = sqlRepository.GetElementByID(meth.ParentID);
            container  = null;
            foreach (SQLElement sdmContainer in methParent.Elements)
            {
                aTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(sdmContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName);
                if (aTag != null)
                {
                    if (aTag.Value == meth.MethodGUID.ToString())
                    {
                        container = sdmContainer;
                        break;
                    }
                }
            }
            SQLDiagram sdmDiagg = null;

            if (container != null)
            {
                foreach (SQLDiagram sdmDiag in container.Diagrams)
                {
                    sdmDiagg = sdmDiag;
                    Navigator.addAnchorEntry(sdmDiag.DiagramID, actDiag.DiagramID);
                    sqlRepository.OpenDiagram(sdmDiag.DiagramID);

                    setAnchorElementTags(sqlRepository, actDiag, container);

                    return(true);
                }
            }
            return(false);
        }
示例#2
0
        public override List <String> doRule(SQLMethod eaMethod, SQLRepository repository)
        {
            List <String> results = new List <string>();

            SQLElement parentClass = repository.GetElementByID(eaMethod.ParentID);

            if (parentClass.Stereotype == ECOREModelingMain.EClassStereotype)
            {
                //if return type of method is a ecore built in type
                if (EcoreUtil.ecoreEDataTypes.Contains(eaMethod.ReturnType) || eaMethod.ReturnType == "void")
                {
                    return(new List <string>());
                }

                if (eaMethod.ClassifierID == "0")
                {
                    String type = HttpUtility.HtmlDecode(eaMethod.ReturnType);
                    if (type == "EEList<E>" || type == "EMap<K,V>")
                    {
                        results.Add(@"Unsupported EDatatype, This EDatatype is not currently supported, please choose another EDatatype or create a new EDatatype with an appropriate alias (mapping to Java type)");
                    }
                    else
                    {
                        results.Add("Return value is invalid - Please choose a model element or use a known Ecore datatype");
                    }
                }
            }
            return(results);
        }
示例#3
0
        public override void ReadData()
        {
            List <CancelAllowance> B0201 = new List <CancelAllowance>();
            var Value = SQLMethod.Count_B0201();

            if (Value != null)
            {
                Form1.B0201Num = Value.Count;
                foreach (var B0201Data in Value)
                {
                    CancelAllowance data = new CancelAllowance();
                    data.CancelAllowanceNumber = B0201Data.CancelAllowanceNumber.Trim();
                    data.AllowanceDate         = B0201Data.AllowanceDate.Trim();
                    data.BuyerId      = B0201Data.BuyerId.Trim();
                    data.SellerId     = B0201Data.SellerId.Trim();
                    data.CancelDate   = B0201Data.CancelDate.Trim();
                    data.CancelTime   = B0201Data.CancelTime.Substring(0, 2) + ":" + B0201Data.CancelTime.Substring(2, 2) + ":00";
                    data.CancelReason = B0201Data.CancelReason.Trim();
                    B0201.Add(data);
                }
                CancelAllowance = B0201;
                if (Value.Count > 0)
                {
                    XMLMethod.Save_B0201(CancelAllowance);
                }
            }
            else
            {
                Form1.B0201Num = 0;
            }
        }
示例#4
0
        public override void ReadData()
        {
            List <InvoicConfirm> A0102 = new List <InvoicConfirm>();
            var Value = SQLMethod.Count_A0102();

            if (Value != null)//檢查發票接收確認數量
            {
                Form1.A0102Num = Value.Count;
                foreach (var A0102Data in Value)
                {
                    InvoicConfirm data = new InvoicConfirm();
                    data.InvoiceNumber = A0102Data.InvoiceNumber.Trim();
                    data.InvoiceDate   = A0102Data.InvoiceDate.Trim();
                    data.BuyerId       = A0102Data.BuyerID.Trim();
                    data.SellerId      = A0102Data.SellerID.Trim();
                    data.ReceiveDate   = A0102Data.ReceiveDate.Trim();
                    data.ReceiveTime   = A0102Data.ReceiveTime.Substring(0, 2) + ":" + A0102Data.ReceiveTime.Substring(2, 2) + ":00";
                    A0102.Add(data);
                }
                InvoicConfirm = A0102;
                if (Value.Count > 0)
                {
                    XMLMethod.Save_A0102(InvoicConfirm);
                }
            }
            else
            {
                Form1.A0102Num = 0;
            }
        }
示例#5
0
        public SQLMethod findMethodFromMocaNode(SQLElement parent, MocaNode methodNode)
        {
            SQLMethod found = null;

            foreach (SQLMethod method in parent.Methods)
            {
                int validCount = 0;
                if (method.Name == methodNode.getAttributeOrCreate("name").Value)
                {
                    foreach (SQLParameter param in method.Parameters)
                    {
                        foreach (MocaNode paramNode in methodNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children)
                        {
                            if (paramNode.getAttributeOrCreate("name").Value == param.Name)
                            {
                                validCount++;
                            }
                        }
                    }
                    if (validCount == method.Parameters.Count && validCount == methodNode.getChildNodeWithName(EOperation.ParametersChildNodeName).Children.Count)
                    {
                        found = method;
                    }
                }
            }
            return(found);
        }
示例#6
0
 public EOperation(SQLMethod eaMethod, SQLRepository repository)
 {
     this.Repository  = repository;
     this.EaMethod    = eaMethod;
     this.Name        = eaMethod.Name;
     this.EParameters = new List <EParameter>();
 }
        private void ProjectBrowsingForm_Load(object sender, EventArgs e)
        {
            SQLSettings = InitialMethod.InitialSQLSetting();
            SQLMethod   = new SQLMethod()
            {
                setting = SQLSettings
            };
            SQLMethod.SQLConnect();
            string    grammar   = "USE [PurchaseProcessSystemDB] Select projectdatettime,projectno,ownername,projectleader,projectworkleader,ponumber FROM DispatchDataTable Order By projectdatettime";
            DataTable dataTable = SQLMethod.OutPutTable(grammar);

            gridControl1.DataSource = dataTable;
            gridView1.OptionsView.ColumnAutoWidth = false;
            gridView1.Columns[0].BestFit();
            gridView1.Columns[0].Caption = "日期";
            gridView1.Columns[1].BestFit();
            gridView1.Columns[1].Caption = "專案編號";
            gridView1.Columns[2].BestFit();
            gridView1.Columns[2].Caption = "業主名稱";
            gridView1.Columns[3].BestFit();
            gridView1.Columns[3].Caption = "專案負責人";
            gridView1.Columns[4].BestFit();
            gridView1.Columns[4].Caption = "專案工地負責人";
            gridView1.Columns[5].BestFit();
            gridView1.Columns[5].Caption = "PO單號碼";
            for (int i = 0; i < gridView1.Columns.Count; i++)
            {
                gridView1.Columns[i].OptionsColumn.AllowEdit = false;
            }
        }
示例#8
0
        public override void ReadData()
        {
            List <CancelAllowanceConfirm> B0202 = new List <CancelAllowanceConfirm>();
            var Value = SQLMethod.Count_B0202();

            if (Value != null)
            {
                Form1.B0202Num = Value.Count;
                foreach (var B0202Data in Value)
                {
                    CancelAllowanceConfirm data = new CancelAllowanceConfirm();
                    data.CancelAllowanceNumber = B0202Data.CancelAllowanceNumber.Trim();
                    data.AllowanceDate         = B0202Data.AllowanceDate.Trim();
                    data.BuyerId    = B0202Data.BuyerId.Trim();
                    data.SellerId   = B0202Data.SellerId.Trim();
                    data.CancelDate = B0202Data.CancelDate.Trim();
                    data.CancelTime = B0202Data.CancelTime.Substring(0, 2) + ":" + B0202Data.CancelTime.Substring(2, 2) + ":00";
                    B0202.Add(data);
                }
                CancelAllowanceConfirm = B0202;
                if (Value.Count > 0)
                {
                    XMLMethod.Save_B0202(CancelAllowanceConfirm);
                }
            }
            else
            {
                Form1.B0202Num = 0;
            }
        }
示例#9
0
        /// <summary>
        /// checks if the the parameter can be referenced from the object
        /// parameter is in the same sdm as the object)
        /// </summary>
        /// <param name="referencedParameter"></param>
        /// <param name="containingElement"></param>
        /// <param name="repository"></param>
        /// <returns></returns>
        public static Boolean checkParameterCanBeReferenced(SQLParameter referencedParameter, SQLElement containingElement, SQLRepository repository)
        {
            SQLElement containerOfOwningObject = containingElement;

            while (containerOfOwningObject.Stereotype != SDMModelingMain.SdmContainerStereotype && containerOfOwningObject.Stereotype != TGGModelingMain.TggRuleStereotype)
            {
                containerOfOwningObject = repository.GetElementByID(containerOfOwningObject.ParentID);
            }

            if (containerOfOwningObject.Stereotype == SDMModelingMain.SdmContainerStereotype)
            {
                SQLMethod referencedMethodOfSDM = repository.GetMethodByGuid(EAEcoreAddin.Util.EAUtil.findTaggedValue(containerOfOwningObject, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName).Value);
                if (referencedMethodOfSDM != null)
                {
                    if (referencedParameter.OperationID != referencedMethodOfSDM.MethodID)
                    {
                        return(false);
                    }
                }
            }

            else if (containerOfOwningObject.Stereotype == TGGModelingMain.TggRuleStereotype)
            {
                SQLMethod method = repository.GetMethodByID(referencedParameter.OperationID);
                if (method.ParentID != containerOfOwningObject.ElementID)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#10
0
        public override List <FirstObject> getFirstObjects(SQLElement elementToSearch, SQLRepository repository)
        {
            List <FirstObject> targetParameters = new List <FirstObject>();
            SQLMethod          associatedMethod = null;

            if (elementToSearch.Stereotype == SDMModelingMain.SdmContainerStereotype)
            {
                SQLTaggedValue assoMethodTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(elementToSearch, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName);
                associatedMethod = repository.GetMethodByGuid(assoMethodTag.Value);
            }

            else if (elementToSearch.Stereotype == TGGModelingMain.TggRuleStereotype)
            {
                if (elementToSearch.Methods.Count > 0)
                {
                    associatedMethod = elementToSearch.Methods.GetAt(0);
                }
            }

            if (associatedMethod != null)
            {
                foreach (SQLParameter parameter in associatedMethod.Parameters)
                {
                    targetParameters.Add(new FirstObject(parameter));
                }
            }

            targetParameters.Sort(new EAObjectIComparer());
            return(targetParameters);
        }
        public override void deserializeFromMocaTree(Serialization.MocaTree.MocaNode actNode)
        {
            this.MethodGuid       = actNode.getAttributeOrCreate("methodGuid").Value;
            this.MethodNameOld    = actNode.getAttributeOrCreate("methodName").Value;
            this.MethodReturnType = actNode.getAttributeOrCreate("methodReturnType").Value;

            SQLMethod mt = Repository.GetMethodByGuid(this.MethodGuid);

            if (mt != null)
            {
                this.MethodName = mt.Name;
            }
            else
            {
                this.MethodName = MethodNameOld;
            }
            MocaNode targetNode = actNode.getChildNodeWithName("target");

            this.Target = Expression.createExpression(targetNode.getAttributeOrCreate("type").Value, Repository);
            this.Target.deserializeFromMocaTree(targetNode);
            foreach (MocaNode childNode in actNode.Children)
            {
                if (childNode.Name == "ownedParameterBinding")
                {
                    ParameterBinding paramBinding = new ParameterBinding(Repository);
                    paramBinding.deserializeFromMocaTree(childNode);
                    this.OwnedParameterBinding.Add(paramBinding);
                }
            }
        }
示例#12
0
        public override void ReadData()
        {
            List <RejectInvoice> A0301 = new List <RejectInvoice>();
            var Value = SQLMethod.Count_A0301();

            if (Value != null)//檢查退回發票數量
            {
                Form1.A0301Num = Value.Count;
                foreach (var A0301Data in Value)
                {
                    RejectInvoice data = new RejectInvoice();
                    data.RejectInvoiceNumber = A0301Data.RejectInvoiceNumber.Trim();
                    data.InvoiceDate         = A0301Data.InvoiceDate.Trim();
                    data.BuyerId             = A0301Data.BuyerId.Trim();
                    data.SellerId            = A0301Data.SellerId.Trim();
                    data.RejectDate          = A0301Data.RejectDate.Trim();
                    data.RejectTime          = A0301Data.RejectTime.Substring(0, 2) + ":" + A0301Data.RejectTime.Substring(2, 2) + ":00";
                    data.RejectReason        = A0301Data.RejectReason.Trim();
                    A0301.Add(data);
                }
                RejectInvoice = A0301;
                if (Value.Count > 0)
                {
                    XMLMethod.Save_A0301(RejectInvoice);
                }
            }
            else
            {
                Form1.A0301Num = 0;
            }
        }
示例#13
0
        private static bool checkMethodCallExpression(SQLElement containingElement, SQLRepository sqlRepository, MethodCallExpression mCe)
        {
            SQLMethod method = sqlRepository.GetMethodByGuid(mCe.MethodGuid);
            Boolean   valid  = checkExpression(containingElement, mCe.Target, sqlRepository);

            if (method == null)
            {
                return(false);
            }

            if (mCe.MethodName != mCe.MethodNameOld || mCe.OwnedParameterBinding.Count != method.Parameters.Count)
            {
                return(false);
            }

            foreach (ParameterBinding paramBinding in mCe.OwnedParameterBinding)
            {
                SQLParameter parameter = sqlRepository.GetParameterByGuid(paramBinding.ParameterGuid);
                if (parameter == null)
                {
                    valid = false;
                }
                if (!checkExpression(containingElement, paramBinding.ValueExpression, sqlRepository))
                {
                    valid = false;
                }
            }

            return(valid);
        }
示例#14
0
 public override void doRuleQuickFix(SQLMethod eaMethod, SQLRepository repository, int i)
 {
     if (i == 0)
     {
         eaMethod.getRealMethod().Name = Regex.Replace(eaMethod.Name, " ", "");
         eaMethod.getRealMethod().Update();
     }
 }
示例#15
0
        public override void ReadData()
        {
            List <Invoice> A0401 = new List <Invoice>();
            var            Value = SQLMethod.Count_A0401();

            if (Value != null)//檢查開立發票數量
            {
                Form1.A0401Num = Value.Count;
                var Item = SQLMethod.Count_A0401_detail();
                if (Item != null)//檢查開立發票細項
                {
                    foreach (var A0401Data in Value)
                    {
                        Invoice data = new Invoice();
                        data.Main.InvoiceNumber          = A0401Data.InvoiceNumber.Trim();
                        data.Main.InvoiceDate            = A0401Data.InvoiceDate.Trim();
                        data.Main.InvoiceTime            = A0401Data.InvoiceTime.Substring(0, 2) + ":" + A0401Data.InvoiceTime.Substring(2, 2) + ":00";
                        data.Main.Seller.Identifier      = A0401Data.SellerID.Trim();
                        data.Main.Seller.Name            = A0401Data.SellerName.Trim();
                        data.Main.Seller.Address         = A0401Data.SellerAddress.Trim();
                        data.Main.Seller.PersonInCharge  = A0401Data.SellerPersonInCharge.Trim();
                        data.Main.Seller.TelephoneNumber = A0401Data.SellerTelephoneNumber.Trim();
                        data.Main.Buyer.Identifier       = A0401Data.BuyerID.Trim();
                        data.Main.Buyer.Name             = A0401Data.BuyerName.Trim();
                        data.Main.InvoiceType            = A0401Data.InvoiceType.Trim();
                        data.Main.DonateMark             = A0401Data.DonateMark.Trim();
                        foreach (var a0401Data in Item)
                        {
                            if (a0401Data.InvoiceNumber == A0401Data.InvoiceNumber)
                            {
                                ProductItem Productitem = new ProductItem();
                                Productitem.Description    = a0401Data.Description.Trim();
                                Productitem.Quantity       = Convert.ToDecimal(a0401Data.Quantity);
                                Productitem.Unit           = a0401Data.Unit.Trim();
                                Productitem.UnitPrice      = Convert.ToDecimal(a0401Data.UniPrice);
                                Productitem.Amount         = Convert.ToDecimal(a0401Data.Amount);
                                Productitem.SequenceNumber = a0401Data.SequenceNumber.Trim();
                                data.Details.Add(Productitem);
                            }
                        }
                        data.Amount.SalesAmount = Convert.ToDecimal(A0401Data.SalesAmount);
                        data.Amount.TaxType     = A0401Data.TaxType.Trim();
                        data.Amount.TaxAmount   = Convert.ToDecimal(A0401Data.TaxAmount);
                        data.Amount.TotalAmount = Convert.ToDecimal(A0401Data.TotalAmount);
                        A0401.Add(data);
                    }
                    Invoice = A0401;
                    if (Value.Count > 0)
                    {
                        XMLMethod.Save_A0401(Invoice);
                    }
                }
            }
            else
            {
                Form1.A0401Num = 0;
            }
        }
        public List <string> getSecondStringList(int selectedFirstObjectIndex)
        {
            this.secondObjects             = new List <SecondObject>();
            this.selectedFirstObjectIndex  = selectedFirstObjectIndex;
            this.selectedSecondObjectIndex = -1;

            List <String> sourceStringList = new List <string>();

            Object              targetElement    = this.firstObjects[selectedFirstObjectIndex].EaObject;
            EditorExpression    editorExpression = EditorExpression.createEditorExpression(selectedExpressionString);
            List <SecondObject> sourceList       = editorExpression.getSecondObjects(targetElement, repository);

            foreach (SecondObject actSecondObject in sourceList)
            {
                String name         = actSecondObject.Name;
                int    classifierId = actSecondObject.ClassifierId;

                if (actSecondObject.EaObject is SQLMethod)
                {
                    SQLMethod method = actSecondObject.EaObject as SQLMethod;
                    if (methodParameterClassifierIdFilter != 0)
                    {
                        if (classifierId != 0)
                        {
                            SQLElement methodReturnTypeClass     = repository.GetElementByID(classifierId);
                            SQLElement wantedParameterTypeClasss = repository.GetElementByID(methodParameterClassifierIdFilter);

                            foreach (SQLElement baseClass in EAUtil.getBaseClasses(methodReturnTypeClass))
                            {
                                if (baseClass.ElementID == methodParameterClassifierIdFilter)
                                {
                                    name = EAUtil.getMethodSignature(method);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        name = EAUtil.getMethodSignature(method);
                    }
                }

                if (name != "" && !sourceStringList.Contains(name))
                {
                    sourceStringList.Add(name);
                    this.secondObjects.Add(actSecondObject);
                }
            }

            this.expression = computeExpression();

            //sourceStringList.Sort();
            sourceStringList = sourceStringList.Distinct().ToList();

            return(sourceStringList);
        }
 public PurchasePlanBrowsingForm()
 {
     InitializeComponent();
     SQLSettings = InitialMethod.InitialSQLSetting();
     SQLMethod   = new SQLMethod()
     {
         setting = SQLSettings
     };
     SQLMethod.SQLConnect();
 }
 public MethodCallExpression(SQLMethod calleeMethod, SQLRepository repository)
 {
     this.Repository       = repository;
     this.Method           = calleeMethod;
     this.MethodName       = calleeMethod.Name;
     this.MethodGuid       = calleeMethod.MethodGUID;
     this.MethodReturnType = calleeMethod.ReturnType;
     this.Type             = DESCRIPTION;
     OwnedParameterBinding = new List <ParameterBinding>();
 }
示例#19
0
        public override List <String> doRule(SQLMethod eaMethod, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaMethod.Name.Contains(" "))
            {
                results.Add("Blanks are not allowed in method names");
            }
            return(results);
        }
示例#20
0
 public ProjectCreateView()
 {
     InitializeComponent();
     SQLSettings = InitialMethod.InitialSQLSetting();
     SQLMethod   = new SQLMethod()
     {
         setting = SQLSettings
     };
     SQLMethod.SQLConnect();
 }
 public QuotationSearchForm()
 {
     InitializeComponent();
     SQLSettings = InitialMethod.InitialSQLSetting();
     SQLMethod   = new SQLMethod()
     {
         setting = SQLSettings
     };
     SQLMethod.SQLConnect();
 }
 public ReportFQ()
 {
     InitializeComponent();
     SQLSettings = InitialMethod.InitialSQLSetting();
     SQLMethod   = new SQLMethod()
     {
         setting = SQLSettings
     };
     SQLMethod.SQLConnect();
 }
        private void startValidation(EA.ObjectType ot, Object eaObject, SQLRepository repository, Boolean singleRulecheck, Boolean validateAll)
        {
            this.fullValidation  = validateAll;
            this.singleRuleCheck = singleRulecheck;



            switch (ot)
            {
            //do rules for elements and their attributes/methods
            case EA.ObjectType.otElement:
                validateEAElement(eaObject, repository, singleRulecheck);
                break;

            //do rules for connectors
            case EA.ObjectType.otConnector:
                SQLConnector connector = eaObject as SQLConnector;
                RuleControl.deleteRuleResults(EA.ObjectType.otConnector, connector.ConnectorID);
                RuleControl.doRules(connector, repository);
                break;

            //do rules for attributes
            case EA.ObjectType.otAttribute:
                SQLAttribute attribute = eaObject as SQLAttribute;
                RuleControl.deleteRuleResults(EA.ObjectType.otAttribute, attribute.AttributeID);
                RuleControl.doRules(attribute, repository);
                break;

            //do rules for methods
            case EA.ObjectType.otMethod:
                SQLMethod method = eaObject as SQLMethod;
                RuleControl.deleteRuleResults(EA.ObjectType.otMethod, method.MethodID);
                RuleControl.doRules(method, repository);
                break;

            //do rules for packages
            case EA.ObjectType.otPackage:
                validatePackage(eaObject, repository, singleRulecheck, validateAll);
                break;

            case EA.ObjectType.otDiagram:
                SQLDiagram diagram = eaObject as SQLDiagram;
                RuleControl.deleteRuleResults(EA.ObjectType.otDiagram, diagram.DiagramID);
                RuleControl.doRules(diagram, repository);
                break;
            }


            if (DoGlobalRules)
            {
                RuleControl.doGlobalRules(repository);
            }

            endValidation(repository);
        }
示例#24
0
        public override void ReadData()
        {
            List <Allowance> B0101 = new List <Allowance>();
            var Value = SQLMethod.Count_B0101();

            if (Value != null)//檢查開立發票數量
            {
                Form1.B0101Num = Value.Count;
                var Item = SQLMethod.Count_B0101_detail();
                if (Item != null)//檢查開立發票細項
                {
                    foreach (var B0101Data in Value)
                    {
                        Allowance data = new Allowance();
                        data.Main.AllowanceNumber   = B0101Data.AllowanceNumber.Trim();
                        data.Main.AllowanceDate     = B0101Data.AllowanceDate.Trim();
                        data.Main.Seller.Identifier = B0101Data.SellerID.Trim();
                        data.Main.Seller.Name       = B0101Data.SellerName.Trim();
                        data.Main.Buyer.Identifier  = B0101Data.BuyerID.Trim();
                        data.Main.Buyer.Name        = B0101Data.BuyerName.Trim();
                        data.Main.AllowanceType     = B0101Data.AllowanceType.Trim();
                        foreach (var b0101Data in Item)
                        {
                            if (b0101Data.AllowanceNumber == B0101Data.AllowanceNumber)
                            {
                                ProductItem ProductItem = new ProductItem();
                                ProductItem.OriginalInvoiceDate   = b0101Data.OriginalInvoiceDate.Trim();
                                ProductItem.OriginalInvoiceNumber = b0101Data.OriginalInvoiceNumber.Trim();
                                ProductItem.OriginalDescription   = b0101Data.OriginalDescription.Trim();
                                ProductItem.Quantity  = Convert.ToDecimal(b0101Data.Quantity);
                                ProductItem.Unit      = b0101Data.Unit.Trim();
                                ProductItem.UnitPrice = Convert.ToDecimal(b0101Data.UnitPrice);
                                ProductItem.Amount    = Convert.ToDecimal(b0101Data.Amount);
                                ProductItem.Tax       = Convert.ToDecimal(b0101Data.Tax);
                                ProductItem.AllowanceSequenceNumber = b0101Data.AllowanceSequenceNumber.Trim();
                                ProductItem.TaxType = b0101Data.TaxType.Trim();
                                data.Details.Add(ProductItem);
                            }
                        }
                        data.Amount.TaxAmount   = Convert.ToDecimal(B0101Data.taxamount);
                        data.Amount.TotalAmount = Convert.ToDecimal(B0101Data.Totalamount);
                        B0101.Add(data);
                    }
                    Allowance = B0101;
                    if (Value.Count > 0)
                    {
                        XMLMethod.Save_B0101(Allowance);
                    }
                }
            }
            else
            {
                Form1.B0101Num = 0;
            }
        }
        private Expression computeExpression()
        {
            Expression expression = null;

            try
            {
                //output will be computed as the name of the stopNode

                //AttributeValueExpression with target(cmbTarget) and attribute(cmbSources)
                if (selectedExpressionString == "AttributeValueExpression" && secondObjects.Count > selectedSecondObjectIndex && firstObjects.Count > selectedFirstObjectIndex && selectedSecondObjectIndex != -1 && selectedFirstObjectIndex != -1)
                {
                    //get OV and Attribute
                    SQLAttribute             attribute            = this.secondObjects[selectedSecondObjectIndex].EaObject as SQLAttribute;
                    SQLElement               targetObjectVariable = this.firstObjects[selectedFirstObjectIndex].EaObject as SQLElement;
                    AttributeValueExpression avExp = new AttributeValueExpression(repository, attribute, targetObjectVariable);
                    expression = avExp;
                }
                //MethodCallExpression with target(cmbTarget) and Method(cmbSources)
                else if (selectedExpressionString == "MethodCallExpression" && secondObjects.Count > selectedSecondObjectIndex && firstObjects.Count > selectedFirstObjectIndex && selectedSecondObjectIndex != -1 && selectedFirstObjectIndex != -1)
                {
                    SQLMethod            method = this.secondObjects[selectedSecondObjectIndex].EaObject as SQLMethod;
                    String               name   = method.Name;
                    Object               target = this.firstObjects[selectedFirstObjectIndex].EaObject;
                    MethodCallExpression methodCallExpression = EditorMethodCallExpression.generateMethodCallExpression(repository, target, method);
                    expression = methodCallExpression;
                }
                //parameterExpression
                else if (selectedExpressionString == "ParameterExpression" && firstObjects.Count > selectedFirstObjectIndex && selectedFirstObjectIndex != -1)
                {
                    SQLParameter        parameter = this.firstObjects[selectedFirstObjectIndex].EaObject as SQLParameter;
                    ParameterExpression pExp      = new ParameterExpression(repository, parameter);
                    expression = pExp;
                }
                //literalExpression
                else if (selectedExpressionString == "LiteralExpression")
                {
                    LiteralExpression literalExpression = new LiteralExpression("null");
                    expression = literalExpression;
                }
                //objectVariableExpression
                else if (selectedExpressionString == "ObjectVariableExpression" && firstObjects.Count > selectedFirstObjectIndex)
                {
                    SQLElement sdmObject           = this.firstObjects[selectedFirstObjectIndex].EaObject as SQLElement;
                    ObjectVariableExpression ovExp = new ObjectVariableExpression(sdmObject, repository);
                    expression = ovExp;
                }
            }
            catch (Exception)
            {
            }
            return(expression);
        }
示例#26
0
 public void doSingleMethodRule(SQLMethod method, SQLRepository repository, Rule rule)
 {
     if (rule is MethodRule && (ruleExecutionPoint == rule.getRuleExecutionPoint() || ruleExecutionPoint == RuleExecutionPoint.OnRequest))
     {
         foreach (RuleResult result in rule.getRuleResult(method, repository))
         {
             if (!result.Passed)
             {
                 handleRuleResult(result, repository);
             }
         }
     }
 }
示例#27
0
        public static int getSDMDiagramID(SQLRepository repository, SQLMethod selectedOperation)
        {
            String sqlString    = "select c.Diagram_ID from t_object a, t_objectproperties b, t_diagram c where a.Stereotype = '" + SDMModelingMain.SdmContainerStereotype + "' and b.Object_ID = a.Object_ID  and b.Property = 'associatedMethod' and b.Value = '" + selectedOperation.MethodGUID + "' and c.ParentID = a.Object_ID";
            String result       = repository.SQLQuery(sqlString);
            String sdmDiagramID = EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(result, "Diagram_ID")[0];

            if (sdmDiagramID != "")
            {
                int diagramId = int.Parse(sdmDiagramID);
                return(diagramId);
            }
            return(UNKNOWN_SDM_DIAGRAM_ID);
        }
        /// <summary>
        /// creates an empty story diagram related to the given Method
        /// </summary>
        /// <param name="method"></param>
        /// <param name="repository"></param>
        /// <param name="currentDiagram"></param> The currently open diagram. An anchor will be added to this diagram.
        public static void createStoryDiagram(SQLMethod method, EA.Repository repository, EA.Diagram currentDiagram)
        {
            EA.Element    containingEClass = repository.GetElementByID(method.ParentID);
            SQLRepository sqlRepository    = new SQLRepository(repository, false);

            EA.Element sdmContainer = (EA.Element)(containingEClass.Elements.AddNew(method.Name, Main.EAClassType));
            sdmContainer.ParentID = containingEClass.ElementID;



            EA.Diagram sdmDiagram = (EA.Diagram)(sdmContainer.Diagrams.AddNew(method.Name + " Story Diagram", SdmDiagramMetatype[0]));
            sdmDiagram.ParentID      = sdmContainer.ElementID;
            sdmDiagram.ExtendedStyle = "HideRel=0;ShowTags=0;ShowReqs=0;ShowCons=0;OpParams=1;ShowSN=0;ScalePI=0;PPgs.cx=1;PPgs.cy=1;PSize=9;ShowIcons=1;SuppCN=0;HideProps=0;HideParents=0;UseAlias=0;HideAtts=0;HideOps=0;HideStereo=0;HideEStereo=1;FormName=;";
            sdmDiagram.StyleEx       = sdmDiagram.StyleEx + "HideConnStereotype=0;";
            repository.SaveDiagram(sdmDiagram.DiagramID);
            sdmDiagram.Update();
            EA.Element startNode = (EA.Element)sdmContainer.Elements.AddNew(" Start", Main.EAStateNodeType);
            startNode.Subtype  = Main.EAStartNodeSubtype;
            startNode.ParentID = sdmContainer.ElementID;

            startNode.Name = SDMUtil.computeStartNodeName(sqlRepository.GetMethodByID(method.MethodID), sqlRepository.GetElementByID(containingEClass.ElementID));

            startNode.Update();
            EA.DiagramObject startNodeDiagramObject = (EA.DiagramObject)sdmDiagram.DiagramObjects.AddNew("l=50;r=70;t=50;b=70;", Main.EAStateNodeType);
            startNodeDiagramObject.ElementID = startNode.ElementID;
            startNodeDiagramObject.Update();


            method.getRealMethod().Update();
            sdmContainer.Update();

            Navigator.addAnchorEntry(sdmDiagram.DiagramID, currentDiagram.DiagramID);

            String objectStyleString = "StateNodeLBL=CX=437:CY=13:OX=-9:OY=-18:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;DUID=2B547EF9;LBL=CX=437:CY=13:OX=-6:OY=-17:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";

            repository.Execute("UPDATE t_diagramobjects SET ObjectStyle = '" + objectStyleString + "' WHERE Object_ID = " + startNodeDiagramObject.ElementID);

            repository.OpenDiagram(sdmDiagram.DiagramID);

            sdmContainer.Elements.Refresh();

            setAnchorElementTags(sqlRepository, currentDiagram, sqlRepository.GetElementByID(sdmContainer.ElementID));
            Activity activity = new Activity(sqlRepository.GetElementByID(sdmContainer.ElementID), sqlRepository);

            activity.OwningOperation = new ECOREModeling.ECOREExportWrapper.EOperation(sqlRepository.GetMethodByID(method.MethodID), sqlRepository);
            activity.saveTreeToEATaggedValue(true);

            StartNode startNodeObject = new StartNode(sqlRepository, sqlRepository.GetElementByID(startNode.ElementID));

            startNodeObject.saveTreeToEATaggedValue(true);
        }
        public override List <String> doRule(SQLMethod eaMethod, SQLRepository repository)
        {
            SQLElement    parent  = repository.GetElementByID(eaMethod.ParentID);
            List <String> results = new List <string>();

            if (parent.Stereotype == ECOREModelingMain.EClassStereotype)
            {
                foreach (SQLElement sdmContainer in parent.Elements)
                {
                    if (sdmContainer.Stereotype == SDMModelingMain.SdmContainerStereotype)
                    {
                        SQLTaggedValue associatedTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(sdmContainer, SDMModelingMain.SDMContainerAssociatedMethodTaggedValueName);
                        if (associatedTag != null)
                        {
                            String associatedTagValue = associatedTag.Value;
                            if (associatedTagValue == eaMethod.MethodGUID)
                            {
                                foreach (SQLElement aNode in sdmContainer.Elements)
                                {
                                    if (aNode.Stereotype == SDMModelingMain.StartNodeStereotype)
                                    {
                                        String parameters = "";
                                        foreach (SQLParameter param in eaMethod.Parameters)
                                        {
                                            parameters += param.Name + ": " + param.Type + ", ";
                                        }
                                        if (parameters.Length > 0)
                                        {
                                            parameters = parameters.Substring(0, parameters.Length - 2);
                                        }
                                        String nameShouldBe = parent.Name + "::" + eaMethod.Name + " (" + parameters + "): " + eaMethod.ReturnType.ToString();
                                        bool   equal        = nameShouldBe.StartsWith(aNode.Name);
                                        if (!equal)
                                        {
                                            results.Add("SDM Container, StartNode, and Diagram name should correspond to Method name");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }


            return(results);
        }
        public Form1()
        {
            InitializeComponent();
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .WriteTo.File($"{AppDomain.CurrentDomain.BaseDirectory}\\log\\log-.txt",
                                       rollingInterval: RollingInterval.Day,
                                       outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
                         .CreateLogger();

            SQLSettings = InitialMethod.InitialSQLSetting();
            SQLMethod   = new SQLMethod()
            {
                setting = SQLSettings
            };
            SQLMethod.SQLConnect();
        }