public void SaveDescription(CustomNode node, string description, string databaseFieldName)
    {
        DataTable dt = ExecuteDataTable(ExtendedPropertiesHelper.GetCheckSql(node, databaseFieldName));
        string    sql;

        if (dt.Rows.Count == 0)
        {
            sql = ExtendedPropertiesHelper.GetAddSql(node, description, databaseFieldName);
        }
        else
        {
            if (description == "")
            {
                sql = ExtendedPropertiesHelper.GetDropSql(node, databaseFieldName);
            }
            else
            {
                sql = ExtendedPropertiesHelper.GetUpdateSql(node, description, databaseFieldName);
            }
        }

        Execute(sql);
    }
    public void SaveDescription(string level1Type, string level1Name, string level2Type, string level2Name, string description, string databaseFieldName)
    {
        DataTable dt = ExecuteDataTable(ExtendedPropertiesHelper.GetCheckSql(level1Type, level1Name, level2Type, level2Name, databaseFieldName));
        string    sql;

        if (dt.Rows.Count == 0)
        {
            sql = ExtendedPropertiesHelper.GetAddSql(level1Type, level1Name, level2Type, level2Name, description, databaseFieldName);
        }
        else
        {
            if (description == "")
            {
                sql = ExtendedPropertiesHelper.GetDropSql(level1Type, level1Name, level2Type, level2Name, databaseFieldName);
            }
            else
            {
                sql = ExtendedPropertiesHelper.GetUpdateSql(level1Type, level1Name, level2Type, level2Name, description, databaseFieldName);
            }
        }

        sql = CheckWrapper.GetCheckWrapper(level1Type, level1Name, level2Type, level2Name, sql);
        Execute(sql);
    }
Beispiel #3
0
    private void DoExportNodeSql(CustomNode node, StringBuilder stringBuilder)
    {
        SortDescriptions(node);
        AddEmptyDescriptions(node);

        foreach (DescriptionItem item in node.Descriptions)
        {
            string sql = "";

            if (_objectsSelectorForm.allCheckBox.Checked || (!_objectsSelectorForm.allCheckBox.Checked && _selectedDatabaseFieldNames.Contains(item.Type.DatabaseFieldName)))
            {
                string databaseFieldName = item.Type.DatabaseFieldName;

                if (string.IsNullOrEmpty(item.Description))
                {
                    if (additionalOptionsCheckBox.Checked)
                    {
                        sql = string.Format("if exists ({0})\r\nbegin\r\n\t{1}\r\nend", ExtendedPropertiesHelper.GetCheckSql(node, databaseFieldName), ExtendedPropertiesHelper.GetDropSql(node, databaseFieldName));
                    }
                }
                else
                {
                    sql = string.Format("if exists ({0})\r\nbegin\r\n\t{1}\r\nend\r\nelse\r\nbegin\r\n\t{2}\r\nend", ExtendedPropertiesHelper.GetCheckSql(node, databaseFieldName), ExtendedPropertiesHelper.GetUpdateSql(node, item.Description, databaseFieldName), ExtendedPropertiesHelper.GetAddSql(node, item.Description, databaseFieldName));
                }
            }

            if (sql != "")
            {
                sql = CheckWrapper.GetCheckWrapper(node, sql);

                if (generateGoStatementsCheckBox.Checked)
                {
                    sql = string.Format("{0}\r\ngo", sql);
                }

                stringBuilder.Append(string.Format("{0}\r\n\r\n", sql));
            }
        }
    }