initial commit

This commit is contained in:
Chikyun
2019-10-24 21:24:21 +09:00
commit 376f7d9de0
544 changed files with 295019 additions and 0 deletions

760
ArinWarev1/Module/Pub.vb Normal file
View File

@@ -0,0 +1,760 @@
Module Pub
Structure s_Project
Dim FileName As String
Dim MakeTime As String
Dim Desc As String
Dim Opened As Boolean
Dim UIVersion As String
Dim LGVersino As String
Dim Name As String
Dim MaxUI As String
Dim MaxLG As String
Dim SFType As String '//저장파일 형태
Dim EditTime As String
Dim Admin As Boolean '//현재프로그램이 관리자 모드인가?
Dim Password As String '//해당프로젝트가 엄호로 보호되어있는가?
Dim IsError As Boolean '//로드시 에러가 발생하였는가?
Dim CUrIP As String
Dim CUrMac As String
Dim LoginTime As String '//로그인시간
Dim UserId As String
Dim UserName As String
Dim UserPass As String
Dim UserIp As String
Dim UserMac As String
Dim UserAuthType As String
End Structure
Public pLog As ArinLog.ArinLog
Public Prj As New s_Project : Public StartVersion As String = "2010032000"
Public Myini As CEnergy.MyINI
Public PrjChanged As Boolean = False
' Public Uselov As Lov.ModLov
Public PreFile(4) As String
Public msgf As Frm_Work = Nothing '201130830
Public DSET1 As New DS '//일반데이터
Public DSET2 As New DS '//일반데이터(임시)
Public DSETR1 As New DSR '//결과데이터(결과)
Public DSETR2 As New DSR '//결과데이터(임시)
Public DataDir As New System.IO.DirectoryInfo(My.Application.Info.DirectoryPath)
Public TemplateDir As New System.IO.DirectoryInfo(DataDir.FullName & "\template")
Public Calc As Calculator '//계산로직이다.파일열릴떄 할당됨
Public Result1 As New CResult(DSET1, DSETR1) '//기본데이터결과
Public Result2 As New CResult(DSET2, DSETR2) '//설계개선용데이터결과
Public LogSB As System.Text.StringBuilder
Public EnDec As New ArinLogin.EnDec("tindevil.com")
Public DSHistory As New DS2
Public Function CurrentUIVersion() As String
Dim uiverstr As String = My.Application.Info.Version.Minor.ToString("0000") + _
My.Application.Info.Version.Build.ToString("0000") + _
My.Application.Info.Version.Revision.ToString("0000").Substring(0, 2)
Return uiverstr
End Function
Public Sub NOTICE(ByVal MSG As String, ByVal Src As Windows.Forms.ToolStripStatusLabel, ByVal FCOLOR As Drawing.Color)
If Not Src Is Nothing Then
Src.Text = "" & MSG & Space(1) & "[" & Format(Now, "HH시mm분ss초") & "]"
Src.ForeColor = FCOLOR
End If
If FCOLOR = Drawing.Color.Red Then My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep)
End Sub
Public Sub MsgboxE(msg As String, Optional SaveLog As Boolean = False)
MsgBox(msg, MsgBoxStyle.Critical, "확인")
If SaveLog Then
pLog.Add(msg, True)
End If
End Sub
Public Sub MsgboxI(msg As String, Optional SaveLog As Boolean = False)
MsgBox(msg, MsgBoxStyle.Information, "확인")
If SaveLog Then
pLog.Add(msg, True)
End If
End Sub
''' <summary>
''' 모든입력면의 창,문의 면적비를 계산하여 반환한다(frm_myoun의 Display_info 함수에서 가져옴)
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function calc_창및문면적비(ByRef 면적비 As Decimal, ByRef 열관류율 As Decimal, Optional 방위 As String = "") As Boolean
면적비 = 0
열관류율 = 0
Dim filter As String = "code <> '0' and (건축부위방식='외벽' or 건축부위방식 ='외부창' or 건축부위방식='내벽' or 건축부위방식 ='내부창')"
If 방위 <> "" Then filter += " and 방위='" + 방위 + "'"
Dim 면데이터() As DS.tbl_myounRow = DSET1.tbl_myoun.Select(filter)
Dim WindowArea As Decimal = 0
Dim WallArea As Decimal = 0
Dim 열관류율합 As Double = 0
For Each Dr입력면 As DS.tbl_myounRow In 면데이터
Dim 존수 As Integer = 1
Dim 열관 As Single = 0
'If Dr입력면.열관류율2 = "0" Then Continue For '//열관류율이 연결되어 있어야한다
Dim Dryk() As DS.tbl_ykRow = Nothing
If Dr입력면.열관류율2 <> "0" Then
Dryk = DSET1.tbl_yk.Select("code='" & Dr입력면.열관류율2 & "'")
If Dryk.Length < 1 Then
MsgBox("입력면(" + Dr입력면.설명 + ")의 열관류율 연결값이 열관류율표에 존재하지 않습니다(Code=" + Dr입력면.열관류율2 + ")", MsgBoxStyle.Critical, "확인")
Continue For
End If
열관 = TOSG(Dryk(0).열관류율)
Else
열관 = TOSG(Dr입력면.열관류율)
End If
'//이 입력면을 사용하는 존의 정보를 가져온다(오류가 있다면 존의갯수를 1로한다)
Dim dr존() As DS.tbl_zoneRow = DSET1.tbl_zone.Select("code='" + Dr입력면.존분류 + "'")
If dr존.Length > 0 Then
If IsNumeric(dr존(0).입력존의수) Then 존수 = CInt(dr존(0).입력존의수)
End If
Select Case Dr입력면.건축부위방식
Case "외벽"
열관류율합 += 열관 * 1 * TOSG(Dr입력면.건축부위면적) * 존수
Case "내벽"
열관류율합 += 열관 * 0.7 * TOSG(Dr입력면.건축부위면적) * 존수
Case "외부창"
열관류율합 += 열관 * 1 * TOSG(Dr입력면.건축부위면적) * 존수
Case "내부창"
열관류율합 += 열관 * 0.8 * TOSG(Dr입력면.건축부위면적) * 존수
End Select
If Dryk Is Nothing Then
'//열관류 선택안된경우
Select Case Dr입력면.건축부위방식
Case "외벽"
If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
End If
Case "내벽" '
WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
Case "외부창"
If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
End If
Case "내부창"
WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
End Select
Else
Dim 면형태이름 As String = Get_CName("1088", Dryk(0).면형태)
Select Case 면형태이름
Case "외벽(벽체)"
WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
Case "내벽(벽체)"
WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
Case "외부창"
If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
End If
Case "내부창"
WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
End Select
End If
'Debug.WriteLine(Dr입력면.code + ":wall=" + WallArea.ToString() + ",win=" + WindowArea.ToString())
Next
'//면적비계산
Dim r As Decimal = 0
If (WallArea + WindowArea) <> 0 Then
r = WindowArea / (WallArea + WindowArea) * 100
End If
면적비 = r
If WallArea + WindowArea = 0 Then
열관류율 = (0.0F)
Else
열관류율 = 열관류율합 / (WallArea + WindowArea)
End If
Return True
End Function
''' <summary>
''' 모든입력면의 창,문의 면적비를 계산하여 반환한다(frm_myoun의 Display_info 함수에서 가져옴)
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function calc_평균열관류율(건축부위방식() As String) As Decimal
Dim filter As String = "code <> '0' and 열관류율2 <> '' and 열관류율2 <> '0'"
'If 방위 <> "" Then filter += " and 방위='" + 방위 + "'"
'//해당방식을 사용한 열관류율을 모두 찾아서
Dim 면데이터() As DS.tbl_myounRow = DSET1.tbl_myoun.Select(filter)
Dim WindowArea As Decimal = 0
Dim WallArea As Decimal = 0
Dim 열관류율합 As Double = 0
For Each Dr입력면 As DS.tbl_myounRow In 면데이터
'//이 입력면의 건축부위방식(열관류율테이블)이 일치한다면 그 값을 상요하도록 한다
Dim 열관데이터() As DS.tbl_ykRow = DSET1.tbl_yk.Select("code='" + Dr입력면.열관류율2 + "' and 면형태 <> '' and 면형태 <> '0'")
If 열관데이터.Length < 1 Then Continue For
'//열관류율데이터의 형태가 건축부위방식과 맞는지 확인한다
Dim 공용() As DS.tbl_commonRow = DSET1.tbl_common.Select("gubun = '1088' and code='" + 열관데이터(0).면형태 + "'")
If 공용.Length < 1 Then Continue For
Dim 부위찾음 As Boolean = False
For Each 찾을부위 As String In 건축부위방식
If 공용(0).name = 찾을부위 Then 부위찾음 = True
Next
If Not 부위찾음 Then Continue For
Dim 존수 As Integer = 1
Dim 열관 As Single = 0
'If Dr입력면.열관류율2 = "0" Then Continue For '//열관류율이 연결되어 있어야한다
Dim Dryk() As DS.tbl_ykRow = Nothing
If Dr입력면.열관류율2 <> "0" Then
Dryk = DSET1.tbl_yk.Select("code='" & Dr입력면.열관류율2 & "'")
If Dryk.Length < 1 Then
MsgBox("입력면(" + Dr입력면.설명 + ")의 열관류율 연결값이 열관류율표에 존재하지 않습니다(Code=" + Dr입력면.열관류율2 + ")", MsgBoxStyle.Critical, "확인")
Continue For
End If
열관 = TOSG(Dryk(0).열관류율)
Else
열관 = TOSG(Dr입력면.열관류율)
End If
'//이 입력면을 사용하는 존의 정보를 가져온다(오류가 있다면 존의갯수를 1로한다)
Dim dr존() As DS.tbl_zoneRow = DSET1.tbl_zone.Select("code='" + Dr입력면.존분류 + "'")
If dr존.Length > 0 Then
If IsNumeric(dr존(0).입력존의수) Then 존수 = CInt(dr존(0).입력존의수)
End If
Select Case Dr입력면.건축부위방식
Case "외벽"
열관류율합 += 열관 * 1 * TOSG(Dr입력면.건축부위면적) * 존수
Case "내벽"
열관류율합 += 열관 * 0.7 * TOSG(Dr입력면.건축부위면적) * 존수
Case "외부창"
열관류율합 += 열관 * 1 * TOSG(Dr입력면.건축부위면적) * 존수
Case "내부창"
열관류율합 += 열관 * 0.8 * TOSG(Dr입력면.건축부위면적) * 존수
End Select
WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
'If Dryk Is Nothing OrElse Dryk.Length < 1 Then
' '//열관류 선택안된경우
' Select Case Dr입력면.건축부위방식
' Case "외벽"
' If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
' WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
' End If
' Case "내벽" '
' WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
' Case "외부창"
' If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
' WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
' End If
' Case "내부창"
' WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
' End Select
'Else
' Dim 면형태이름 As String = Get_CName("1088", Dryk(0).면형태)
' Select Case 면형태이름
' Case "외벽(벽체)"
' WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
' 'Case "내벽(벽체)"
' ' WallArea = WallArea + TOSG(Dr입력면.건축부위면적) * 존수
' 'Case "외부창"
' ' If Dr입력면.방위 <> "수평" AndAlso Dr입력면.방위 <> "일사없음" AndAlso Dr입력면.방위 <> "(없음)" Then
' ' WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
' ' End If
' 'Case "내부창"
' ' WindowArea = WindowArea + TOSG(Dr입력면.건축부위면적) * 존수
' End Select
'End If
'Debug.WriteLine(Dr입력면.code + ":wall=" + WallArea.ToString() + ",win=" + WindowArea.ToString())
Next
'//면적비계산
'Dim r As Decimal = 0
'If (WallArea + WindowArea) <> 0 Then
' r = WindowArea / (WallArea + WindowArea) * 100
'End If
'면적비 = r
If WallArea + WindowArea = 0 Then
Return (0.0F)
Else
Return 열관류율합 / (WallArea + WindowArea)
End If
End Function
Public Function getColCaption(ByVal dt As DataTable) As String()
Dim Clist(dt.Columns.Count - 1) As String
For i As Integer = 1 To dt.Columns.Count
If dt.Columns(i - 1).Caption.ToString <> "" Then Clist(i - 1) = dt.Columns(i - 1).Caption.ToString
Next
Return Clist
End Function
Public Function getColName(ByVal dt As DataTable) As String()
Dim Clist(dt.Columns.Count - 1) As String
For i As Integer = 1 To dt.Columns.Count
If dt.Columns(i - 1).ColumnName.ToString <> "" Then Clist(i - 1) = dt.Columns(i - 1).ColumnName.ToString
Next
Return Clist
End Function
Public Function STB(ByVal src As String) As Byte()
Return System.Text.Encoding.Default.GetBytes(src)
End Function
Public Function STB(ByVal src As Byte()) As String
Return System.Text.Encoding.Default.GetString(src)
End Function
'''공용코드의코드반환
Public Function Get_CCode(ByVal gubun As String, ByVal name As String) As String
Dim DR() As DS.tbl_commonRow = CType(DSET1.tbl_common.Select("gubun='" & gubun & "' and name='" & name & "'"), DS.tbl_commonRow())
If DR.GetUpperBound(0) = -1 Then Return ""
Return DR(0).code
End Function
'''공용코드의이름반환
Public Function Get_CName(ByVal gubun As String, ByVal code As String) As String
Dim DR() As DS.tbl_commonRow = CType(DSET1.tbl_common.Select("gubun='" & gubun & "' and code='" & code & "'"), DS.tbl_commonRow())
If DR.GetUpperBound(0) = -1 Then Return ""
Return DR(0).name
End Function
Public Function NVL(ByVal src As Object, Optional ByVal DefVal As Object = "") As Object
Try
If src.ToString = "" Or src Is DBNull.Value Then
Return DefVal
Else
Return src
End If
Catch ex As Exception
Return DefVal
End Try
End Function
'''평가결과등급을 반환 (1~10등급까지 있으며 1등급은 +++ ,2등급은 ++ 3등급은 + 4등급부터 1로 시작함)
Public Function 평가결과등급(주거용 As Integer, 일차에너지소요량합계 As Decimal) As Integer
If 주거용 <= 10 Then
Select Case 일차에너지소요량합계
Case Is < 60
Return 1
Case Is < 90
Return 2
Case Is < 120
Return 3
Case Is < 150
Return 4
Case Is < 190
Return 5
Case Is < 230
Return 6
Case Is < 270
Return 7
Case Is < 320
Return 8
Case Is < 370
Return 9
Case Else
Return 10
End Select
Else
Select Case 일차에너지소요량합계
Case Is < 80
Return 1
Case Is < 140
Return 2
Case Is < 200
Return 3
Case Is < 260
Return 4
Case Is < 320
Return 5
Case Is < 380
Return 6
Case Is < 450
Return 7
Case Is < 520
Return 8
Case Is < 610
Return 9
Case Else
Return 10
End Select
End If
End Function
Public Sub Read_CommonCode(Optional ByVal Version As String = "")
Work_msg("공용코드 확인중")
If Version = "" Then
Dim L As New ArinLogin.ArinLOgin
Dim VersionInfo As ArinLogin.ArinLOgin.sVersionInfo = Nothing
VersionInfo = L.Get_LastVersion("C2") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
Try
Dim TaC As New DSTableAdapters.tbl_commonTableAdapter
TaC.Fill(DSET1.tbl_common)
DSET1.tbl_Desc.Rows(0)("versionc") = Version
DSET1.AcceptChanges()
TaC.Fill(DSET2.tbl_common)
'DSET2.tbl_Desc.Rows(0)("versionc") = Version
DSET2.AcceptChanges()
Catch ex As Exception
MsgBox("공용코드 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
End Try
Work_msg("")
End Sub
Public Sub Read_ProfileData(Optional ByVal Version As String = "") '//2010.12.06 추가
Work_msg("표준프로파일 확인중")
If Version = "" Then
Dim L As New ArinLogin.ArinLOgin
Dim VersionInfo As ArinLogin.ArinLOgin.sVersionInfo = Nothing
VersionInfo = L.Get_LastVersion("P2016") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷! 160327 p2 -> P2016
Version = VersionInfo.Ver
End If
Try
Dim TaC As New DSTableAdapters.tbl_profileTableAdapter
TaC.Fill(DSET1.tbl_profile)
DSET1.tbl_Desc.Rows(0)("versionp") = Version
DSET1.AcceptChanges()
TaC.Fill(DSET2.tbl_profile) '//160327 table PROFILE2 -> PROFILE_2016
'DSET2.tbl_Desc.Rows(0)("versionp") = Version
DSET2.AcceptChanges()
Catch ex As Exception
MsgBox("표준프로파일 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
End Try
'MsgBox(Version)
Work_msg("")
End Sub
Public Sub Read_WeatherData(Optional ByVal Version As String = "")
Work_msg("기상데이터 확인중")
Dim Iserror As Boolean = False
If Version = "" Then
Dim L As New ArinLogin.ArinLOgin
Dim VersionInfo As ArinLogin.ArinLOgin.sVersionInfo = Nothing
VersionInfo = L.Get_LastVersion("W2") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
DSET1.tbl_weather.Clear()
DSET1.weather_cha.Clear()
DSET1.weather_ilsa.Clear()
DSET1.weather_temp.Clear()
DSET1.weather_supdo.Clear()
DSET1.AcceptChanges()
DSET2.tbl_weather.Clear()
DSET2.weather_cha.Clear()
DSET2.weather_ilsa.Clear()
DSET2.weather_temp.Clear()
DSET2.weather_supdo.Clear()
DSET2.AcceptChanges()
Try
Dim TaC As New DSTableAdapters.tbl_weatherTableAdapter
TaC.Fill(DSET1.tbl_weather)
TaC.Fill(DSET2.tbl_weather)
Catch ex As Exception
MsgBox("기상데이터0 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_chaTableAdapter
TaC.Fill(DSET1.weather_cha)
TaC.Fill(DSET2.weather_cha)
Catch ex As Exception
MsgBox("기상데이터1 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_ilsaTableAdapter
TaC.Fill(DSET1.weather_ilsa)
TaC.Fill(DSET2.weather_ilsa)
Catch ex As Exception
MsgBox("기상데이터2 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_supdoTableAdapter
TaC.Fill(DSET1.weather_supdo)
TaC.Fill(DSET2.weather_supdo)
Catch ex As Exception
MsgBox("기상데이터3 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_tempTableAdapter
TaC.Fill(DSET1.weather_temp)
TaC.Fill(DSET2.weather_temp)
Catch ex As Exception
MsgBox("기상데이터4 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
If Iserror = False Then
DSET1.tbl_Desc.Rows(0)("versionw") = Version
'DSET2.tbl_Desc.Rows(0)("versionw") = Version
'MsgBox(Version)
DSET1.AcceptChanges()
DSET2.AcceptChanges()
End If
Work_msg("")
End Sub
Public Function TOIT(ByVal obj As Object) As Integer
If obj Is DBNull.Value Then
Return 0
ElseIf obj.ToString = "" Then
Return 0
Else
If IsNumeric(obj) Then
Return CInt(obj)
Else
MsgBox("[TOIT]숫자형식이 요구되지만 문자가 들어있습니다" & vbCrLf & obj.ToString, MsgBoxStyle.Critical, "확인")
Return 0
End If
End If
End Function
Public Function TOSG(ByVal obj As Object) As Decimal
If obj Is DBNull.Value Then
Return 0
ElseIf obj.ToString = "" Then
Return 0
Else
If IsNumeric(obj) Then
Try
Return CDec(obj)
Catch ex As Exception
MsgBox("[TOSG]에서 '" & obj & "'")
Return 0
End Try
Else
MsgBox("[TOSG]숫자형식이 요구되지만 문자가 들어있습니다" & vbCrLf & obj.ToString, MsgBoxStyle.Critical, "확인")
Return 0
End If
End If
End Function
Public Function TOST(ByVal obj As Object) As String
If obj Is DBNull.Value Then
Return ""
Else
Return CStr(obj)
End If
End Function
''' <summary>
''' 데이터를 모두 되돌립니다.
''' </summary>
''' <param name="SrcDs"></param>
''' <param name="DisplayLabel"></param>
''' <remarks></remarks>
Public Sub Data_Cancel(ByRef SrcDs As DataTable, Optional ByVal DisplayLabel As ToolStripStatusLabel = Nothing)
Dim Change As Integer
Try
Change = SrcDs.GetChanges.Rows.Count
Catch ex As Exception
Change = 0
End Try
If Change > 0 Then
If MsgBox("변경된 내용을 취소하시겠습니까?", CType(MsgBoxStyle.Critical + MsgBoxStyle.OkCancel, MsgBoxStyle), "확인") = MsgBoxResult.Ok Then
SrcDs.RejectChanges()
If Not DisplayLabel Is Nothing Then
NOTICE("변경된 내용이 취소되었습니다", DisplayLabel, Color.Red)
Else
MsgBox("변경된 내용이 취소되었습니다", MsgBoxStyle.Information, "확인")
End If
Else
If Not DisplayLabel Is Nothing Then NOTICE("취소되었습니다", DisplayLabel, Color.Blue)
End If
End If
If Not DisplayLabel Is Nothing Then
NOTICE("변경된 내용이 없습니다.", DisplayLabel, Color.Red)
Else
MsgBox("변경된 내용이 없습니다", MsgBoxStyle.Information, "확인")
End If
End Sub
Public Function EndEdit(ByRef bs As BindingSource) As Boolean
Try
bs.EndEdit()
Catch ex As System.Data.NoNullAllowedException
MsgBox("반드시입력해야할 데이터가 없습니다" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "입력오류")
Return False
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, "처리되지않은 오류발생")
Return False
End Try
Return True
End Function
Public Sub Check_Modify(ByRef DT As DataTable, Optional ByVal prompt As Boolean = True)
Dim Cnt As Integer
Try
Cnt = DT.GetChanges.Rows.Count
Catch ex As Exception
Cnt = 0
End Try
If Cnt < 1 Then
NOTICE("변경된 내용이 없습니다", Nothing, Color.Red)
Return
End If
If prompt Then
If MsgBox("변경된 데이터를 저장하시겠습니까?", CType(MsgBoxStyle.Information + MsgBoxStyle.OkCancel, MsgBoxStyle), "저장확인") <> MsgBoxResult.Ok Then Return
End If
Try
DT.AcceptChanges() '//Set All Green
NOTICE("저장완료", Nothing, Color.Blue)
My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)
Catch ex As Exception
MsgBox("데이터베이스 업데이트중 오류가 발생했습니다" & vbCrLf & vbCrLf & ex.ToString, MsgBoxStyle.Critical, "ERROR-")
NOTICE("저장 실패!", Nothing, Color.Red)
Finally
'view1.ActiveSheet.GetDataView(True) '//화면을 갱신한다.
End Try
End Sub
'//지정된개체내의 컨트롤의 값을 초기화한다.
Public Sub Clear_Control(ByVal Ctl As Control)
Ctl.Focus()
For Each C As Control In Ctl.Controls
MsgBox(C.GetType.ToString)
If C.Controls.Count > 1 Then
Clear_Control(C)
Else
If C.GetType.ToString.ToUpper.IndexOf("TEXTBOX") <> -1 OrElse _
C.GetType.ToString.ToUpper.IndexOf("MYTB") <> -1 OrElse _
C.GetType.ToString.ToUpper.IndexOf("NTB") <> -1 Then
If CType(C, TextBox).ReadOnly = False Then CType(C, TextBox).Text = ""
ElseIf C.GetType.ToString.ToUpper.IndexOf("COMBOBOX") <> -1 OrElse _
C.GetType.ToString.ToUpper.IndexOf("MYCMB") <> -1 Then
'MsgBox("cb")
CType(C, ComboBox).SelectedIndex = -1
End If
End If
Next
End Sub
Public Sub Work_msg(Optional ByVal P_m As String = "잠시만 기다려주세요", Optional ByVal pbar As Boolean = False)
If P_m = "" Then
Frm_Work.Dispose()
Else
If Frm_Work.Visible = False Then Frm_Work.Visible = True
If Frm_Work.ProgressBar1.Visible <> pbar Then Frm_Work.ProgressBar1.Visible = pbar
Frm_Work.Label1.Text = P_m
My.Application.DoEvents()
End If
End Sub
'''화면에메세지를 표시할때사용한다.
Public Sub Work_msg_timer(Optional ByVal P_m As String = "잠시만 기다려주세요", Optional ByVal time As Short = 5)
Frm_Warning.Left = CInt(MdiMain.Left + ((MdiMain.Width - Frm_Warning.Width) / 2))
Frm_Warning.Top = CInt(MdiMain.Top + ((MdiMain.Height - Frm_Warning.Height) / 2))
Frm_Warning.Term = time
Frm_Warning.Second = time
Frm_Warning.Label1.Text = P_m
Frm_Warning.Timer1.Enabled = True
Frm_Warning.Show()
My.Application.DoEvents()
End Sub
Public Sub Work_plus()
If Frm_Work.ProgressBar1.Visible = False Then Frm_Work.ProgressBar1.Visible = True
Frm_Work.ProgressBar1.Value += 1
My.Application.DoEvents()
End Sub
Public Sub INitRow(ByVal Ctl As Control.ControlCollection)
For Each C As Control In Ctl
If C.Controls.Count > 1 Then
INitRow(C.Controls)
Else
If C.GetType.ToString.ToUpper.IndexOf("MYTB") <> -1 Then
If CType(C, MyTb).Text = "" Then CType(C, MyTb).Text = "0"
ElseIf C.GetType.ToString.ToUpper.IndexOf("MYCMB") <> -1 Then
If CType(C, MyCmb).Text = "" AndAlso CType(C, MyCmb).Items.Count > 0 Then CType(C, MyCmb).SelectedIndex = 0
End If
End If
Next
End Sub
Public Function DeCryptArea(ByRef data As Byte(), Optional ByVal pxorkey() As Byte = Nothing) As Byte()
Dim out(data.Length - 1) As Byte
Dim pos As Integer = 0
Dim i As Long = 0
'//처음4바이트확인해서 보낸다.
Dim XorKey() As Byte
If pxorkey Is Nothing Then '//없으면 자동검출
XorKey = New Byte() {data(0), data(1), data(2), data(3)}
Else '//있으면 그걸 사용한다.
XorKey = New Byte() {pxorkey(0), pxorkey(1), pxorkey(2), pxorkey(3)}
End If
For Each b As Byte In data
out(i) = DeCryptByte(b, pos, XorKey)
pos += 1
i += 1
If pos > 3 Then pos = 0
Next
Return out
End Function
Public Function DeCryptByte(ByVal num As Byte, ByVal column As Integer, Optional ByVal a() As Byte = Nothing) As Byte
If a Is Nothing Then a = New Byte() {&HAC, &H29, &H55, &H42}
Return (num Xor a(column))
End Function
Public Function EnCryptByte(ByVal num As Byte, ByVal column As Integer, Optional ByVal a() As Byte = Nothing) As Byte
If a Is Nothing Then a = New Byte() {&HAC, &H29, &H55, &H42}
Return (num Xor a(column))
End Function
End Module