initial commit

This commit is contained in:
raytrace
2018-12-09 20:18:51 +09:00
commit 9aef53ee89
477 changed files with 2867797 additions and 0 deletions

40
ArinWarev1/Module/CForm.Designer.vb generated Normal file
View File

@@ -0,0 +1,40 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class CForm
Inherits C1.Win.C1Ribbon.C1RibbonForm
'Form은 Dispose를 재정의하여 구성 요소 목록을 정리합니다.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Windows Form 디자이너에 필요합니다.
Private components As System.ComponentModel.IContainer
'참고: 다음 프로시저는 Windows Form 디자이너에 필요합니다.
'수정하려면 Windows Form 디자이너를 사용하십시오.
'코드 편집기를 사용하여 수정하지 마십시오.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(CForm))
Me.SuspendLayout()
'
'CForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(496, 319)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "CForm"
Me.Text = "Base Data Form"
Me.VisualStyleHolder = C1.Win.C1Ribbon.VisualStyle.Office2010Silver
Me.ResumeLayout(False)
End Sub
End Class

6293
ArinWarev1/Module/CForm.resx Normal file

File diff suppressed because it is too large Load Diff

110
ArinWarev1/Module/CForm.vb Normal file
View File

@@ -0,0 +1,110 @@
Public Class CForm
Public Parameter As String = "" '//트리노드로부터들어오는 화면파라미터
Public TreeTag As String = "" '//트리노드의 태그값
Public Overridable Function AcceptChanged() As Boolean
Return True
End Function
Public Overridable Function RejectChanged() As Boolean
Return True
End Function
Public Overridable Function HasChanged() As Boolean
Return True
End Function
Private Sub Frm_Base_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
If Not Pub.Setting Is Nothing AndAlso Me.WindowState = FormWindowState.Normal Then
Dim screenCount As Integer = Screen.AllScreens.Length
Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height
Dim iniKeyP As String = "Position{0}{1}"
Dim iniKeyS As String = "Size{0}{1}"
iniKeyP = String.Format(iniKeyP, screenwidth, screenheight)
iniKeyS = String.Format(iniKeyS, screenwidth, screenheight)
Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKeyP, "") = Me.Left.ToString() + "," + Me.Top.ToString()
'고정폼에는 크기를 조정하지 않는다. 160713
If Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedDialog AndAlso
Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.Fixed3D AndAlso
Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedSingle AndAlso
Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedToolWindow Then
Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKeyS, "") = Me.Width.ToString() + "," + Me.Height.ToString()
End If
Pub.Setting.Save()
End If
End Sub
Private Sub Frm_Base_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then
e.Handled = True
e.SuppressKeyPress = True
DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End If
End Sub
Private Sub Frm_Base_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'일반상태일때의 처리
If Me.WindowState = FormWindowState.Normal Then
If StartPosition = FormStartPosition.Manual OrElse StartPosition = FormStartPosition.WindowsDefaultLocation Then
FormPositionLoad()
End If
'고정폼에는 크기를 조정하지 않는다. 160713
If Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedDialog AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.Fixed3D AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedSingle AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedToolWindow Then
FormSizeLoad()
End If
End If
End Sub
Protected Sub FormPositionLoad()
If Pub.Setting IsNot Nothing Then
Dim screenCount As Integer = Screen.AllScreens.Length
Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height
Dim iniKey As String = "Position{0}{1}"
iniKey = String.Format(iniKey, screenwidth, screenheight)
Dim pos As String = Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKey, "")
Dim posbuf As String() = pos.Split(","c)
If posbuf.Length = 2 Then
Me.Left = Integer.Parse(posbuf(0))
Me.Top = Integer.Parse(posbuf(1))
End If
End If
End Sub
Protected Sub FormSizeLoad()
If Pub.Setting IsNot Nothing Then
Dim screenCount As Integer = Screen.AllScreens.Length
Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height
Dim iniKey As String = "Size{0}{1}"
iniKey = String.Format(iniKey, screenwidth, screenheight)
Dim pos As String = Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKey, "")
Dim posbuf As String() = pos.Split(","c)
If posbuf.Length = 2 Then
Me.Width = Integer.Parse(posbuf(0))
Me.Height = Integer.Parse(posbuf(1))
End If
End If
End Sub
End Class

View File

@@ -0,0 +1,8 @@
Public Class CLang
Public Const 미지원UI버젼 As String = "현재파일의 UI Version 은 지원되지 않습니다."
Public Const 열린파일없음 As String = "열려있는 템플릿이 없습니다"
Public Const 종료할래 As String = "종료하시겠습니까?"
Public Const 종료할래2 As String = "현재 파일을 저장 한 후 종료하시겠습니까?"
Public Const 미지원LG버젼 As String = "현재파일의 LG Version 은 지원되지 않습니다."
Public Const 확인 As String = "확인"
End Class

View File

@@ -0,0 +1,17 @@
Public Class CMenu
Private _name As String = ""
Public Sub New(p_name As String)
_name = p_name
End Sub
Public Property Name As String
Get
Return _name
End Get
Set(value As String)
_name = value
End Set
End Property
End Class

14
ArinWarev1/Module/Enum.vb Normal file
View File

@@ -0,0 +1,14 @@
Module EnumMod
Enum E_Level
hide = 0
Normal = 10
Admin = 20
Developer = 30
End Enum
Enum E_VerType
Basic = 0
Pro = 10
Full = 20
Dev = 30
End Enum
End Module

367
ArinWarev1/Module/OD.vb Normal file
View File

@@ -0,0 +1,367 @@
Module OD
Dim T As String = "설정치"
Public Sub Setup_Zone9()
'//존정보설정
DSET1.tbl_zone.Rows.Clear()
If DSET1.tbl_zone.Select("code='0'").GetUpperBound(0) = -1 Then DSET1.tbl_zone.Rows.Add(New String() {"0", "(없음)"})
''1번쨰데이터 (- 9개의 존은 실내존, 북측존, 북동측존, 북서측존, 동측존, 서측존, 남서측존, 남동측존, 남측존, 간접존으로 생성한다)
Dim DR1 As DS.tbl_zoneRow = DSET1.tbl_zone.Newtbl_zoneRow '//실내존
DR1.code = "0001"
DR1.설명 = "실내존"
DR1.침기율 = "0"
DR1.프로필 = ""
DSET1.tbl_zone.Addtbl_zoneRow(DR1)
Dim 층고 As Decimal
Try
층고 = DSET1.tbl_Desc.Rows(0)("층고")
Catch ex As Exception
층고 = 0
End Try
Dim 층수 As Decimal
Try
층수 = DSET1.tbl_Desc.Rows(0)("builds2")
Catch ex As Exception
층수 = 0
End Try
Dim 연면적 As Decimal
Try
연면적 = DSET1.tbl_Desc.Rows(0)("buildm23")
Catch ex As Exception
연면적 = 0
End Try
Dim 천장고 As Decimal
Try
천장고 = DSET1.tbl_Desc.Rows(0)("천장고")
Catch ex As Exception
천장고 = 0
End Try
'Dim 조명밀도 As Decimal
'Try
' 조명밀도 = 25 'DSET1.tbl_elect.Rows(0)("조명밀도")
'Catch ex As Exception
' 조명밀도 = 0
'End Try
Dim 면적의총합 As Decimal = 0
For Each Drz As DS.tbl_zoneRow In DSET1.tbl_zone.Rows '//모든존에 같은 값들은 이곳에다가.
Drz.열교가산치 = "내단열"
Drz.열저장능력 = "90"
'' 실내단말기가 있을경우, 냉난방방식은 냉난방, 공조기기 있으면 냉난방공조는 환기, 외기부하처리여부는 예 //공조기기 없으면 냉난방공조는 기능없음, 외기부하처리여부는 아니오
'' 실내단말기가 없고 공조기기가 있을 경우는 냉난방방식은 기능없음, 냉난방공조는 냉난방, 외기부하처리여부는 아니오
If DSET1.tbl_danmal.Select("code <> '0'").Length > 0 Then
Drz.냉난방방식 = "냉난방"
If DSET1.tbl_kongjo.Select("code <> '0'").Length > 0 Then
Drz.냉난방공조 = "환기"
Drz.외기부하처리여부 = ""
Else
Drz.냉난방공조 = " 기능없음"
Drz.외기부하처리여부 = "아니오"
End If
Else
If DSET1.tbl_kongjo.Select("code <> '0'").Length > 0 Then
Drz.냉난방방식 = "기능없음"
Drz.냉난방공조 = "냉난방"
Drz.외기부하처리여부 = "아니오"
Else
Drz.냉난방방식 = "냉난방"
Drz.냉난방공조 = " 기능없음"
Drz.외기부하처리여부 = "아니오"
End If
End If
Drz.조명부하산출방법 = "입력치"
Drz.조명방식 = "없음"
Drz.인공광원 = "없음"
Drz.프로필 = "0002"
'' 면적이 가장 큰 대표 용도가 공동주택, 숙박시설, 의료시설은 야간 및 주말운전방식은 정상가동, 기타 시설은 가동정지
Drz.야간운전방식 = "가동정지"
Drz.주말운전방식 = "가동정지"
'//시설용도로 그룹을 내서 면접의 합산을 구한다.
Dim Grp시설용도 As New Dictionary(Of String, Single)
Dim TotalArea As Single = 0
For Each dr As DS.tbl_typeRow In DSET1.tbl_type.Rows
If Program = EProgram.총량평가 Then
TotalArea += dr.면적
Else
TotalArea += dr.세대면적 * dr.세대수
End If
If Grp시설용도.ContainsKey(dr.시설용도) Then
Dim 기존값 As Single = Grp시설용도.Item(dr.시설용도)
If Program = EProgram.총량평가 Then
Grp시설용도.Item(dr.시설용도) = 기존값 + dr.면적
Else
Grp시설용도.Item(dr.시설용도) = 기존값 + dr.세대면적 * dr.세대수
End If
Else
If Program = EProgram.총량평가 Then
Grp시설용도.Add(dr.시설용도, dr.면적)
Else
Grp시설용도.Add(dr.시설용도, dr.세대면적 * dr.세대수)
End If
End If
Next
'//empty data (code = 0)
Dim drprof As DS.tbl_profile_odRow = DSET1.tbl_profile_od.Select("code = '0'")(0)
If Program = EProgram.총량평가 Then
'//가장큰 용도찾기
Dim 큰용도 As String = ""
Dim 큰용도면적 As Single = 0
For Each grpRow As System.Collections.Generic.KeyValuePair(Of String, Single) In Grp시설용도
If grpRow.Value > 큰용도면적 Then
큰용도면적 = grpRow.Value
큰용도 = grpRow.Key
End If
Next
If Not String.IsNullOrEmpty(큰용도) Then
Dim mxprof As DS.tbl_profile_odRow = DSET1.tbl_profile_od.Select("code = '" + 큰용도 + "'")(0)
drprof.사용시작시간 = mxprof.사용시작시간
drprof.사용종료시간 = mxprof.사용종료시간
drprof.운전시작시간 = mxprof.운전시작시간
drprof.운전종료시간 = mxprof.운전종료시간
drprof.난방설정온도 = mxprof.난방설정온도
drprof.냉방설정온도 = mxprof.냉방설정온도
drprof.야간최저허용온도 = mxprof.야간최저허용온도
drprof.주말최저허용온도 = mxprof.주말최저허용온도
drprof.일일사용시간 = 0
drprof.일일운전시간 = 0
drprof.일일급탕요구량 = 0
drprof.최소도입외기량 = 0
drprof.사람 = 0
drprof.작업보조기기 = 0
drprof.운전시간난방 = 0
drprof.day01 = 0
drprof.day02 = 0
drprof.day03 = 0
drprof.day04 = 0
drprof.day05 = 0
drprof.day06 = 0
drprof.day07 = 0
drprof.day08 = 0
drprof.day09 = 0
drprof.day10 = 0
drprof.day11 = 0
drprof.day12 = 0
For Each grpRow As System.Collections.Generic.KeyValuePair(Of String, Single) In Grp시설용도
Dim multirate As Single = grpRow.Value / TotalArea
Dim oneprof As DS.tbl_profile_odRow = DSET1.tbl_profile_od.Select("code = '" + grpRow.Key + "'")(0)
drprof.일일사용시간 += TOSG(T, oneprof.일일사용시간) * multirate
drprof.일일운전시간 += TOSG(T, oneprof.일일운전시간) * multirate
drprof.일일급탕요구량 += TOSG(T, oneprof.일일급탕요구량) * multirate
drprof.최소도입외기량 += TOSG(T, oneprof.최소도입외기량) * multirate
drprof.사람 += TOSG(T, oneprof.사람) * multirate
drprof.작업보조기기 += TOSG(T, oneprof.작업보조기기) * multirate
drprof.운전시간난방 += TOSG(T, oneprof.운전시간난방) * multirate
drprof.day01 += TOSG(T, oneprof.day01) * multirate
drprof.day02 += TOSG(T, oneprof.day02) * multirate
drprof.day03 += TOSG(T, oneprof.day03) * multirate
drprof.day04 += TOSG(T, oneprof.day04) * multirate
drprof.day05 += TOSG(T, oneprof.day05) * multirate
drprof.day06 += TOSG(T, oneprof.day06) * multirate
drprof.day07 += TOSG(T, oneprof.day07) * multirate
drprof.day08 += TOSG(T, oneprof.day08) * multirate
drprof.day09 += TOSG(T, oneprof.day09) * multirate
drprof.day10 += TOSG(T, oneprof.day10) * multirate
drprof.day11 += TOSG(T, oneprof.day11) * multirate
drprof.day12 += TOSG(T, oneprof.day12) * multirate
Next
Else
MsgBox("해당 용도를 입력하세요")
End If
Else
'//친환경 프로파일은 5000번 사용함 1706280040
Dim dr5000() As DS.tbl_profile_odRow = DSET1.tbl_profile_od.Select("code = '5000'")
If dr5000.Length > 0 Then
For Each Col As System.Data.DataColumn In DSET1.tbl_profile_od.Columns
If Col.ColumnName.ToUpper() = "CODE" Then Continue For
drprof(Col.ColumnName) = dr5000(0)(Col.ColumnName)
Next
Else
MsgBox("프로필(친환경) 자료없음")
End If
End If
drprof.AcceptChanges()
Dim 입력면면적 As Decimal = 0
Select Case Drz.설명
Case "실내존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and (방위='수평' or 방위='일사없음')")
Dr면.존분류 = Drz.code
Next
입력면면적 = 0
Case "북측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='북'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "북동측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='북동'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "북서측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='북서'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "동측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='동'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "서측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='서'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "남동측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='남동'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "남서측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='남서'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "남측존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("(건축부위방식 = '외벽' or 건축부위방식='외부창') and 방위='남'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
Case "간접존"
For Each Dr면 As DS.tbl_myounRow In DSET1.tbl_myoun.Select("건축부위방식 = '내벽' or 건축부위방식='내부창'")
If IsNumeric(Dr면.건축부위면적) Then 입력면면적 += Dr면.건축부위면적
Dr면.존분류 = Drz.code
Next
End Select
If 층수 <> 0 AndAlso 층고 <> 0 Then
If (입력면면적 / (층고 * 층수)) - 5 >= 0 Then
Drz.면적 = ((입력면면적 / (층고 * 층수)) - 2.5) * 5 * 층수
Else
Drz.면적 = (입력면면적 / (층고 * 층수)) / 2 * 5 * 층수
End If
Else
Drz.면적 = 0
End If
If Drz.설명 <> "실내존" Then
면적의총합 += Drz.면적
Drz.순실체적 = Drz.면적 * 천장고
End If
' Drz.조명에너지부하율입력치 = 조명밀도
Next
If 연면적 - 면적의총합 > 0 Then
DSET1.tbl_zone.Rows(1)("면적") = 연면적 - 면적의총합 '//실내존의면적
DSET1.tbl_zone.Rows(1)("순실체적") = (연면적 - 면적의총합) * 천장고
Else
DSET1.tbl_zone.Rows(1)("면적") = 0
DSET1.tbl_zone.Rows(1)("순실체적") = 0
End If
'///////////////////////////////////////////////////////////////////////////
' 2017. 05.14 수정
'///////////////////////////////////////////////////////////////////////////
Dim dr존0 As DS.tbl_zoneRow = DSET1.tbl_zone.Select("code<>'0'", "code")(0)
Dim drDesc As DS.tbl_DescRow = DSET1.tbl_Desc.Rows(0)
dr존0.면적 = 0
'//층별개요(신규추가됨)
For Each DRType As DS.tbl_typeRow In DSET1.tbl_type.Select("code<>'0'", "code") ' DSET1.tbl_zone.Rows.Count '(3)
If Program = EProgram.총량평가 Then
dr존0.면적 = TOSG(T, dr존0.면적) + DRType.면적
dr존0.침기율 = 1.5
Else
dr존0.면적 = TOSG(T, dr존0.면적) + DRType.세대면적 * DRType.세대수
dr존0.침기율 = 6
End If
Next
'//천장고
Dim 순실체적 As Double = TOSG(T, dr존0.면적) * TOSG(T, drDesc.천장고)
dr존0.순실체적 = 순실체적
dr존0.열교가산치 = "내단열"
dr존0.열저장능력 = "90"
If Program = EProgram.총량평가 Then
dr존0.야간운전방식 = "가동정지" '숙박, 의료, 주택이 주용도인 경우 정상가동
dr존0.주말운전방식 = "가동정지" '숙박, 의료, 주택이 주용도인 경우 정상가동
dr존0.냉난방방식 = "기능없음"
dr존0.냉난방공조 = "냉난방"
dr존0.외기부하처리여부 = "아니오" '=============2017.12.25 추가
Else
dr존0.야간운전방식 = "정상가동" '숙박, 의료, 주택이 주용도인 경우 정상가동
dr존0.주말운전방식 = "정상가동" '숙박, 의료, 주택이 주용도인 경우 정상가동
dr존0.냉난방방식 = "냉난방"
dr존0.냉난방공조 = "환기"
dr존0.외기부하처리여부 = "아니오" '=============2017.12.25 추가
End If
'//조명전력합
Dim 조명면적합 As Double = 0
Dim 조명전력합 As Double = 0
For Each dr As DS.tbl_typeRow In DSET1.tbl_type.Select("code<>'0'", "code")
If Program = EProgram.총량평가 Then
조명면적합 += TOSG(T, dr.면적)
Else
조명면적합 += TOSG(T, dr.세대면적 * dr.세대수)
End If
Next
For Each dr조명 As DS.tbl_lightRow In DSET1.tbl_light.Select("code<>'0'", "code")
'조명면적합 += TOSG(T, dr조명.조명면적)
조명전력합 = 조명전력합 + (TOSG(T, dr조명.조명전력) * TOSG(T, dr조명.대수))
Next
If 조명면적합 = 0 Then
Log.AppendLine("조명면적합 = 0")
dr존0.조명에너지부하율입력치 = 0
Else
dr존0.조명에너지부하율입력치 = 조명전력합 / 조명면적합
End If
dr존0.EndEdit()
DSET1.AcceptChanges() '//
End Sub
End Module

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

@@ -0,0 +1,613 @@
Imports System.Net.NetworkInformation
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 Enum EProgram
총량평가
친환경평가
End Enum
Public Prj As New s_Project : Public StartVersion As String = "2010032000"
Public Setting As arUtil.Setting
Public Program As EProgram
' Public Uselov As Lov.ModLov
Public PreFile(10) 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")
'//eco2-od
Public CalcO As CalculatorOD '//계산로직이다.파일열릴떄 할당됨
Public Result1o As New CResultOD() '//기본데이터결과
Public Log As New System.Text.StringBuilder
Public EnDec As New ArinLogin.EnDec("tindevil.com")
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
''' <summary>
''' 인터넷에 연결되었는지를 체크합니다.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function CheckInternet()
Try
Dim myping As New Ping()
Dim host As String = "google.com"
Dim buffer(31) As Byte
Dim timeout As Integer = 1000
Dim pingOpt As New PingOptions()
Dim rep As PingReply = myping.Send(host, timeout, buffer, pingOpt)
If rep.Status = IPStatus.Success Then
Return True
Else
Return False
End If
Catch ex As Exception
Return False
End Try
End Function
Public Sub ClearfGridColWidth(grid As C1.Win.C1FlexGrid.C1FlexGrid)
For i As Integer = 0 To grid.Cols.Count - 1
If Not grid.Cols(i).Visible Then Continue For
grid.Cols(i).Width = -1
Next
End Sub
Public Sub SavefGridColWidth(fName As String, grid As C1.Win.C1FlexGrid.C1FlexGrid)
Dim keyname As String = fName + "_" + grid.Name
If Pub.Program = EProgram.친환경평가 Then
keyname = fName + "_1_" + grid.Name
End If
For i As Integer = 0 To grid.Cols.Count - 1
If Not grid.Cols(i).Visible Then Continue For
If String.IsNullOrEmpty(grid.Cols(i).Name) Then Continue For
Pub.Setting.Data(keyname, grid.Cols(i).Name) = grid.Cols(i).Width
Next
End Sub
Public Sub ReadfGridColWidth(fName As String, grid As C1.Win.C1FlexGrid.C1FlexGrid)
Dim keyname As String = fName + "_" + grid.Name
If Pub.Program = EProgram.친환경평가 Then
keyname = fName + "_1_" + grid.Name
End If
For i As Integer = 0 To grid.Cols.Count - 1
If Not grid.Cols(i).Visible Then Continue For
If String.IsNullOrEmpty(grid.Cols(i).Name) Then Continue For
Dim wid As String = Pub.Setting.Data(keyname, grid.Cols(i).Name, "-1")
grid.Cols(i).Width = Integer.Parse(wid)
Next
End Sub
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_common_odRow = CType(DSET1.tbl_common_od.Select("gubun='" & gubun & "' and name='" & name & "'"), DS.tbl_common_odRow())
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_common_odRow = CType(DSET1.tbl_common_od.Select("gubun='" & gubun & "' and code='" & code & "'"), DS.tbl_common_odRow())
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
Public Sub Read_CommonCode_OD(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("CO") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
Try
Dim TaC As New DSTableAdapters.tbl_common_odTableAdapter
TaC.Fill(DSET1.tbl_common_od)
'DSET1.tbl_common_od.Clear()
'DSET1.tbl_common_od.AcceptChanges()
'DSET1.tbl_common_od.Merge(DSET1.tbl_common_od)
'DSET1.tbl_common_od.Clear()
DSET1.tbl_common_od.AcceptChanges()
DSET1.tbl_Desc.Rows(0)("versionc") = Version
DSET1.AcceptChanges()
Catch ex As Exception
MsgBox("공용코드 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
End Try
'MsgBox(Version)
Work_msg("")
End Sub
Public Sub Read_Profile_OD(Optional ByVal Version As String = "")
Work_msg("표준프로파일(OD) 확인중")
If Version = "" Then
Dim L As New ArinLogin.ArinLOgin
Dim VersionInfo As ArinLogin.ArinLOgin.sVersionInfo = Nothing
VersionInfo = L.Get_LastVersion("PO") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
Try
Dim TaC As New DSTableAdapters.tbl_profile_odTableAdapter
TaC.Fill(DSET1.tbl_profile_od)
'DSET1.tbl_profile_od.Clear()
'DSET1.tbl_profile_od.AcceptChanges()
'DSET1.tbl_profile_od.Merge(DSET1.tbl_profile_od)
'DSET1.tbl_profile_od.Clear()
DSET1.tbl_profile_od.AcceptChanges()
DSET1.tbl_Desc.Rows(0)("versionp") = Version
DSET1.AcceptChanges()
Catch ex As Exception
MsgBox("표준프로파일(OD) 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
End Try
'MsgBox(Version)
Work_msg("")
End Sub
Public Sub Read_WatherGroup()
DSET1.weather_group.Clear()
DSET1.weather_group.AcceptChanges()
Try
Dim TaC As New DSTableAdapters.weather_groupTableAdapter
TaC.Fill(DSET1.weather_group)
Catch ex As Exception
MsgBox("기상데이터(그룹) 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
End Try
End Sub
Public Sub Read_WeatherData_OD(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("W") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
DSET1.tbl_weather_od.Clear()
DSET1.weather_cha_od.Clear()
DSET1.weather_ilsa_od.Clear()
DSET1.weather_temp_od.Clear()
DSET1.weather_supdo_od.Clear()
DSET1.AcceptChanges()
Try
Dim TaC As New DSTableAdapters.tbl_weather_odTableAdapter
TaC.Fill(DSET1.tbl_weather_od)
Catch ex As Exception
MsgBox("기상데이터0 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_cha_odTableAdapter
TaC.Fill(DSET1.weather_cha_od)
Catch ex As Exception
MsgBox("기상데이터1 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_ilsa_odTableAdapter
TaC.Fill(DSET1.weather_ilsa_od)
Catch ex As Exception
MsgBox("기상데이터2 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_supdo_odTableAdapter
TaC.Fill(DSET1.weather_supdo_od)
Catch ex As Exception
MsgBox("기상데이터3 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
Try
Dim TaC As New DSTableAdapters.weather_temp_odTableAdapter
TaC.Fill(DSET1.weather_temp_od)
Catch ex As Exception
MsgBox("기상데이터4 업데이트실패" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical, "확인")
Iserror = True
End Try
'DSET1.tbl_weather.Merge(DSET1.tbl_weather_od)
'DSET1.weather_cha.Merge(DSET1.weather_cha_od)
'DSET1.weather_ilsa.Merge(DSET1.weather_ilsa_od)
'DSET1.weather_temp.Merge(DSET1.weather_temp_od)
'DSET1.weather_supdo.Merge(DSET1.weather_supdo_od)
'DSET1.tbl_weather_od.Clear()
'DSET1.weather_cha_od.Clear()
'DSET1.weather_ilsa_od.Clear()
'DSET1.weather_temp_od.Clear()
'DSET1.weather_supdo_od.Clear()
DSET1.AcceptChanges()
If Iserror = False Then
DSET1.tbl_Desc.Rows(0)("versionw") = Version
'MsgBox(Version)
DSET1.AcceptChanges()
End If
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("P2") '//버젼을 가져오는데 eco 버젼만 가져오게 바꺼야겟죵 ^^ 구분자를 넣도록 합시닷!
Version = VersionInfo.Ver
End If
Try
Dim TaC As New DSTableAdapters.tbl_profile_odTableAdapter
TaC.Fill(DSET1.tbl_profile_od)
DSET1.tbl_Desc.Rows(0)("versionp") = Version
DSET1.AcceptChanges()
'TaC.Fill(DSET2.tbl_profile)
'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 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, "확인")
Throw New Exception("[TOIT]숫자형식이 요구되지만 문자가 들어있습니다" & vbCrLf & obj.ToString)
' Return 0
End If
End If
End Function
Public Function TOSG(T As String, 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:" + T + "]에서 '" & obj & "'")
Throw New Exception("TOSG Error")
Return 0
End Try
Else
'MsgBox( & vbCrLf & obj.ToString, MsgBoxStyle.Critical, "확인")
Throw New Exception("[TOSG" + T + "]숫자형식이 요구되지만 문자(" + obj.ToString() + ")가 들어있습니다")
'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 & "'")
Throw New Exception("[TOSG]에서 '" & obj & "'")
Return 0
End Try
Else
'MsgBox("[TOSG]숫자형식이 요구되지만 문자(" + obj.ToString() + ")가 들어있습니다" & vbCrLf & obj.ToString, MsgBoxStyle.Critical, "확인")
Throw New Exception("[TOSG]숫자형식이 요구되지만 문자(" + obj.ToString() + ")가 들어있습니다" & vbCrLf & obj.ToString)
End If
End If
End Function
'Public Function TOSG(T,ByVal obj As Object, Optional tag As Integer = 0) 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:" + tag.ToString() + "]에서 '" & obj & "'")
' Return 0
' End Try
' Else
' MsgBox("[TOSG" + tag.ToString() + "]숫자형식이 요구되지만 문자가 들어있습니다" & 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
'//처음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 i As Integer = 0 To data.Length - 1
out(i) = EnCryptByte(data(i), i, XorKey)
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}
Dim mok As Integer = column Mod 4
Return (num Xor a(mok))
End Function
Public Function EnctryArea(ByRef data As Byte()) As Byte()
Dim out(data.Length - 1) As Byte
For i As Integer = 0 To data.Length - 1
Dim b As Byte = EnCryptByte(data(i), i)
out(i) = b
Next
Return out
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}
Dim mok As Integer = column Mod 4
Return (num Xor a(mok))
End Function
End Module