Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Collections.Generic
Imports JobServer.ScriptingInterface

'' Script Template: 
''  Date         Person        ChangeInfo
''  12.04.2007   J.Feuerstein  createt
'' 
'' # Dokumentation:
'' # 
'' # Parameters: 

Namespace ScriptingDataSetUpdate
    Public Class ScriptingEngineClass
		Public Function ScriptMain(ByVal JS_ScriptingInterface As JobServer.ScriptingInterface.Methodes) As JobServer.JS_Return_cls 
			
			' Required class for returning script results
			Dim MyScriptReturn As New JobServer.JS_Return_cls
			'Dim MyCallReturn   As New JobServer.JS_Return_cls  
			
			Dim I As Integer = 5
			Dim I2 As Integer  
						
			' Example: using "standard form" for printing script informations 
			Dim MyScriptOutput_frm As New JobServer.JobServer_ScriptRun_frm(JS_ScriptingInterface.ScriptDef) 
			MyScriptOutput_frm.Show()
			 
			' Example: for printing Informations to the header textbox 
			MyScriptOutput_frm.InfoSysHeader.PrintInfoLine("Step - 1 Script started")
			
			Try
				' Example: parsing parameters 
				Dim Opt1 As String = JS_ScriptingInterface.ParameterValueGet("Opt1")  
				Dim DSEdit_lcls As New JobServer.DSEdit_cls
				' starting the progress bar
				MyScriptOutput_frm.InfoSysProtocol.StatusBarProgressBarStart 
				MyScriptOutput_frm.InfoSysHeader.Print("Step - 2 Script is in process")   
			
				With DSEdit_lcls
					.ColumeNameEditTarget_SetBy_ProcStateColNum = "02"
				End With
				
				With DSEdit_lcls.DS.Ir
					'.Item_and_Rev_Parse_from_ItemNameRev("000024/A")
					.Item_and_Rev_Parse_from_ItemNameRev("000130/A")
					.ObjectFromSiteID = "tceng"
				End With
				
				With DSEdit_lcls.DS 
					.DatasetObjectType = "UGMASTER"
					'.DatasetCLIName = "@DB/000024/A/master/000024-A"
				End With
				
				With DSEdit_lcls.EditValue 
					.ValueNew = "U3"
					.ValueOld = "N"
				End With
				
				MyScriptReturn = JS_ScriptingInterface.DS_Edit_ProcessState(DSEdit_lcls)
			
				
			Catch ex As Exception
				MyScriptReturn.Ex = ex
				MyScriptReturn.ExUp = True
				MyScriptReturn.ExMsg = JS_ScriptingInterface.ScriptDef.NameDescription  
				MyScriptOutput_frm.InfoSysProtocol.PrintEx(ex, MyScriptReturn.ExMsg)
				GoTo EndOfScript:
			End Try

			Call MyScriptOutput_frm.InfoSysProtocol.StatusBarProgressBarSetIdle   

			EndOfScript:
			   
			Call MyScriptOutput_frm.InfoSysProtocol.PrintInfoLine(MyScriptReturn.ResultMsg)
			MyScriptOutput_frm.Pause
			
			' Example: closing the ScriptRun form 
			MyScriptOutput_frm.Close 
			MyScriptOutput_frm.Dispose()
			
			Return MyScriptReturn
		End Function
	End Class
End Namespace
