|
楼主 |
发表于 2015-7-30 10:33:03
|
显示全部楼层
改用类模块方式
Option Explicit
Implements UFPortalProxyInterface.ILoginable
Public Property Get Business() As Object
Set Business = g_obusiness
End Property
Public Property Set Business(ByRef bBus As Object)
Set g_obusiness = bBus '获得business对象。
End Property
Private Function ILoginable_Login() As Boolean
If ((Not g_obusiness Is Nothing) And g_bLogined = False) Then
Set g_oLogin = g_obusiness.GetVBclsLogin() '获得login对象
If UFSystem.State = 1 Then UFSystem.Close
UFSystem.ConnectionString = g_oLogin.UfSystemADODb
UFSystem.CursorLocation = adUseClient
UFSystem.Open
If UFData.State = 1 Then UFData.Close
UFData.ConnectionString = g_oLogin.UfDbName
UFData.CursorLocation = adUseClient
UFData.Open
ZTCode = g_oLogin.cAcc_Id
ZTName = g_oLogin.cAccName
pUserCode = g_oLogin.cAuditor.AuditorId
pUserName = g_oLogin.cAuditor.AuditorName
pUFDate = g_oLogin.CurDate
g_bLogined = True
ILoginable_Login = True
Else
ILoginable_Login = Not g_obusiness Is Nothing
End If
End Function
Private Function ILoginable_LogOff() As Boolean
'程序退出前,添加自己的代码
ILoginable_LogOff = True '本行代码必须。
g_bLogined = False '本行代码必须。
End Function
Private Function ILoginable_CallFunction(ByVal cMenuId As String, ByVal cMenuName As String, ByVal cAuthID As String, ByVal cCmdLine As String) As Object
Dim vfd As Object
Dim cSqlStr As String
cSqlStr = "if object_id('TableHead') is null CREATE TABLE [TableHead] ([Autoid] [int] IDENTITY (1, 1) NOT NULL ,[TableName] [nvarchar] (50) NOT NULL ,[Field_Name] [nvarchar] (50) NOT NULL ,[Field_Width] [float] NOT NULL ,[bSum] [bit] NOT NULL CONSTRAINT [DF_SMT_TableHead_bSum] DEFAULT (0),[Field_Sort] [int] NULL ,[Alignment] [int] NULL ,CONSTRAINT [PK_SMT_TableHead] PRIMARY KEY CLUSTERED ([Autoid]) ON [PRIMARY]) ON [PRIMARY] "
UFData.Execute (cSqlStr)
cSqlStr = "if object_id('TableStyle') is null CREATE TABLE [TableStyle] ([TableName] [nvarchar] (50) NOT NULL ,[LeftPrint] [float] NULL ,[TopPrint] [float] NULL ,[Perline] [int] NULL ,[PerRow] [int] NULL ,[bShowZero] [bit] NOT NULL ,[bShowLine] [bit] NOT NULL ,[bShowSer] [bit] NOT NULL ,[bPrintDate] [bit] NOT NULL ,[bPrintPageNo] [bit] NOT NULL ,[TitleFont] [nvarchar] (50) NULL ,[OutSideFont] [nvarchar] (50) NULL ,[GridFont] [nvarchar] (50) NULL ,[bAddEmpLine] [bit] NOT NULL ,[cSumMothod] [nvarchar] (50) NULL ,[Moneyunit] [nvarchar] (20) NULL ,[HeadFont] [nvarchar] (50) NULL ,[RowHeight] [float] NULL ,[Orientation] [bit] NOT NULL ,[PaperSize] [int] NULL ,[FixRowHeight] [float] NULL ,[FactPrint] [bit] NOT NULL ,[PrintScale] [float] NULL ,[FirstPageNo] [int] NULL,FixedCols int,CONSTRAINT [PK_SMT_TableStyle] PRIMARY KEY CLUSTERED ([TableName]) ON [PRIMARY] ) ON [PRIMARY] "
UFData.Execute (cSqlStr)
cSqlStr = " if object_id('UA_U8InterfaceSN') is null CREATE TABLE [UA_U8InterfaceSN] ([cUnitName] [varchar] (150) NULL ,[cSNCode] [varchar] (40) NULL,[dBeginDate] [Datetime] NULL,[dEndDate] [Datetime] NULL)"
UFSystem.Execute (cSqlStr)
bSN = SNPeriod()
If Not (g_obusiness Is Nothing) Then
If cMenuId <> "SY0001" Then
If bSN = False Then
Exit Function
End If
End If
Select Case cMenuId
Case "SY0001"
Set vfd = g_obusiness.CreateFormEnv("frmSN_key", frmSN) 'frmBom_key为任意字符串,建议以"窗体名_key"来表示,既防止重复,又清晰易懂。
Call g_obusiness.ShowForm(frmSN, "DP", "frmSN_key", False, True, vfd)
Case "SY0002"
Set vfd = g_obusiness.CreateFormEnv("frmBomInv_key", frmBomInv) 'frmBom_key为任意字符串,建议以"窗体名_key"来表示,既防止重复,又清晰易懂。
Call g_obusiness.ShowForm(frmBomInv, "DP", "frmBomInv_key", False, True, vfd)
Case Else
MsgBox "错误配置菜单!", vbInformation, "插件安装"
End Select
End If
End Function
以上是基本类的一些代码 |
|