コード例 #1
0
        private async Task EnsembleTask()
        {
            List <StatisticalResultCsv> selectedMembers = new List <StatisticalResultCsv>();

            for (int i = 0; i < candidateDataGridView.SelectedRows.Count; i++)
            {
                StatisticalResultCsv item = (StatisticalResultCsv)candidateDataGridView.SelectedRows[i].DataBoundItem;
                selectedMembers.Add(item);
            }
            int keep = 0;

            int.TryParse(keepNumericUpDown.Text, out keep);
            NameAlias na = (NameAlias)ensembleMethodcomboBox.SelectedItem;

            CSEnsemble.Run(ensembleNameTextBox.Text, na.Alias, keSelector.K, keep, selectedMembers);
        }
コード例 #2
0
    private void setParameters()
    {
        _defaultHTMLName = "";
        _IsTextBox       = false;
        _IsDropDownList  = false;
        _IsCheckBox      = false;
        _IsDate          = false;
        _IsInteger       = false;
        _IsDouble        = false;
        if (_parameterType != null)
        {
            switch (_parameterType.Name().ToLower())
            {
            case "string": {
                // textbox
                // _defaultHTMLName = "txt" & Name
                _defaultHTMLName = getControlNameControl("txt", Name);
                _IsTextBox       = true;
                break;
            }

            case "integer":
            case "int16":
            case "int64":
            case "byte": {
                _defaultHTMLName = getControlNameControl("txt", Name);
                _IsTextBox       = true;
                _IsInteger       = true;
                break;
            }

            case "double": {
                _defaultHTMLName = getControlNameControl("txt", Name);
                _IsTextBox       = true;
                _IsDouble        = true;
                break;
            }

            case "boolean": {
                _defaultHTMLName = getControlNameControl("chk", Name);
                _IsCheckBox      = true;
                break;
            }

            case "datetime":
            case "date": {
                _IsDate = true;
                break;
            }

            case "namealias": {
                _IsTextBox       = true;
                _defaultHTMLName = getControlNameControl("txt", Name);
                break;
            }

            default: {
                // dropdownlist
                _IsDropDownList = true;
                NameAlias myAlias = new NameAlias(Name);
                // _defaultHTMLName = "ddl" & myAlias.PluralAndCapitalized
                _defaultHTMLName      = getControlNameControl("ddl", myAlias.PluralAndCapitalized);
                _IsPropertyXMLIgnored = true;
                break;
            }
            }
        }
    }
コード例 #3
0
        public PsetProperty getPropertyDef(XNamespace ns, XElement pDef)
        {
            PsetProperty prop = new PsetProperty();

            if (pDef.Attribute("ifdguid") != null)
            {
                prop.IfdGuid = pDef.Attribute("ifdguid").Value;
            }
            prop.Name = pDef.Element(ns + "Name").Value;
            IList <NameAlias> aliases      = new List <NameAlias>();
            XElement          nAliasesElem = pDef.Elements(ns + "NameAliases").FirstOrDefault();

            if (nAliasesElem != null)
            {
                var nAliases = from el in nAliasesElem.Elements(ns + "NameAlias") select el;
                foreach (XElement alias in nAliases)
                {
                    NameAlias nameAlias = new NameAlias();
                    nameAlias.Alias = alias.Value;
                    nameAlias.lang  = alias.Attribute("lang").Value;
                    aliases.Add(nameAlias);
                }
            }
            if (aliases.Count > 0)
            {
                prop.NameAliases = aliases;
            }

            PropertyDataType dataTyp = null;
            var      propType        = pDef.Elements(ns + "PropertyType").FirstOrDefault();
            XElement propDetType     = propType.Elements().FirstOrDefault();

            if (propDetType == null)
            {
#if DEBUG
                logF.WriteLine("%Warning: Missing PropertyType for {0}.{1}", pDef.Parent.Parent.Element(ns + "Name").Value, prop.Name);
#endif
                return(prop);
            }

            if (propDetType.Name.LocalName.Equals("TypePropertySingleValue"))
            {
                XElement            dataType = propDetType.Element(ns + "DataType");
                PropertySingleValue sv       = new PropertySingleValue();
                if (dataType.Attribute("type") != null)
                {
                    sv.DataType = dataType.Attribute("type").Value;
                }
                else
                {
                    sv.DataType = "IfcLabel"; // Set this to default if missing
#if DEBUG
                    logF.WriteLine("%Warning: Missing TypePropertySingleValue for {0}.{1}", pDef.Parent.Parent.Element(ns + "Name").Value, prop.Name);
#endif
                }
                dataTyp = sv;
            }
            else if (propDetType.Name.LocalName.Equals("TypePropertyReferenceValue"))
            {
                PropertyReferenceValue rv = new PropertyReferenceValue();
                // Older versions uses Element DataType!
                XElement dt = propDetType.Element(ns + "DataType");
                if (dt == null)
                {
                    rv.RefEntity = propDetType.Attribute("reftype").Value;
                }
                else
                {
                    rv.RefEntity = dt.Attribute("type").Value;
                }
                dataTyp = rv;
            }
            else if (propDetType.Name.LocalName.Equals("TypePropertyEnumeratedValue"))
            {
                PropertyEnumeratedValue pev = new PropertyEnumeratedValue();
                var enumItems = propDetType.Descendants(ns + "EnumItem");
                if (enumItems.Count() > 0)
                {
                    pev.Name    = propDetType.Element(ns + "EnumList").Attribute("name").Value;
                    pev.EnumDef = new List <PropertyEnumItem>();
                    foreach (var en in enumItems)
                    {
                        string enumItemName            = en.Value.ToString();
                        IEnumerable <XElement> consDef = null;
                        if (propDetType.Element(ns + "ConstantList") != null)
                        {
                            consDef = from el in propDetType.Element(ns + "ConstantList").Elements(ns + "ConstantDef")
                                      where (el.Element(ns + "Name").Value.Equals(enumItemName, StringComparison.CurrentCultureIgnoreCase))
                                      select el;
                        }

                        if (propDetType.Element(ns + "ConstantList") != null)
                        {
                            var consList = propDetType.Element(ns + "ConstantList").Elements(ns + "ConstantDef");
                            if (consList != null && consList.Count() != enumItems.Count())
                            {
#if DEBUG
                                logF.WriteLine("%Warning: EnumList (" + enumItems.Count().ToString() + ") is not consistent with the ConstantList ("
                                               + consList.Count().ToString() + ") for: {0}.{1}",
                                               pDef.Parent.Parent.Element(ns + "Name").Value, prop.Name);
#endif
                            }
                        }

                        if (consDef != null && consDef.Count() > 0)
                        {
                            foreach (var cD in consDef)
                            {
                                PropertyEnumItem enumItem = new PropertyEnumItem();
                                enumItem.EnumItem = cD.Elements(ns + "Name").FirstOrDefault().Value;
                                enumItem.Aliases  = new List <NameAlias>();
                                var eAliases = from el in cD.Elements(ns + "NameAliases").FirstOrDefault().Elements(ns + "NameAlias") select el;
                                if (eAliases.Count() > 0)
                                {
                                    foreach (var aliasItem in eAliases)
                                    {
                                        NameAlias nal = new NameAlias();
                                        nal.Alias = aliasItem.Value;
                                        nal.lang  = aliasItem.Attribute("lang").Value;
                                        enumItem.Aliases.Add(nal);
                                    }
                                }
                                pev.EnumDef.Add(enumItem);
                            }
                        }
                        else
                        {
                            PropertyEnumItem enumItem = new PropertyEnumItem();
                            enumItem.EnumItem = enumItemName;
                            enumItem.Aliases  = new List <NameAlias>();
                            pev.EnumDef.Add(enumItem);
                        }
                    }
                }
                else
                {
                    {
#if DEBUG
                        logF.WriteLine("%Warning: EnumList {0}.{1} is empty!", pDef.Parent.Parent.Element(ns + "Name").Value, prop.Name);
#endif
                    }
                    // If EnumList is empty, try to see whether ConstantDef has values. The Enum item name will be taken from the ConstantDef.Name
                    pev.Name    = "PEnum_" + prop.Name;
                    pev.EnumDef = new List <PropertyEnumItem>();
                    var consDef = from el in propDetType.Element(ns + "ConstantList").Elements(ns + "ConstantDef")
                                  select el;
                    if (consDef != null && consDef.Count() > 0)
                    {
                        foreach (var cD in consDef)
                        {
                            PropertyEnumItem enumItem = new PropertyEnumItem();
                            enumItem.EnumItem = cD.Elements(ns + "Name").FirstOrDefault().Value;
                            enumItem.Aliases  = new List <NameAlias>();
                            var eAliases = from el in cD.Elements(ns + "NameAliases").FirstOrDefault().Elements(ns + "NameAlias") select el;
                            if (eAliases.Count() > 0)
                            {
                                foreach (var aliasItem in eAliases)
                                {
                                    NameAlias nal = new NameAlias();
                                    nal.Alias = aliasItem.Value;
                                    nal.lang  = aliasItem.Attribute("lang").Value;
                                    enumItem.Aliases.Add(nal);
                                }
                            }
                            pev.EnumDef.Add(enumItem);
                        }
                    }
                }
                dataTyp = pev;
            }
            else if (propDetType.Name.LocalName.Equals("TypePropertyBoundedValue"))
            {
                XElement             dataType = propDetType.Element(ns + "DataType");
                PropertyBoundedValue bv       = new PropertyBoundedValue();
                bv.DataType = dataType.Attribute("type").Value;
                dataTyp     = bv;
            }
            else if (propDetType.Name.LocalName.Equals("TypePropertyListValue"))
            {
                XElement          dataType = propDetType.Descendants(ns + "DataType").FirstOrDefault();
                PropertyListValue lv       = new PropertyListValue();
                lv.DataType = dataType.Attribute("type").Value;
                dataTyp     = lv;
            }
            else if (propDetType.Name.LocalName.Equals("TypePropertyTableValue"))
            {
                PropertyTableValue tv = new PropertyTableValue();
                var tve = propDetType.Element(ns + "Expression");
                if (tve != null)
                {
                    tv.Expression = tve.Value;
                }
                XElement el = propDetType.Element(ns + "DefiningValue");
                if (el != null)
                {
                    XElement el2 = propDetType.Element(ns + "DefiningValue").Element(ns + "DataType");
                    if (el2 != null)
                    {
                        tv.DefiningValueType = el2.Attribute("type").Value;
                    }
                }
                el = propDetType.Element(ns + "DefinedValue");
                if (el != null)
                {
                    XElement el2 = propDetType.Element(ns + "DefinedValue").Element(ns + "DataType");
                    if (el2 != null)
                    {
                        tv.DefinedValueType = el2.Attribute("type").Value;
                    }
                }
                dataTyp = tv;
            }
            else if (propDetType.Name.LocalName.Equals("TypeComplexProperty"))
            {
                ComplexProperty compProp = new ComplexProperty();
                compProp.Name       = propDetType.Attribute("name").Value;
                compProp.Properties = new List <PsetProperty>();
                foreach (XElement cpPropDef in propDetType.Elements(ns + "PropertyDef"))
                {
                    PsetProperty pr = getPropertyDef(ns, cpPropDef);
                    if (pr == null)
                    {
#if DEBUG
                        logF.WriteLine("%Error: Mising PropertyType data in complex property {0}.{1}.{2}", propDetType.Parent.Parent.Element(ns + "Name").Value,
                                       prop.Name, cpPropDef.Element(ns + "Name").Value);
#endif
                    }
                    else
                    {
                        compProp.Properties.Add(pr);
                    }
                }
                dataTyp = compProp;
            }
            prop.PropertyType = dataTyp;

            return(prop);
        }
コード例 #4
0
    // Private Function getViewHeader(ByVal pClass As ProjectClass, lang As language) As String
    // Dim codeExt As String = "vb"
    // If lang = language.CSharp Then codeExt = "cs"
    // Dim headerValue As String = "<%@ Page Title="""" Language=""VB"" MasterPageFile=""~/" & _
    // pClass.MasterPage.FileName & """ AutoEventWireup=""false"" CodeFile=""~/" & pClass.Name.PluralAndCapitalized & ".aspx." & codeExt _
    // & """ Inherits=""" & pClass.Name.PluralAndCapitalized & """ %>" & vbCrLf
    // Return headerValue
    // End Function
    private string generateEditBody(ProjectClass pClass, bool useLists, language lang)
    {
        string        formTag        = useLists ? "ul": "div";
        string        rowTag         = useLists ? "li": "div";
        string        rowBtnOpenTag  = useLists ? "": "<div>";
        string        rowBtnCloseTag = useLists ? "": "</div>";
        StringBuilder retStrB        = new StringBuilder();

        retStrB.AppendLine("<" + formTag + " class=\"form\">");
        foreach (ClassVariable classVar in pClass.ClassVariables)
        {
            if (!classVar.DisplayOnEditPage)
            {
                continue;
            }
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "<" + rowTag + ">");
            retStrB.Append(Strings.Space((int)tab.XXX) + "<asp:Label ID=\"lbl" + (classVar.Name.ToLower().CompareTo("subtitle") == 0 ? pClass.Name.ToString() : "")
                           + classVar.Name + "\" runat=\"server\" AssociatedControlID=\"");
            if (classVar.IsInteger || classVar.IsDouble)
            {
                // Small textBox: class= number
                retStrB.AppendLine(classVar.DefaultHTMLName + "\">" + classVar.Name + "</asp:Label>");
                retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:TextBox ID=\"" + classVar.DefaultHTMLName + "\" runat=\"server\" CssClass=\"number\"></asp:TextBox>");
            }
            else if (classVar.IsCheckBox)
            {
                // CheckBox
                retStrB.AppendLine(classVar.DefaultHTMLName + "\">" + classVar.Name + "</asp:Label>");
                retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:CheckBox ID=\"" + classVar.DefaultHTMLName + "\" runat=\"server\"></asp:CheckBox>");
            }
            else if (classVar.IsDate)
            {
                // three textboxes (day,month,year)
                retStrB.AppendLine(classVar.GetMonthTextControlName() + "\">" + classVar.Name + "</asp:Label>");
                retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:Panel ID=\"pnl" + classVar.Name + "Date\" runat=\"server\">");
                retStrB.AppendLine(Strings.Space((int)tab.XXXX) + "<asp:TextBox ID=\"" + classVar.GetMonthTextControlName()
                                   + "\" runat=\"server\" CssClass=\"number\"></asp:TextBox>");
                retStrB.AppendLine(Strings.Space((int)tab.XXXX) + "<asp:TextBox ID=\"" + classVar.getDayTextControlName()
                                   + "\" runat=\"server\" CssClass=\"number\"></asp:TextBox>");
                retStrB.AppendLine(Strings.Space((int)tab.XXXX) + "<asp:TextBox ID=\"" + classVar.getYearTextControlName()
                                   + "\" runat=\"server\" CssClass=\"number\"></asp:TextBox>");
                retStrB.AppendLine(Strings.Space((int)tab.XXX) + "</asp:Panel>");
            }
            else if (classVar.IsTextBox)
            {
                if (classVar.ParameterType.Name().ToLower() == "namealias")
                {
                    retStrB.AppendLine("txt" + classVar.Name + "\">" + classVar.Name + "</asp:Label>");
                    retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:TextBox ID=\"txt" + classVar.Name + "\" runat=\"server\"></asp:TextBox>");
                }
                else
                {
                    // textbox
                    if (classVar.DefaultHTMLName.CompareTo("lblsubtitle") == 0)
                    {
                        retStrB.AppendLine(ClassGenerator.getSystemUniqueName(classVar.DefaultHTMLName) + "\">" + classVar.Name + "</asp:Label>");
                    }
                    else
                    {
                        retStrB.AppendLine(classVar.DefaultHTMLName + "\">" + classVar.Name + "</asp:Label>");
                    }
                    retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:TextBox ID=\"" + classVar.DefaultHTMLName + "\" runat=\"server\"></asp:TextBox>");
                }
            }
            else
            {
                // dropdownlist
                NameAlias myAlias = new NameAlias(classVar.Name);
                retStrB.AppendLine(classVar.DefaultHTMLName + "\">" + myAlias.PluralAndCapitalized + "</asp:Label>");
                retStrB.AppendLine(Strings.Space((int)tab.XXX) + "<asp:DropDownList ID=\"" + classVar.DefaultHTMLName + "\" runat=\"server\"></asp:DropDownList>");
            }
            retStrB.AppendLine(Strings.Space((int)tab.XX) + "</" + rowTag + ">");
        }
        retStrB.AppendLine(Strings.Space((int)tab.XX) + "<" + rowTag + " class=\"buttons\">");
        retStrB.AppendLine(Strings.Space((int)tab.XXX) + rowBtnOpenTag + "<asp:Button ID=\"btnSaveChanges\" runat=\"server\" Text=\"Save Changes\" "
                           + cg.GetByLanguage(lang, "", "OnClick=\"btnSaveChanges_Click\" ").ToString() + "/>" + rowBtnCloseTag);
        retStrB.AppendLine(Strings.Space((int)tab.XXX) + rowBtnOpenTag + "<asp:Button ID=\"btnCancel\" runat=\"server\" Text=\"Cancel\" "
                           + cg.GetByLanguage(lang, "", "OnClick=\"btnCancel_Click\" ").ToString() + "/>" + rowBtnCloseTag);
        retStrB.AppendLine(Strings.Space((int)tab.XX) + "</" + rowTag + ">");
        retStrB.AppendLine(Strings.Space((int)tab.X) + "</" + formTag + ">");
        return(retStrB.ToString());
    }
コード例 #5
0
    private string getFillFormForEdit(ProjectClass pClass, language lang)
    {
        StringBuilder strB    = new StringBuilder();
        char          lineEnd = ' ';
        char          conCat  = '&';

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Sub fillForm(ByVal my" + pClass.Name.Capitalized() + " As "
                            + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.XX) + "If my" + pClass.Name.Capitalized() + ".ID = -1 Then ");
        }
        else
        {
            lineEnd = ';';
            conCat  = '+';
            strB.AppendLine(Strings.Space((int)tab.X) + "private void fillForm(" + pClass.NameSpaceVariable.NameBasedOnID
                            + "." + pClass.Name.Capitalized() + " my" + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "if (my" + pClass.Name.Capitalized() + ".ID = -1)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
        }
        strB.AppendLine(Strings.Space((int)tab.XXX) + "btnSaveChanges.Text = AliasGroup.Add.Capitalized()" + lineEnd);
        strB.AppendLine(Strings.Space((int)tab.XXX) + "litTitle.Text = AliasGroup.Add.Capitalized() " + conCat
                        + " \" \"  & AliasGroup." + pClass.Name.Capitalized() + ".Capitalized()" + lineEnd);
        strB.AppendLine(Strings.Space((int)tab.XXX) + "lblSubTitle.Text=litTitle.Text" + lineEnd);

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "Else");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "else");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
        }

        strB.AppendLine(Strings.Space((int)tab.XXX) + "litTitle.Text = AliasGroup.Edit.Capitalized() " + conCat
                        + " \" \" " + conCat + " AliasGroup." + pClass.Name.Capitalized() + ".Capitalized()" + lineEnd);
        strB.AppendLine(Strings.Space((int)tab.XXX) + "lblSubTitle.Text=litTitle.Text" + lineEnd);
        foreach (ClassVariable classVar in pClass.ClassVariables)
        {
            if (!classVar.DisplayOnEditPage)
            {
                continue;
            }
            if (classVar.IsTextBox)
            {
                strB.Append(Strings.Space((int)tab.XXX) + "txt" + classVar.Name + ".Text = my" + pClass.Name.Capitalized() + "." + classVar.Name);
                if (classVar.IsDouble || classVar.IsInteger)
                {
                    strB.Append(".ToString()");
                }
                else if (classVar.ParameterType.IsNameAlias)
                {
                    strB.Append(".TextUnFormatted");
                }
                strB.AppendLine(lineEnd.ToString());
            }
            else if (classVar.IsCheckBox)
            {
                strB.AppendLine(Strings.Space((int)tab.XXX) + classVar.DefaultHTMLName + ".Checked = my" + pClass.Name.Capitalized() + "." + classVar.Name + lineEnd);
            }
            else if (classVar.IsDate)
            {
                strB.AppendLine(Strings.Space((int)tab.XXX) + classVar.GetMonthTextControlName() + ".Text = my" + pClass.Name.Capitalized() + "." + classVar.Name + ".Month.ToString()" + lineEnd);
                strB.AppendLine(Strings.Space((int)tab.XXX) + classVar.getDayTextControlName() + ".Text = my" + pClass.Name.Capitalized() + "." + classVar.Name + ".Day.ToString()" + lineEnd);
                strB.AppendLine(Strings.Space((int)tab.XXX) + classVar.getYearTextControlName() + ".Text = my" + pClass.Name.Capitalized() + "." + classVar.Name + ".Year.ToString()" + lineEnd);
            }
            else if (classVar.IsDropDownList)
            {
                NameAlias tempAlias = new NameAlias(classVar.ParameterType.Name().ToLower());
                if (lang == language.VisualBasic)
                {
                    strB.AppendLine(Strings.Space((int)tab.XXX) + "For Each tempObject As " + pClass.NameSpaceVariable.NameBasedOnID
                                    + "." + classVar.ParameterType.Name() + " In " + pClass.NameSpaceVariable.NameBasedOnID + "."
                                    + pClass.DALClassVariable.Name + ".Get" + tempAlias.PluralAndCapitalized + "()");
                }
                else
                {
                    strB.AppendLine(Strings.Space((int)tab.XXX) + "foreach (" + pClass.NameSpaceVariable.NameBasedOnID + "."
                                    + classVar.ParameterType.Name() + " tempObject in " + pClass.NameSpaceVariable.NameBasedOnID + "."
                                    + pClass.DALClassVariable.Name + ".Get" + tempAlias.PluralAndCapitalized + "())");
                    strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
                }
                strB.Append(Strings.Space((int)tab.XXXX) + classVar.DefaultHTMLName + ".Items.Add(new ListItem(tempObject.");
                if (classVar.ParentClass != null)
                {
                    string valName = "";
                    string txtName = "";
                    if (classVar.ParentClass.ValueVariable != null)
                    {
                        valName = classVar.ParentClass.ValueVariable.Name + ".";
                    }
                    if (classVar.ParentClass.TextVariable != null)
                    {
                        valName = classVar.ParentClass.TextVariable.Name + ".";
                    }
                    strB.AppendLine(txtName + "ToString(), tempObject." + valName + "ToString()))" + lineEnd);
                }
                else if (classVar.ParameterType.AssociatedProjectClass != null)
                {
                    strB.AppendLine(classVar.ParameterType.AssociatedProjectClass.TextVariable.Name + ".ToString(), tempObject." + classVar.ParentClass.ValueVariable.Name + ".ToString()))" + lineEnd);
                }
                else
                {
                    strB.AppendLine("Name.ToString(), tempObject.test.ToString()))" + lineEnd);
                }
                if (lang == language.VisualBasic)
                {
                    strB.AppendLine(Strings.Space((int)tab.XXX) + "Next");
                }
                else
                {
                    strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
                }
                strB.AppendLine(Strings.Space((int)tab.XXX) + classVar.DefaultHTMLName + ".SelectedValue = my" + pClass.Name.Capitalized() + "." + classVar.Name + "ID.ToString()" + lineEnd);
            }
        }
        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "End If ");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Sub");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();

        return(strB.ToString());
    }
コード例 #6
0
ファイル: NameGeneration.cs プロジェクト: cjheath/NORMA
					public static bool Populate(NameAlias alias, int remainingParts, out RecognizedPhraseData phraseData)
					{
						phraseData = new RecognizedPhraseData();
						string matchPhrase = ((RecognizedPhrase)alias.Element).Name;
						string replacePhrase = alias.Name;
						if (0 == string.Compare(matchPhrase, replacePhrase, StringComparison.CurrentCultureIgnoreCase))
						{
							// Sanity check, don't process these
							return false;
						}
						if (matchPhrase.IndexOf(' ') != -1)
						{
							if (replacePhrase.IndexOf(matchPhrase, StringComparison.CurrentCultureIgnoreCase) != -1)
							{
								// UNDONE: We handle expanding single words to a phrase containing the word, but not
								// multi-word phrases doing the same thing. However, make sure we don't recurse in this
								// situation.
								return false;
							}
							string[] parts = matchPhrase.Split(SpaceCharArray, StringSplitOptions.RemoveEmptyEntries);
							if (parts.Length > remainingParts)
							{
								return false;
							}
							phraseData.myOriginalNames = parts;
						}
						else
						{
							phraseData.myOriginalNames = new string[] { matchPhrase };
						}
						phraseData.myUnparsedReplacement = replacePhrase;
						return true;
					}
コード例 #7
0
 public NameAliasViewModel(NameAlias alias)
 {
     Name  = alias.Name;
     Alias = alias.Alias;
 }
コード例 #8
0
    private static ProjectClass ExtractProjectClass(ref string text, int ID)
    {
        ProjectClass retProjectClass  = new ProjectClass();
        int          parenthesisLevel = 1;


        string textName = text.Substring(0, text.IndexOf("(")).Trim();

        // look to see if owner.table syntax is used
        // get index of period.
        int indexOfPeriod = textName.IndexOf(".");

        // remove owner if used.
        if (indexOfPeriod >= 0)
        {
            textName = textName.Remove(0, indexOfPeriod + 1);
        }
        retProjectClass.DatabaseTableName = textName;
        string newString       = NameAlias.getTextWithFormatting(textName);
        string singularVersion = Words.PluralityDictionary.getPluralityInverse(newString);

        retProjectClass.Name = new NameAlias(singularVersion);
        // Get rid of opening ( for Create table statement.)
        text = text.Remove(0, text.IndexOf("(") + 1);
        int    indexOfOpeningParenthesis = -1;
        int    indexOfClosingParenthesis = -1;
        int    indexOFNextComma          = -1;
        string textTilParen = "";
        // Dim indexOfComma As Integer = -1


        // Remove any instances of extra parenthesis that exist behind certain variables,
        // such as PRIMARY KEY or IDENTITY
        // Dim indexToStart As Integer = 0
        int indexOfVar = 0;

        foreach (string VarCheck in _VariablesWithCommaInParams)
        {
            indexOfVar = text.IndexOf(VarCheck, indexOfVar, StringComparison.OrdinalIgnoreCase);
            while (indexOfVar >= 0)
            {
                if (indexOfVar > -1)
                {
                    indexOfOpeningParenthesis = text.IndexOf("(", indexOfVar);
                    indexOFNextComma          = text.IndexOf(",", indexOfVar);
                    indexOfClosingParenthesis = text.IndexOf(")", indexOfVar);
                    if (indexOFNextComma < indexOfOpeningParenthesis)
                    {
                        indexOfOpeningParenthesis = indexOFNextComma;
                        indexOfClosingParenthesis = indexOFNextComma - 1;
                    }
                    int lengthOfText            = indexOfOpeningParenthesis - indexOfVar;
                    int lengthOfTextTilEndParan = indexOfClosingParenthesis - indexOfVar - (VarCheck.Length - 1);

                    if (lengthOfText < 0)
                    {
                        lengthOfText            = VarCheck.Length;
                        lengthOfTextTilEndParan = 0;
                    }

                    textTilParen = text.Substring(indexOfVar, lengthOfText) + " ";

                    if (!textContainsKnownSQLType(textTilParen))
                    {
                        text = text.Remove(indexOfVar + VarCheck.Length, lengthOfTextTilEndParan);
                    }
                    int newStart = indexOfVar + lengthOfText;
                    if (newStart < text.Length)
                    {
                        indexOfVar = text.IndexOf(VarCheck, newStart, StringComparison.OrdinalIgnoreCase);
                    }
                    else
                    {
                        indexOfVar = -1;
                    }
                }
            }
            indexOfVar = 0;
        }

        int _ID = 0;

        StaticVariables.Instance.addDerivedTypeToSystem(retProjectClass);
        retProjectClass.OriginalSQLText = text;
        retProjectClass.ID = ID;
        return(retProjectClass);
    }