コード例 #1
0
    protected override string CastToImp(NumberSqlLiteralType sqlLiteralType, object propertyValue)
    {
        long ret = 0;

        //数値に変換できない場合は0を返す
        long.TryParse(propertyValue.ToString(), out ret);
        return(ret.ToString());
    }
コード例 #2
0
ファイル: JkCastEditor.cs プロジェクト: radtek/SqlAccessor
    //Public Overloads Function BeforeCast(ByVal sqlLiteralType As StringSqlLiteralType, _
    //                                      ByVal propertyType As StringPropertyType, _
    //                                      ByVal aColumnInfo As ColumnInfo, _
    //                                      ByVal propertyValue As Object) As Object
    //  Return JkCastEditor.FillWithDefaultValue(propertyValue, aColumnInfo)
    //End Function

    public object BeforeCast(NumberSqlLiteralType sqlLiteralType
                             , StringPropertyType propertyType
                             , ColumnInfo aColumnInfo
                             , object propertyValue)
    {
        string  numStr = (string)propertyValue;
        decimal dec    = default(decimal);

        decimal.TryParse(numStr, out dec);
        return(dec.ToString());
    }
コード例 #3
0
    protected override string CastToImp(NumberSqlLiteralType sqlLiteralType, object propertyValue)
    {
        bool b = (bool)propertyValue;

        if (b)
        {
            return("1");
        }
        else
        {
            return("0");
        }
    }
コード例 #4
0
 protected override string CastToImp(NumberSqlLiteralType sqlLiteralType, object propertyValue)
 {
     return(propertyValue.ToString());
 }
コード例 #5
0
 protected override string CastToImp(NumberSqlLiteralType sqlLiteralType, object propertyValue)
 {
     System.DateTime d = (System.DateTime)propertyValue;
     return(d.ToString("yyyyMMdd").TrimStart('0'));
 }