Пример #1
0
        public static string GetStoredProcedureParameterValueAndDataTypeString(StoredProcedure storedProcedure)
        {
            StringBuilder result = new StringBuilder(100);

            for (int i = 0; i < storedProcedure.Parameters.Length; i++)
            {
                if (i > 0)
                {
                    result.Append(", ");
                }
                StoredProcedure.Parameter parameter = storedProcedure.Parameters[i];
                string alias    = Script.GetCamelCase(parameter.Alias);
                string modifier = "";

                if (parameter.Direction.ToLower().IndexOf("out") >= 0)
                {
                    modifier = "ref ";
                }
                result.AppendFormat("{0}{1} {2}", modifier, CSharp.GetDataType(parameter.DataType, false), alias);
            }
            return(result.ToString());
        }
Пример #2
0
        public static string GetKeyValues(Column[] columns, bool includeDataType, string prefix)
        {
            string returnString = "";

            for (int i = 0; i < columns.Length; i++)
            {
                Column column = columns[i];

                if (includeDataType)
                {
                    returnString += CSharp.GetDataType(column) + " ";
                }

                returnString += prefix + column.Alias;

                if (i < columns.Length - 1)
                {
                    returnString += ", ";
                }
            }

            return(returnString);
        }
Пример #3
0
        public static string GetKeyValues(Column[] columns, string prefix)
        {
            string returnString = "";

            for (int i = 0; i < columns.Length; i++)
            {
                Column column = columns[i];
                returnString += prefix + column.Alias;

                if (CSharp.MapColumnType.IsInstanceOfType(column) || (column.IsNullable && CSharp.ColumnIsBasicDataType(column)))
                {
                    returnString += ".Value";
                }

                if (i < columns.Length - 1)
                {
                    returnString += ", ";
                }
            }

            return(returnString);
        }
Пример #4
0
        public static string GetASCXConversion(Column column)
        {
            string nullableType = "";

            if (column.IsNullable && CSharp.ColumnIsBasicDataType(column))
            {
                nullableType += ".Value";
            }

            switch (column.DataType)
            {
            case "bigint":
                return(nullableType + ".ToString()");

            case "binary":
                return(nullableType + ".ToString()");

            case "bit":
                return(nullableType + "");

            case "char":
                return(nullableType + "");

            case "datetime":
                return(nullableType + ".ToString(\"dd MMM yyyy\")");

            case "decimal":
                return(nullableType + ".ToString()");

            case "float":
                return(nullableType + ".ToString()");

            case "image":
                return(nullableType + ".ToString()");

            case "int":
                return(nullableType + ".ToString()");

            case "money":
                return(nullableType + ".ToString()");

            case "nchar":
                return(nullableType + "");

            case "ntext":
                return(nullableType + "");

            case "numeric":
                return(nullableType + ".ToString()");

            case "nvarchar":
                return(nullableType + "");

            case "real":
                return(nullableType + ".ToString()");

            case "smalldatetime":
                return(nullableType + ".ToString(\"dd MMM yyyy\")");

            case "smallint":
                return(nullableType + ".ToString()");

            case "smallmoney":
                return(nullableType + ".ToString()");

            case "sql_variant":
                return(nullableType + ".ToString()");

            case "text":
                return(nullableType + "");

            case "timestamp":
                return(nullableType + ".ToString()");

            case "tinyint":
                return(nullableType + ".ToString()");

            case "uniqueidentifier":
                return(nullableType + ".ToString()");

            case "varbinary":
                return(nullableType + ".ToString()");

            case "varchar":
                return(nullableType + "");

            case "xml":
                return(nullableType + "");

            default:
                throw new Exception(column.DataType + " data type not supported by the ArchAngel.Providers.Database.Model API yet. Please contact Slyce support: [email protected]");
            }
        }
Пример #5
0
 public static string GetKeyStringForConstant(Column[] columns)
 {
     return(CSharp.GetKeyString(columns, true));
 }
Пример #6
0
 public static string GetDatabaseType(Column column)
 {
     return(CSharp.GetDatabaseType(column.DataType, column.Size));
 }
Пример #7
0
 public static string GetKeyValueStringWithDataType(Column[] columns)
 {
     return(CSharp.GetKeyValues(columns, true));
 }
Пример #8
0
        public static string GetDataType(StoredProcedure.Parameter parameter)
        {
            bool isNullable = false; // TODO: need to add a property to Parameters that specify whether they are nullable (have default values).

            return(CSharp.GetDataType(parameter.DataType, isNullable));
        }
Пример #9
0
 public static string GetKeyValueStringWithClass(Column[] columns, string className)
 {
     return(CSharp.GetKeyValues(columns, Script.GetCamelCase(className) + "."));
 }
Пример #10
0
        public static string GetDataType(Column column)
        {
            bool isNullable = column.IsNullable || CSharp.MapColumnType.IsInstanceOfType(column);

            return(CSharp.GetDataType(column.DataType, isNullable));
        }
Пример #11
0
 public static string GetKeyValueStringWithUnderscore(Column[] columns)
 {
     return(CSharp.GetKeyValues2(columns, false, "_"));
 }
Пример #12
0
 public static string GetKeyValueString(Column[] columns)
 {
     return(CSharp.GetKeyValues(columns, false));
 }