dmClasses.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:CRDataManager 作者: NobahdiAtoll 项目源码 文件源码
def FieldConvert(self, strValue, strField=None):
        if dmGlobals.TraceFunctionMessages: print 'Method: dmParameters:FieldConvert(stringValue, stringFieldName)'

        FieldValue = self.Field
        if strField != None:
            FieldValue = strField

        theVal = strValue
        try:
            if FieldValue in dmGlobals.ALLOWEDVALS:
                if FieldValue in dmGlobals.FIELDSLIST and not dmGlobals.IsList(strValue):
                    theVal = strValue.Split(Array[str](dmGlobals.CRLISTDELIMITER), StringSplitOptions.RemoveEmptyEntries)
                elif FieldValue in dmGlobals.FIELDSBOOL and not dmGlobals.IsBool(strValue):
                    theVal = dmGlobals.StringToBool(strValue)
                elif FieldValue in dmGlobals.FIELDSDATETIME and not dmGlobals.IsDateTime(strValue):
                    theVal = dmGlobals.StringToDate(strValue)
                elif FieldValue in dmGlobals.FIELDSNUMERIC and not dmGlobals.IsFloat(strValue):
                    theVal = dmGlobals.StringToFloat(strValue)
                elif FieldValue in dmGlobals.FIELDSMANGAYESNO and not dmGlobals.IsMangaYesNo(strValue):
                    theVal = dmGlobals.StringToMangaYesNo(strValue)
                elif FieldValue in dmGlobals.FIELDSYESNO and not dmGlobals.IsYesNo(strValue):
                    theVal = dmGlobals.StringToYesNo(strValue)
                elif FieldValue in dmGlobals.FIELDSPSUEDONUMERIC and not isinstance(strValue,str):
                    try:                    
                        theVal = strValue.ToString()
                    except:
                        pass
            #otherwise just return the value
        except Exception as ex:

            pass
        return theVal
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号