175 lines
6.1 KiB
VB.net
175 lines
6.1 KiB
VB.net
Public Class Frm_V20091231_buha
|
|
|
|
#Region "data Base 변경여부및 적용방법"
|
|
|
|
'''변경된내용을적용한다.
|
|
Public Overrides Function AcceptChanged() As Boolean
|
|
bs.EndEdit()
|
|
Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
|
|
Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
|
|
BaseDT.AcceptChanges()
|
|
Return True
|
|
End Function
|
|
|
|
'''변경된내용이있다면 취소한다.
|
|
Public Overrides Function RejectChanged() As Boolean
|
|
Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
|
|
Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
|
|
BaseDT.RejectChanges()
|
|
Return True
|
|
End Function
|
|
|
|
'''데이터에변형이있었는가?
|
|
Public Overrides Function HasChanged() As Boolean
|
|
bs.EndEdit()
|
|
Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
|
|
Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember)
|
|
Dim ChangeDT As DataTable = BaseDT.GetChanges
|
|
If Not ChangeDT Is Nothing Then Return True
|
|
Return False
|
|
End Function
|
|
|
|
'''기본데이터테이블을 반환합니다.
|
|
Public Function DT() As DataTable
|
|
Dim BaseDS As DataSet = CType(bs.DataSource, DataSet)
|
|
Return BaseDS.Tables(bs.DataMember)
|
|
End Function
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
Public Sub New(_opentime)
|
|
|
|
' 이 호출은 디자이너에 필요합니다.
|
|
InitializeComponent()
|
|
OpenTime = _opentime
|
|
|
|
' InitializeComponent() 호출 뒤에 초기화 코드를 추가하십시오.
|
|
|
|
End Sub
|
|
|
|
Private Sub AddNewDataRow_Zone_Changed2(ByVal sender As Object, ByVal e As System.Data.DataColumnChangeEventArgs)
|
|
Dim oval As String = e.Row(e.Column.ColumnName).ToString
|
|
Dim nval As String = e.ProposedValue.ToString
|
|
If oval <> nval Then
|
|
Dim newdr As DS2.historyRow = DSHistory.history.NewhistoryRow
|
|
newdr.time = Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
newdr.tablename = "tbl_buha"
|
|
newdr.ovalue = oval
|
|
newdr.nvalue = nval
|
|
newdr.column = e.Column.ColumnName
|
|
newdr.code = e.Row("code").ToString
|
|
DSHistory.history.AddhistoryRow(newdr)
|
|
DSHistory.history.AcceptChanges()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ShowHistory()
|
|
Dim drv As DataRowView = Me.bs.Current
|
|
Dim f As New Frm_History("tbl_buha", drv("code").ToString)
|
|
If f.ShowDialog = DialogResult.OK Then
|
|
drv(f.colname) = f.val
|
|
Me.Validate()
|
|
Me.bs.EndEdit()
|
|
My.Application.DoEvents()
|
|
MsgBox("값이 변경되었습니다", MsgBoxStyle.Information, "확인")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MdiMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
|
|
Select Case e.KeyCode
|
|
Case Keys.F12
|
|
ShowHistory()
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub MdiMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
|
|
Me.Show()
|
|
My.Application.DoEvents()
|
|
'Work_msg_timer("잠시만 기다려주세요")
|
|
|
|
'CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me)
|
|
'//프로필 관련
|
|
|
|
'//공유데이터셋에 연결한다.
|
|
Me.bs.DataSource = DSET1
|
|
|
|
'//냉방기기
|
|
AddHandler DSET1.tbl_buha.TableNewRow, AddressOf AddNewDataRow_nangbangkiki
|
|
AddHandler DSET1.tbl_buha.ColumnChanging, AddressOf AddNewDataRow_Zone_Changed2
|
|
|
|
'//콤보컨트롤 바인딩
|
|
Binding_Zone()
|
|
|
|
Try
|
|
Me.bs.Position = CEnergy.ARINCLASS.Read_LastPos_Frm(Me)
|
|
Catch ex As Exception
|
|
Me.bs.MoveFirst()
|
|
End Try
|
|
AddDebug("▲ Form Load")
|
|
End Sub
|
|
|
|
|
|
#Region "냉방기기"
|
|
Private Sub MdiMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
|
|
CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me, Me.bs.Position, True)
|
|
End Sub
|
|
Private Function GetMaxCode(ByVal dt As DataTable) As String
|
|
Try
|
|
Dim Dr As DataRow = dt.Select("", "code desc")(0)
|
|
Return Format(CInt(Dr("code")) + 1, "0000")
|
|
Catch ex As Exception
|
|
Return "0001"
|
|
End Try
|
|
End Function
|
|
|
|
Private Sub Cmb_DeleteVal(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
|
|
If e.KeyCode = Keys.Delete Then
|
|
CType(sender, ComboBox).SelectedValue = ""
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Binding_Zone()
|
|
'//냉동기기
|
|
'Dim bs_냉동기방식ComboBox As New BindingSource(DSET, "tbl_common")
|
|
'bs_냉동기방식ComboBox.Filter = "gubun='1046'"
|
|
'Me.냉동기방식ComboBox.DataSource = bs_냉동기방식ComboBox
|
|
'냉동기방식ComboBox.DisplayMember = "name"
|
|
'냉동기방식ComboBox.ValueMember = "code"
|
|
'Me.냉동기방식ComboBox.DataBindings.Add("text", Me.bs, "냉동기방식")
|
|
'AddHandler 냉동기방식ComboBox.KeyDown, AddressOf Cmb_DeleteVal
|
|
|
|
End Sub
|
|
Private Sub AddNewDataRow_nangbangkiki(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs)
|
|
e.Row.Item("code") = GetMaxCode(DSET1.tbl_buha)
|
|
End Sub
|
|
Private Sub ToolStripButton48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton48.Click
|
|
|
|
If Not EndEdit(Me.bs) Then Return
|
|
Me.bs.AddNew()
|
|
|
|
End Sub
|
|
Private Sub ToolStripButton49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton49.Click
|
|
|
|
DbBase.DelCrow(Me.bs, True)
|
|
|
|
End Sub
|
|
|
|
Private Sub ToolStripButton51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton51.Click
|
|
|
|
If Not EndEdit(Me.bs) Then Return
|
|
Data_Cancel(DSET1.tbl_buha, Nothing)
|
|
|
|
End Sub
|
|
#End Region
|
|
Private Sub bs_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bs.CurrentChanged
|
|
Me.bs.EndEdit()
|
|
End Sub
|
|
|
|
Private Sub Arindv9_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Arindv9.CellContentClick
|
|
|
|
End Sub
|
|
End Class |