Beispiel #1
0
        public static string GenerateSQLinqField(Interfaces.IDatabaseField field, string tableName)
        {
            //linq_fields += this._field_list[i].Name + " = (string)(" + LinqAbbreviation(this._table_name) + "." + this._field_list[i].Name + " ?? \"\")";
            string response = String.Empty;

            switch (field.FieldType)
            {
            case DbType.String:
            {
                response = field.Name + " = (string)" + LinqAbbreviation(tableName) + "." + field.Name + @" ?? """"";
                break;
            }

            case DbType.DateTime:
            {
                response = field.Name + " = (DateTime)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }

            case DbType.Binary:
            {
                response = field.Name + " = (TimeSpan)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }

            case DbType.Int32:
            {
                response = field.Name + " = (int)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }

            case DbType.Int64:
            {
                response = field.Name + " = (long)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }

            case DbType.Boolean:
            {
                response = field.Name + " = Convert.ToBoolean(" + LinqAbbreviation(tableName) + "." + field.Name + @")";
                break;
            }

            case DbType.Decimal:
            {
                response = field.Name + " = (decimal)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }

            case DbType.Double:
            {
                response = field.Name + " = (double)" + LinqAbbreviation(tableName) + "." + field.Name;
                break;
            }
            }
            return(response);
        }
Beispiel #2
0
        public static string GenerateInterfaceFieldProperty(Interfaces.IDatabaseField field)
        {
            string response = String.Empty;

            switch (field.FieldType)
            {
            case DbType.String:
            {
                response = "string " + field.Name + "{get;set;}";
                break;
            }

            case DbType.DateTime:
            {
                response = "DateTime? " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Binary:
            {
                response = "TimeSpan? " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Int32:
            {
                response = "int " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Int64:
            {
                response = "long " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Boolean:
            {
                response = "bool " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Decimal:
            {
                response = "decimal " + field.Name + "{get;set;}";
                break;
            }

            case DbType.Double:
            {
                response = "double " + field.Name + "{get;set;}";
                break;
            }
            }
            return(response);
        }
Beispiel #3
0
        public static string GenerateReverseFieldAssignmentLeftSideNoCamelCase(Interfaces.IDatabaseField field, string recordName, string queryName)
        {
            string response = String.Empty;

            switch (field.FieldType)
            {
            case DbType.String:
            {
                response = recordName + "." + field.Name + " = (string)" + queryName + "." + field.Name;
                break;
            }

            case DbType.DateTime:
            {
                response = recordName + "." + field.Name + " = " + queryName + "." + field.Name;
                break;
            }

            case DbType.Binary:
            {
                response = recordName + "." + field.Name + " = (TimeSpan)" + queryName + "." + field.Name;
                break;
            }

            case DbType.Int32:
            {
                response = recordName + "." + field.Name + " = (int)" + queryName + "." + field.Name;
                break;
            }

            case DbType.Int64:
            {
                response = recordName + "." + field.Name + " = (long)" + queryName + "." + field.Name;
                break;
            }

            case DbType.Boolean:
            {
                response = recordName + "." + field.Name + " = Convert.ToBoolean(" + queryName + "." + field.Name;
                break;
            }

            case DbType.Decimal:
            {
                response = recordName + "." + field.Name + " = (decimal)" + queryName + "." + field.Name;
                break;
            }

            case DbType.Double:
            {
                response = recordName + "." + field.Name + " = (double)" + queryName + "." + field.Name;
                break;
            }
            }
            return(response);
        }
Beispiel #4
0
        public static string GenerateFieldAssignmentLeftSideNoCamelCase(Interfaces.IDatabaseField field, string recordName, string queryName)
        {
            string response = String.Empty;

            switch (field.FieldType)
            {
            default:
            {
                response = recordName + "." + field.Name + " = " + queryName + "." + field.Name;
                break;
            }
            }
            return(response);
        }