private static void AddScalarOrRecset(string dataPartFieldData, Dev2DataLanguageParser dataLanguageParser, Dictionary <IDataListVerifyPart, string> unique, ref IDataListVerifyPart verifyPart, string[] fieldList, ref string fullyFormattedStringValue)
 {
     // If the workflow field is simply a scalar or a record set without a child
     if (dataPartFieldData.EndsWith(")") && dataPartFieldData == fieldList[0])
     {
         if (dataPartFieldData.Contains("("))
         {
             fullyFormattedStringValue = RemoveRecordSetBrace(fieldList[0]);
             var intellisenseResult = dataLanguageParser.ValidateName(fullyFormattedStringValue, "");
             if (intellisenseResult == null)
             {
                 verifyPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(fullyFormattedStringValue, String.Empty);
                 AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
             }
         }
     }
     else
     {
         var intellisenseResult = dataLanguageParser.ValidateName(dataPartFieldData, "");
         if (intellisenseResult == null)
         {
             verifyPart = IntellisenseFactory.CreateDataListValidationScalarPart(RemoveRecordSetBrace(dataPartFieldData));
             AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
         }
     }
 }
            internal static void ProcessForOnlyOpenRegion(IParseTO payload, IEnumerable <IDev2DataLanguageIntellisensePart> refParts, IList <IIntellisenseResult> result)
            {
                var parentIsRecordset = payload.Parent?.IsRecordSet ?? false;

                refParts.ToList().ForEach(part =>
                {
                    if (part.Children != null && part.Children.Count > 0 && !parentIsRecordset)
                    {
                        var tmpPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(part.Name, "", part.Description + " / Select this record set");
                        result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.StartIndex + 2, tmpPart, tmpPart.Description));
                        part.Children.ToList()
                        .ForEach(child =>
                        {
                            tmpPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(part.Name, child.Name, child.Description + " / Select this record set field");
                            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.StartIndex + 2, tmpPart, part.Description + Environment.NewLine + child.Description));
                        });
                    }
                    else
                    {
                        if (part.Children == null)
                        {
                            if (payload.Parent != null && payload.Parent.Payload.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal) >= 0 || (part.Name.Contains('(') && part.Name.Contains(')')))
                            {
                                var tmpPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(string.Empty, part.Name, true);
                                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.StartIndex + 2, tmpPart, tmpPart.Description + " / Select this record set"));
                            }
                            else
                            {
                                var tmpPart = IntellisenseFactory.CreateDataListValidationScalarPart(part.Name, part.Description + " / Select this variable");
                                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.StartIndex + 2, tmpPart, tmpPart.Description));
                            }
                        }
                    }
                });
            }
Esempio n. 3
0
        public void ProcessRecordSetMatch(IParseTO payload, IList <IIntellisenseResult> result, string rawSearch, string search, IDev2DataLanguageIntellisensePart t1)
        {
            // only process if it is an open region
            // we need to add all children
            string idx;

            idx = !payload.IsLeaf && !payload.Child.HangingOpen ? DataListUtil.OpeningSquareBrackets + payload.Child.Payload + DataListUtil.ClosingSquareBrackets : DataListUtil.ExtractIndexRegionFromRecordset(rawSearch);
            // add general closed recordset
            var rsName = search;

            if (idx == string.Empty)
            {
                rsName = payload.Payload;
            }
            var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(rsName, "", t1.Description + " / Select a specific row", idx);

            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));

            var children = t1.Children;

            if (children != null)
            {
                foreach (IDev2DataLanguageIntellisensePart t in children)
                {
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(rsName, t.Name, t.Description + " / Select a specific field at a specific row", idx);
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                }
            }
        }
Esempio n. 4
0
        void ProcessRegion(IParseTO payload, IList <IDev2DataLanguageIntellisensePart> refParts, bool addCompleteParts, StringBuilder tmp, IList <IIntellisenseResult> result, IList <IDev2DataLanguageIntellisensePart> additionalParts = null)
        {
            const bool EmptyOk = false;

            if (payload != null)
            {
                var tmpString = tmp.ToString();
                var parts     = tmpString.Split('.');
                var search    = parts[0].ToLower();
                var rawSearch = search;
                var isRs      = false;

                search = RemoveRecordSetBraces(search, ref isRs);
                if (AddFieldResult(payload, result, tmpString, parts, isRs))
                {
                    return;
                }

                if (parts.Length == 1)
                {
                    MatchNonFieldVariables(payload, refParts, addCompleteParts, tmp, result, additionalParts, isRs, rawSearch, search, EmptyOk, parts);
                }
                else if (parts.Length == 2)
                {
                    MatchFieldVariables(payload, refParts, addCompleteParts, result, parts, isRs, rawSearch, search, EmptyOk);
                }
                else
                {
                    var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], parts[1]);
                    result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, "Invalid Notation - Extra dots detected", enIntellisenseErrorCode.SyntaxError, !payload.HangingOpen));
                }
            }
        }
Esempio n. 5
0
        public void ProcessRecordSetFields(IParseTO payload, bool addCompleteParts, IList <IIntellisenseResult> result, IDev2DataLanguageIntellisensePart t1)
        {
            IDataListVerifyPart part;

            // only add hanging open if we want incomplete parts
            if (!addCompleteParts)
            {
                part = IntellisenseFactory.CreateDataListValidationScalarPart(t1.Name + DataListUtil.RecordsetIndexOpeningBracket, t1.Description + " / Select a specific row or Close");

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            }

            part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t1.Name, "", t1.Description + " / Takes all rows ", "*");
            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));

            part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t1.Name, "", t1.Description + " / Take last row");

            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            // add all children for them
            foreach (IDev2DataLanguageIntellisensePart t in t1.Children)
            {
                part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t1.Name, t.Name, t1.Description + " / Use the field of a Recordset");
                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            }
        }
Esempio n. 6
0
        string ProcessValidPartNameContainingFields(IParseTO payload, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, string search, bool emptyOk, string partName, IDev2DataLanguageIntellisensePart recordsetPart, string display)
        {
            if (partName.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal) >= 0)
            {
                partName = partName.Substring(0, partName.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal));
            }

            if (recordsetPart == null)
            {
                var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(partName, parts[1], "");
                result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, parts[0].Length - 1, part, DataListUtil.OpeningSquareBrackets + display + "]] does not exist in your variable list", enIntellisenseErrorCode.NeitherRecordsetNorFieldFound, !payload.HangingOpen));
            }
            else
            {
                if (recordsetPart.Children != null && recordsetPart.Children.Count > 0 && ProcessFieldsForRecordSet(payload, addCompleteParts, result, parts, out search, out emptyOk, display, recordsetPart, partName))
                {
                    return(search);
                }
            }

            if (result.Count == 0 && !emptyOk)
            {
                var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], search);
                result.Add(char.IsNumber(search[0]) ? IntellisenseFactory.CreateErrorResult(payload.StartIndex, parts[0].Length - 1, part, "Invalid Expression: Recordset Field [ " + search + " ] starts with a number", enIntellisenseErrorCode.SyntaxError, !payload.HangingOpen) : IntellisenseFactory.CreateErrorResult(parts[0].Length, payload.EndIndex, part, "Recordset Field [ " + search + " ] does not exist for [ " + parts[0] + " ]", enIntellisenseErrorCode.FieldNotFound, !payload.HangingOpen));
            }
            return(search);
        }
Esempio n. 7
0
        static void FinalEvaluation(IParseTO payload, StringBuilder tmp, IList <IIntellisenseResult> result, IList <IDev2DataLanguageIntellisensePart> additionalParts, bool isRs)
        {
            var display = tmp.ToString().Replace("]", "");
            IDataListVerifyPart part;

            var code = enIntellisenseErrorCode.RecordsetNotFound;

            if (!isRs)
            {
                code = display.IndexOf(' ') >= 0 ? enIntellisenseErrorCode.SyntaxError : enIntellisenseErrorCode.ScalarNotFound;

                part = IntellisenseFactory.CreateDataListValidationScalarPart(display);
            }
            else
            {
                var start = display.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal);
                display  = display.Substring(0, start);
                display += "()";
                part     = IntellisenseFactory.CreateDataListValidationRecordsetPart(display, "");
            }
            if (additionalParts == null)
            {
                result.Add(!display.Contains(' ') ? IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] does not exist in your variable list", code, !payload.HangingOpen) : IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] contains a space, this is an invalid character for a variable name", code, !payload.HangingOpen));
            }
            else
            {
                if (!additionalParts.Select(a => a.Name).Contains(display))
                {
                    result.Add(!display.Contains(' ') ? IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] does not exist in your variable list", code, !payload.HangingOpen) : IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] contains a space, this is an invalid character for a variable name", code, !payload.HangingOpen));
                }
            }
        }
Esempio n. 8
0
        static bool ProcessForChild(IParseTO payload, IList <IDev2DataLanguageIntellisensePart> refParts, IList <IIntellisenseResult> result, string search, IDev2DataLanguageIntellisensePart t1)
        {
            var emptyOk        = false;
            var isHangingChild = payload.Child != null && payload.Child.HangingOpen;

            if (!payload.IsLeaf && !isHangingChild)
            {
                OpenRecordsetItem(payload, result, t1);
            }
            else
            {
                if (payload.Child == null)
                {
                    IDataListVerifyPart prt;
                    foreach (IDev2DataLanguageIntellisensePart t in refParts.Where(t => t.Children == null))
                    {
                        prt = IntellisenseFactory.CreateDataListValidationRecordsetPart(search, "", " / Select a specific row", DataListUtil.OpeningSquareBrackets + t.Name + DataListUtil.ClosingSquareBrackets);
                        result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, prt, prt.Description));
                    }
                    prt = IntellisenseFactory.CreateDataListValidationRecordsetPart(search, "", " / Reference all rows in the Recordset ", "*");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, prt, prt.Description));
                }
                emptyOk = true;
            }
            return(emptyOk);
        }
Esempio n. 9
0
        static void AddFieldOptions(IParseTO payload, string search, bool addCompleteParts, string match, IDev2DataLanguageIntellisensePart t, IList <IIntellisenseResult> result)
        {
            IDataListVerifyPart part;

            if (!addCompleteParts && match.Contains(search))
            {
                part = IntellisenseFactory.CreateDataListValidationScalarPart(t.Name + DataListUtil.RecordsetIndexOpeningBracket, !string.IsNullOrEmpty(t.Description) ? t.Description : " Select a specific row");

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));

                foreach (IDev2DataLanguageIntellisensePart t1 in t.Children)
                {
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t.Name, t1.Name, !string.IsNullOrEmpty(t1.Description) ? t1.Description : " Input: Use last row, Result: Append new record");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t.Name, t1.Name, !string.IsNullOrEmpty(t1.Description) ? t1.Description : " Use all the rows", "*");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                }
                return;
            }
            foreach (IDev2DataLanguageIntellisensePart t1 in t.Children)
            {
                if (t1.Name.Contains(search))
                {
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t.Name, t1.Name, !string.IsNullOrEmpty(t1.Description) ? t1.Description : " Input: Use last row, Result: Append new record");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t.Name, t1.Name, !string.IsNullOrEmpty(t1.Description) ? t1.Description : " Use all the rows", "*");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                }
            }
        }
Esempio n. 10
0
        void MatchFieldVariables(IParseTO payload, IList <IDev2DataLanguageIntellisensePart> refParts, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, bool isRs, string rawSearch, string search, bool emptyOk)
        {
            var tmpTo = new ParseTO {
                Payload = parts[0], StartIndex = 0, EndIndex = parts[0].Length - 1
            };

            var isRecName = isRs && rawSearch.Contains(DataListUtil.RecordsetIndexOpeningBracket) && rawSearch.EndsWith(DataListUtil.RecordsetIndexClosingBracket);

            const string DisplayString = "Recordset";

            if ((!isRecName || parts[1] == string.Empty) && payload.Child == null)
            {
                if (ValidateName(rawSearch, DisplayString, result, out IList <IIntellisenseResult> intellisenseResults))
                {
                    return;
                }
            }
            else
            {
                if (ValidateName(search, DisplayString, result, out IList <IIntellisenseResult> intellisenseResults))
                {
                    return;
                }
            }

            try
            {
                IsValidIndex(tmpTo);
            }
            catch (Dev2DataLanguageParseError e)
            {
                result.Add(AddErrorToResults(isRs, parts[0], e, !payload.HangingOpen));
            }

            var recordsetPart = refParts.FirstOrDefault(c => c.Name.ToLower() == search && c.Children != null);

            var display  = parts[0];
            var partName = parts[0];
            var start    = display.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal);

            if (start >= 0 && recordsetPart == null)
            {
                display  = display.Substring(0, start);
                display += "()";
            }

            if (partName.IndexOf(' ') < 0)
            {
                search = ProcessValidPartNameContainingFields(payload, addCompleteParts, result, parts, search, emptyOk, partName, recordsetPart, display);
            }
            else
            {
                var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], "." + parts[1], true);
                result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] contains a space, this is an invalid character for a variable name", enIntellisenseErrorCode.SyntaxError, !payload.HangingOpen));
            }
        }
Esempio n. 11
0
 static void AddMissingWorkFlowRecordsetPart(List <IDataListVerifyPart> missingWorkflowParts,
                                             IRecordSetItemModel dataListItem,
                                             IRecordSetFieldItemModel child = null)
 {
     if (dataListItem.IsEditable)
     {
         missingWorkflowParts.Add(child != null ? IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName,
                                                                                                            child.DisplayName, child.Description) : IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName,
                                                                                                                                                                                                              string.Empty, dataListItem.Description));
     }
 }
Esempio n. 12
0
 static void AddIndex(IEnumerable <IDev2DataLanguageIntellisensePart> refParts, IParseTO payload, string search, IList <IIntellisenseResult> result)
 {
     foreach (IDev2DataLanguageIntellisensePart t in refParts)
     {
         if (t.Children == null)
         {
             var prt = IntellisenseFactory.CreateDataListValidationRecordsetPart(search, "", "", DataListUtil.OpeningSquareBrackets + t.Name + DataListUtil.ClosingSquareBrackets);
             result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, prt, prt.Description));
         }
     }
 }
        static IDataListVerifyPart AddField(Dev2DataLanguageParser dataLanguageParser, Dictionary <IDataListVerifyPart, string> unique, IDataListVerifyPart verifyPart, string[] fieldList, bool recAdded, string item)
        {
            // If it's a field to a record set
            var intellisenseResult = dataLanguageParser.ValidateName(item, "");

            if (intellisenseResult == null && recAdded)
            {
                verifyPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(
                    RemoveRecordSetBrace(fieldList.ElementAt(0)), item);
                AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
            }

            return(verifyPart);
        }
 static void AddField(Dev2DataLanguageParser dataLanguageParser, Dictionary <IDataListVerifyPart, string> unique, ref IDataListVerifyPart verifyPart, ref string fullyFormattedStringValue, ref bool recAdded, string item)
 {
     if (item.Contains("("))
     {
         fullyFormattedStringValue = RemoveRecordSetBrace(item);
         var intellisenseResult = dataLanguageParser.ValidateName(fullyFormattedStringValue, "");
         if (intellisenseResult == null)
         {
             recAdded   = true;
             verifyPart =
                 IntellisenseFactory.CreateDataListValidationRecordsetPart(fullyFormattedStringValue,
                                                                           String.Empty);
             AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
         }
     }
 }
Esempio n. 15
0
        public void ProcessNonRecordsetFields(IParseTO payload, IList <IIntellisenseResult> result, IDev2DataLanguageIntellisensePart t1)
        {
            if (payload.Parent != null && payload.Parent.Payload.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal) >= 0)
            {
                var part = IntellisenseFactory.CreateDataListValidationScalarPart(t1.Name, t1.Description + " / Use row at this index");

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            }
            else
            {
                IDataListVerifyPart part;
                part = t1.Name.Contains('(') && t1.Name.Contains(')') ? IntellisenseFactory.CreateDataListValidationRecordsetPart(string.Empty, t1.Name, true) : IntellisenseFactory.CreateDataListValidationScalarPart(t1.Name, t1.Description);

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            }
        }
Esempio n. 16
0
        static void ReturnFieldMatchForRecordSet(IParseTO payload, IList <IIntellisenseResult> result, IDev2DataLanguageIntellisensePart t1)
        {
            var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t1.Name, "", t1.Description);

            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
            var children = t1.Children;

            if (children != null)
            {
                foreach (IDev2DataLanguageIntellisensePart t in children)
                {
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(t1.Name, t.Name, t.Description + " / Use a field of the Recordset");
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                }
            }
        }
Esempio n. 17
0
        public bool AddRecordSetIndex(IParseTO payload, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, IDev2DataLanguageIntellisensePart t1, bool emptyOk)
        {
            if (addCompleteParts)
            {
                var idx    = DataListUtil.ExtractIndexRegionFromRecordset(parts[0]);
                var recset = DataListUtil.ExtractRecordsetNameFromValue(parts[0]);

                var p = IntellisenseFactory.CreateDataListValidationRecordsetPart(recset, string.Empty, t1.Description, payload.Child != null ? payload.Child.Payload : idx);

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, p, p.Description));
            }
            else
            {
                emptyOk = true;
            }
            return(emptyOk);
        }
Esempio n. 18
0
        public IEnumerable <IDataListVerifyPart> MissingRecordsets(IList <IDataListVerifyPart> partsToVerify, bool excludeUnusedItems)
        {
            var missingWorkflowParts = new List <IDataListVerifyPart>();

            foreach (var dataListItem in _recsetCollection.Where(model => !string.IsNullOrEmpty(model.DisplayName)))
            {
                if (dataListItem.Children.Count > 0)
                {
                    if (partsToVerify.Count(part => part.Recordset == dataListItem.DisplayName) == 0 &&
                        dataListItem.IsEditable)
                    {
                        if (excludeUnusedItems && !dataListItem.IsUsed)
                        {
                            continue;
                        }
                        AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem);
                        foreach (var child in dataListItem.Children.Where(p => !string.IsNullOrEmpty(p.DisplayName)))
                        {
                            AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem, child);
                        }
                    }
                    else
                    {
                        missingWorkflowParts.AddRange(
                            from child in dataListItem.Children
                            where partsToVerify.Count(part => child.Parent != null && part.Field == child.DisplayName && part.Recordset == child.Parent.DisplayName) == 0 && child.IsEditable
                            where !excludeUnusedItems || dataListItem.IsUsed
                            select IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName, child.DisplayName, child.Description));
                    }
                }
                else if (partsToVerify.Count(part => part.Field == dataListItem.DisplayName && part.IsScalar) == 0 &&
                         dataListItem.IsEditable)
                {
                    // skip it if unused and exclude is on ;)
                    if (excludeUnusedItems && !dataListItem.IsUsed)
                    {
                        continue;
                    }
                    missingWorkflowParts.Add(
                        IntellisenseFactory.CreateDataListValidationScalarPart(dataListItem.DisplayName,
                                                                               dataListItem.Description));
                }
            }
            return(missingWorkflowParts);
        }
Esempio n. 19
0
 private static void AddIsEditablePartsToVerify(IList <IDataListVerifyPart> partsToVerify, List <IDataListVerifyPart> missingWorkflowParts, IRecordSetItemModel dataListItem)
 {
     if (!partsToVerify.Any(part => part.Recordset == dataListItem.DisplayName) && dataListItem.IsEditable)
     {
         AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem);
         foreach (var child in dataListItem.Children.Where(p => !string.IsNullOrEmpty(p.DisplayName)))
         {
             AddMissingWorkFlowRecordsetPart(missingWorkflowParts, dataListItem, child);
         }
     }
     else
     {
         missingWorkflowParts.AddRange(
             from child in dataListItem.Children
             where !partsToVerify.Any(part => child.Parent != null && part.Field == child.DisplayName && part.Recordset == child.Parent.DisplayName) && child.IsEditable
             select IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.DisplayName, child.DisplayName, child.Description));
     }
 }
Esempio n. 20
0
        static void MatchChildren(IParseTO payload, IList <IIntellisenseResult> result, string search, IDev2DataLanguageIntellisensePart pt)
        {
            pt.Children?.ToList().ForEach(child =>
            {
                var match = child.Name.ToLower();

                if (match.Contains(search))
                {
                    var resultPt = IntellisenseFactory.CreateDataListValidationRecordsetPart(pt.Name, child.Name, pt.Description + " / " + child.Description + " Select this recordset field field");
                    var tmpChild = IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, resultPt, resultPt.Description);

                    if (result
                        .ToList()
                        .Find(r => r.Option.DisplayValue == tmpChild.Option.DisplayValue) == null)
                    {
                        result.Add(tmpChild);
                    }
                }
            });
        }
Esempio n. 21
0
        public IIntellisenseResult AddErrorToResults(bool isRs, string part, IDev2DataLangaugeParseError dev2DataLanguageParseError, bool isOpen)
        {
            // add error
            IDataListVerifyPart pTo;

            if (isRs)
            {
                var start = part.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal);
                var rs    = part;
                if (start >= 0)
                {
                    rs = rs.Substring(0, start);
                }
                pTo = IntellisenseFactory.CreateDataListValidationRecordsetPart(rs, "", "");
            }
            else
            {
                pTo = IntellisenseFactory.CreateDataListValidationScalarPart(part.Replace("]", ""));
            }

            return(IntellisenseFactory.CreateErrorResult(dev2DataLanguageParseError.StartIndex, dev2DataLanguageParseError.EndIndex, pTo, dev2DataLanguageParseError.Message, dev2DataLanguageParseError.ErrorCode, isOpen));
        }
Esempio n. 22
0
        public bool ProcessFieldsForRecordSet(IParseTO payload, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, out string search, out bool emptyOk, string display, IDev2DataLanguageIntellisensePart recordsetPart, string partName)
        {
            emptyOk = false;
            search  = "";
            if (parts[0].IndexOf(DataListUtil.RecordsetIndexClosingBracket, StringComparison.Ordinal) <= 0)
            {
                // its an error ;)
                var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], "." + parts[1], true);
                result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] is a malformed recordset", enIntellisenseErrorCode.InvalidRecordsetNotation, !payload.HangingOpen));
            }
            else
            {
                search = parts[1].ToLower();
                var intellisenseResult = ValidateName(search, "Recordset field");
                if (intellisenseResult != null)
                {
                    result.Add(intellisenseResult);
                    return(true);
                }
                foreach (IDev2DataLanguageIntellisensePart t in recordsetPart.Children)
                {
                    var match = t.Name.ToLower();
                    if (match.Contains(search) && ((match != search) || (match == search && addCompleteParts)))
                    {
                        var index = payload.Child != null ? payload.Child.Payload : DataListUtil.ExtractIndexRegionFromRecordset(parts[0]);

                        var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(partName, t.Name, t.Description, index);
                        result.Add(IntellisenseFactory.CreateSelectableResult(parts[0].Length, payload.EndIndex, part, part.Description));
                    }
                    else
                    {
                        ShouldUpdateEmptyOk(search, ref emptyOk, match);
                    }
                }
            }
            return(false);
        }
Esempio n. 23
0
        public void OpenRecordsetItem(IParseTO payload, IList <IIntellisenseResult> result, IDev2DataLanguageIntellisensePart t1)
        {
            if (payload.Child != null)
            {
                var indx = payload.Child.Payload;
                var end  = indx.IndexOf(DataListUtil.RecordsetIndexClosingBracket, StringComparison.Ordinal);
                if (end > 0)
                {
                    // malformed index -- correct it
                    indx = indx.Substring(0, end);
                }

                indx = DataListUtil.AddBracketsToValueIfNotExist(indx);

                var rs = payload.Payload;
                end = rs.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal);
                if (end > 0)
                {
                    rs = rs.Substring(0, end);
                }

                var prt = IntellisenseFactory.CreateDataListValidationRecordsetPart(rs, "", " / Select a specific row", indx);

                result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, prt, prt.Description));

                // now add all fields to collection too ;)
                if (t1.Children != null)
                {
                    var cParts = t1.Children;
                    foreach (IDev2DataLanguageIntellisensePart t in cParts)
                    {
                        prt = IntellisenseFactory.CreateDataListValidationRecordsetPart(rs, t.Name, " / Select a specific row", indx);
                        result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, prt, prt.Description));
                    }
                }
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Finds the missing workflow data regions.
        /// </summary>
        /// <param name="partsToVerify">The parts to verify.</param>
        /// <param name="excludeUnusedItems"></param>
        /// <returns></returns>
        public List <IDataListVerifyPart> MissingWorkflowItems(IList <IDataListVerifyPart> partsToVerify, bool excludeUnusedItems = false)
        {
            var missingWorkflowParts = new List <IDataListVerifyPart>();

            if (DataList != null)
            {
                foreach (var dataListItem in DataList)
                {
                    if (String.IsNullOrEmpty(dataListItem.Name))
                    {
                        continue;
                    }
                    if ((dataListItem.Children.Count > 0))
                    {
                        if (partsToVerify.Count(part => part.Recordset == dataListItem.Name) == 0)
                        {
                            //19.09.2012: massimo.guerrera - Added in the description to creating the part
                            if (dataListItem.IsEditable)
                            {
                                // skip it if unused and exclude is on ;)
                                if (excludeUnusedItems && !dataListItem.IsUsed)
                                {
                                    continue;
                                }
                                missingWorkflowParts.Add(
                                    IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.Name,
                                                                                              String.Empty,
                                                                                              dataListItem.Description));
                                // ReSharper disable LoopCanBeConvertedToQuery
                                foreach (var child in dataListItem.Children)
                                // ReSharper restore LoopCanBeConvertedToQuery
                                {
                                    if (!(String.IsNullOrEmpty(child.Name)))
                                    {
                                        //19.09.2012: massimo.guerrera - Added in the description to creating the part
                                        if (dataListItem.IsEditable)
                                        {
                                            missingWorkflowParts.Add(
                                                IntellisenseFactory.CreateDataListValidationRecordsetPart(
                                                    dataListItem.Name, child.Name, child.Description));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            // ReSharper disable LoopCanBeConvertedToQuery
                            foreach (var child in dataListItem.Children)
                            {
                                // ReSharper restore LoopCanBeConvertedToQuery
                                if (partsToVerify.Count(part => part.Field == child.Name && part.Recordset == child.Parent.Name) == 0)
                                {
                                    //19.09.2012: massimo.guerrera - Added in the description to creating the part
                                    if (child.IsEditable)
                                    {
                                        // skip it if unused and exclude is on ;)
                                        if (excludeUnusedItems && !dataListItem.IsUsed)
                                        {
                                            continue;
                                        }

                                        missingWorkflowParts.Add(IntellisenseFactory.CreateDataListValidationRecordsetPart(dataListItem.Name, child.Name, child.Description));
                                    }
                                }
                            }
                        }
                    }
                    else if (partsToVerify.Count(part => part.Field == dataListItem.Name) == 0)
                    {
                        if (dataListItem.IsEditable)
                        {
                            // skip it if unused and exclude is on ;)
                            if (excludeUnusedItems && !dataListItem.IsUsed)
                            {
                                continue;
                            }

                            //19.09.2012: massimo.guerrera - Added in the description to creating the part
                            missingWorkflowParts.Add(
                                IntellisenseFactory.CreateDataListValidationScalarPart(dataListItem.Name,
                                                                                       dataListItem.Description));
                        }
                    }
                }
            }

            return(missingWorkflowParts);
        }
        public static void BuildDataPart(string dataPartFieldData, Dictionary <IDataListVerifyPart, string> unique)
        {
            Dev2DataLanguageParser dataLanguageParser = new Dev2DataLanguageParser();

            dataPartFieldData = DataListUtil.StripBracketsFromValue(dataPartFieldData);
            IDataListVerifyPart verifyPart;
            string fullyFormattedStringValue;

            string[] fieldList = dataPartFieldData.Split('.');
            if (fieldList.Count() > 1 && !String.IsNullOrEmpty(fieldList[0]))
            {
                // If it's a RecordSet Containing a field
                bool recAdded = false;

                foreach (var item in fieldList)
                {
                    if (item.EndsWith(")") && item == fieldList[0])
                    {
                        if (item.Contains("("))
                        {
                            fullyFormattedStringValue = RemoveRecordSetBrace(item);
                            var intellisenseResult = dataLanguageParser.ValidateName(fullyFormattedStringValue, "");
                            if (intellisenseResult == null)
                            {
                                recAdded   = true;
                                verifyPart =
                                    IntellisenseFactory.CreateDataListValidationRecordsetPart(fullyFormattedStringValue,
                                                                                              String.Empty);
                                AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
                            }
                        }
                    }
                    else if (item == fieldList[1] && !(item.EndsWith(")") && item.Contains(")")))
                    {
                        // If it's a field to a record set
                        var intellisenseResult = dataLanguageParser.ValidateName(item, "");
                        if (intellisenseResult == null && recAdded)
                        {
                            verifyPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(
                                RemoveRecordSetBrace(fieldList.ElementAt(0)), item);
                            AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else if (fieldList.Count() == 1 && !String.IsNullOrEmpty(fieldList[0]))
            {
                // If the workflow field is simply a scalar or a record set without a child
                if (dataPartFieldData.EndsWith(")") && dataPartFieldData == fieldList[0])
                {
                    if (dataPartFieldData.Contains("("))
                    {
                        fullyFormattedStringValue = RemoveRecordSetBrace(fieldList[0]);
                        var intellisenseResult = dataLanguageParser.ValidateName(fullyFormattedStringValue, "");
                        if (intellisenseResult == null)
                        {
                            verifyPart = IntellisenseFactory.CreateDataListValidationRecordsetPart(fullyFormattedStringValue, String.Empty);
                            AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
                        }
                    }
                }
                else
                {
                    var intellisenseResult = dataLanguageParser.ValidateName(dataPartFieldData, "");
                    if (intellisenseResult == null)
                    {
                        verifyPart = IntellisenseFactory.CreateDataListValidationScalarPart(RemoveRecordSetBrace(dataPartFieldData));
                        AddDataVerifyPart(verifyPart, verifyPart.DisplayValue, unique);
                    }
                }
            }
        }