组合查询一直是我一个头疼的事情,经过我不懈努力,终于在看了多次博客找了n多资料后实现了,现在拿出来和大家共享,希望大家指正!
首先是界面:
然后我们分层来看,B层实现对汉字向英文字符的转换:
[vb]
'/*************************************************
'作者:许恕
'小组:
'说明:转换组合查询汉字为代码的类
'创建日期:2013.3.8
'版本号:v1.0.0
'*********************************************/
Public Class CombineCheckChangeStringBLL
' /// <summary>
' /// depiction:<改方法是转换上下机字符>
' /// </summary>
' /// <param name="<strCombineString>"><上下机实体></param>
' /// <returns>
' ///<返回上下机实体>
' /// </returns>
Public Function ChangeOnlineRecordString(strCombineString As Entity.CombineSelectEntity) As Entity.CombineSelectEntity
'转换字段
strCombineString.FieldName1 = ChangeOnlineRecordFieldName(strCombineString.FieldName1)
strCombineString.FieldName2 = ChangeOnlineRecordFieldName(strCombineString.FieldName2)
strCombineString.FieldName3 = ChangeOnlineRecordFieldName(strCombineString.FieldName3)
'装换操作符
strCombineString.OperationalChar1 = ChangeOperationalChar(strCombineString.OperationalChar1)
strCombineString.OperationalChar2 = ChangeOperationalChar(strCombineString.OperationalChar2)
strCombineString.OperationalChar3 = ChangeOperationalChar(strCombineString.OperationalChar3)
'转换关系符
strCombineString.Relationchar1 = ChangeRelationchar(strCombineString.Relationchar1)
strCombineString.Relationchar2 = ChangeRelationchar(strCombineString.Relationchar2)
Return strCombineString
End Function
' /// <summary>
' /// depiction:<改方法是转换上下机字符-字段>
' /// </summary>
' /// <param name="<strOnline>"><上下机字符></param>
' /// <returns>
' ///<返回上字符串>
' /// </returns>
Public Function ChangeOnlineRecordFieldName(strOnline As String) As String
Dim strOnlineReturn As String
Select Case strOnline
Case "卡号"
strOnlineReturn = "card_id"
Case "上机日期"
strOnlineReturn = "online_date"
Case "上机时间"
strOnlineReturn = "online_time"
Case "机房号"
strOnlineReturn = "computer_no"
Case Else
strOnlineReturn = ""
End Select
Return strOnlineReturn
End Function
' /// <summary>
' /// depiction:<改方法是转换字符-操作符>
' /// </summary>
' /// <param name="<strOnline>"><上下机字符></param>
' /// <returns>
' ///<返回上字符串>
' /// </returns>
Public Function ChangeOperationalChar(strChange As String) As String
Dim strRenturn As String
Select Case strChange
Case "大于"
strRenturn = " > "
Case "小于"
strRenturn = " < "
Case "等于"
strRenturn = " = "
Case "不等于"
strRenturn = " <> "
Case Else
strRenturn = " "
End Select
Return strRenturn
End Function
' /// <summary>
' /// depiction:<改方法是转换关系字符>
' /// </summary>
' /// <param name="<strOnline>"><上下机字符></param>
' /// <returns>
' ///<返回上字符串>
' /// </returns>
Public Function ChangeRelationchar(strChange As String) As String
补充:软件开发 , Vb ,