diff --git a/GUIs.Common/Common.vbproj b/GUIs.Common/Common.vbproj index e2a874b6..8ee7a874 100644 --- a/GUIs.Common/Common.vbproj +++ b/GUIs.Common/Common.vbproj @@ -118,6 +118,7 @@ Form + diff --git a/GUIs.Common/DocumentResultList/CheckInOut.vb b/GUIs.Common/DocumentResultList/CheckInOut.vb new file mode 100644 index 00000000..08ebf524 --- /dev/null +++ b/GUIs.Common/DocumentResultList/CheckInOut.vb @@ -0,0 +1,49 @@ +Imports DigitalData.Modules.Base +Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.Logging + +Namespace DocumentResultList + Public Class CheckInOut + Inherits BaseClass + Private Client As Client + + Public Sub New(pLogConfig As LogConfig, pClient As Client) + MyBase.New(pLogConfig) + Client = pClient + End Sub + + Public Async Function GetCheckoutState(pObjectId As Long) As Task(Of CheckoutState) + Try + Dim oSQL = $"SELECT * FROM VWOBJECT_CHECKED_OUT WHERE IDB_OBJ_ID = {pObjectId}" + Dim oResponse = Await Client.GetDatatableFromIDBAsync(oSQL) + + If oResponse.ok = False Then + Return Nothing + End If + + If oResponse.Table.Rows.Count = 0 Then + Return New CheckoutState() + End If + + Dim oRow = oResponse.Table.Rows.Item(0) + Dim oState As New CheckoutState With { + .IsCheckedOut = True, + .CheckedOutWhen = oRow.Item("CHECKED_OUT_WHEN"), + .CheckedOutWho = oRow.Item("EMAIL") + } + + Return oState + + Catch ex As Exception + Logger.Error(ex) + Return Nothing + End Try + End Function + + Public Class CheckoutState + Public Property IsCheckedOut As Boolean = False + Public Property CheckedOutWhen As Date = Nothing + Public Property CheckedOutWho As String = Nothing + End Class + End Class +End Namespace diff --git a/GUIs.Common/My Project/licenses.licx b/GUIs.Common/My Project/licenses.licx index a411537a..d7156af2 100644 --- a/GUIs.Common/My Project/licenses.licx +++ b/GUIs.Common/My Project/licenses.licx @@ -1,10 +1,11 @@ -DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.Repository.RepositoryItemDateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a -DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/GUIs.Common/ObjectPropertyDialog/ctrlObjectPropertyDialog.Designer.vb b/GUIs.Common/ObjectPropertyDialog/ctrlObjectPropertyDialog.Designer.vb index 788532c8..6bacebd3 100644 --- a/GUIs.Common/ObjectPropertyDialog/ctrlObjectPropertyDialog.Designer.vb +++ b/GUIs.Common/ObjectPropertyDialog/ctrlObjectPropertyDialog.Designer.vb @@ -122,7 +122,6 @@ Partial Class ctrlObjectPropertyDialog 'XtraTabControl1 ' Me.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill - Me.XtraTabControl1.HeaderLocation = DevExpress.XtraTab.TabHeaderLocation.Bottom Me.XtraTabControl1.Location = New System.Drawing.Point(0, 30) Me.XtraTabControl1.Name = "XtraTabControl1" Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPageObject diff --git a/GUIs.Common/frmDocumentResultList.Designer.vb b/GUIs.Common/frmDocumentResultList.Designer.vb index d08b87ca..49456117 100644 --- a/GUIs.Common/frmDocumentResultList.Designer.vb +++ b/GUIs.Common/frmDocumentResultList.Designer.vb @@ -21,7 +21,7 @@ Partial Class frmDocumentResultList Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmDocumentResultList)) - Dim PushTransition1 As DevExpress.Utils.Animation.PushTransition = New DevExpress.Utils.Animation.PushTransition() + Dim FadeTransition1 As DevExpress.Utils.Animation.FadeTransition = New DevExpress.Utils.Animation.FadeTransition() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.GridControl1 = New DevExpress.XtraGrid.GridControl() Me.GridView1 = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridView() @@ -96,6 +96,17 @@ Partial Class frmDocumentResultList Me.DockManager1 = New DevExpress.XtraBars.Docking.DockManager(Me.components) Me.DockPanelFileList = New DevExpress.XtraBars.Docking.DockPanel() Me.DockPanel2_Container = New DevExpress.XtraBars.Docking.ControlContainer() + Me.panelContainer1 = New DevExpress.XtraBars.Docking.DockPanel() + Me.DockPanelStatus = New DevExpress.XtraBars.Docking.DockPanel() + Me.ControlContainer1 = New DevExpress.XtraBars.Docking.ControlContainer() + Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl() + Me.txtCheckedOutWho = New DevExpress.XtraEditors.TextEdit() + Me.dateCheckedOutWhen = New DevExpress.XtraEditors.DateEdit() + Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() + Me.LayoutControlGroup1 = New DevExpress.XtraLayout.LayoutControlGroup() + Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem() + Me.EmptySpaceItem1 = New DevExpress.XtraLayout.EmptySpaceItem() Me.DockPanelMetadata = New DevExpress.XtraBars.Docking.DockPanel() Me.DockPanel3_Container = New DevExpress.XtraBars.Docking.ControlContainer() Me.CtrlObjectPropertyDialog = New DigitalData.GUIs.Common.ctrlObjectPropertyDialog() @@ -126,6 +137,19 @@ Partial Class frmDocumentResultList CType(Me.DockManager1, System.ComponentModel.ISupportInitialize).BeginInit() Me.DockPanelFileList.SuspendLayout() Me.DockPanel2_Container.SuspendLayout() + Me.panelContainer1.SuspendLayout() + Me.DockPanelStatus.SuspendLayout() + Me.ControlContainer1.SuspendLayout() + CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.LayoutControl1.SuspendLayout() + CType(Me.txtCheckedOutWho.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateCheckedOutWhen.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateCheckedOutWhen.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).BeginInit() Me.DockPanelMetadata.SuspendLayout() Me.DockPanel3_Container.SuspendLayout() Me.DockPanelDocViewer.SuspendLayout() @@ -192,7 +216,7 @@ Partial Class frmDocumentResultList Me.RibbonControl.ExpandCollapseItem.Id = 0 Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.SwitchMainContainerHorizontal, Me.SwitchDetailContainerHorizontal, Me.BarButtonItemExportGrid1, Me.BarStaticItem1, Me.labelResultCount, Me.BarButtonBack, Me.BarButtonResetLayout, Me.labelCriticalError, Me.labelWarning, Me.MenuItemFileOpen, Me.MenuItemPropertiesIDB, Me.MenuItemFolderOpen, Me.MenuItemFilepathCopy, Me.MenuItemFolderpathCopy, Me.MenuItemProperties, Me.MenuItemsOpenFileZooFlow, Me.MenuItemPropertiesZooFlow, Me.ButtonRefresh, Me.BarButtonItem1, Me.BarButtonItem2, Me.BarButtonItem3, Me.BarButtonItem4, Me.BarButtonItem5, Me.BarButtonItem6, Me.MenuItemStartAdhocWorkflow, Me.MenuItemCheckInFile, Me.MenuItemCheckOutFile, Me.MenuItemVersionFile, Me.chkGridShowQuickfilter, Me.chkGridShowGrouping, Me.chkGridShowTitle, Me.MenuItemSaveProperties, Me.BarButtonItem11, Me.BarWorkspaceMenuItem1}) resources.ApplyResources(Me.RibbonControl, "RibbonControl") - Me.RibbonControl.MaxItemId = 46 + Me.RibbonControl.MaxItemId = 48 Me.RibbonControl.Name = "RibbonControl" Me.RibbonControl.PageCategories.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageCategory() {Me.RibbonPageCategoryFile, Me.RibbonPageCategoryAttribute}) Me.RibbonControl.PageHeaderItemLinks.Add(Me.BarWorkspaceMenuItem1) @@ -321,7 +345,7 @@ Partial Class frmDocumentResultList ' resources.ApplyResources(Me.MenuItemProperties, "MenuItemProperties") Me.MenuItemProperties.Id = 26 - Me.MenuItemProperties.ImageOptions.SvgImage = CType(resources.GetObject("MenuItemPropertiesECM.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.MenuItemProperties.ImageOptions.SvgImage = CType(resources.GetObject("MenuItemProperties.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.MenuItemProperties.Name = "MenuItemProperties" ' 'MenuItemsOpenFileZooFlow @@ -455,7 +479,7 @@ Partial Class frmDocumentResultList 'WorkspaceManager1 ' Me.WorkspaceManager1.TargetControl = Me - Me.WorkspaceManager1.TransitionType = PushTransition1 + Me.WorkspaceManager1.TransitionType = FadeTransition1 ' 'RibbonPageCategoryFile ' @@ -695,7 +719,7 @@ Partial Class frmDocumentResultList 'DockManager1 ' Me.DockManager1.Form = Me - Me.DockManager1.RootPanels.AddRange(New DevExpress.XtraBars.Docking.DockPanel() {Me.DockPanelFileList, Me.DockPanelMetadata, Me.DockPanelDocViewer}) + Me.DockManager1.RootPanels.AddRange(New DevExpress.XtraBars.Docking.DockPanel() {Me.DockPanelFileList, Me.panelContainer1, Me.DockPanelDocViewer}) Me.DockManager1.TopZIndexControls.AddRange(New String() {"DevExpress.XtraBars.BarDockControl", "DevExpress.XtraBars.StandaloneBarDockControl", "System.Windows.Forms.MenuStrip", "System.Windows.Forms.StatusStrip", "System.Windows.Forms.StatusBar", "DevExpress.XtraBars.Ribbon.RibbonStatusBar", "DevExpress.XtraBars.Ribbon.RibbonControl", "DevExpress.XtraBars.Navigation.OfficeNavigationBar", "DevExpress.XtraBars.Navigation.TileNavPane", "DevExpress.XtraBars.TabFormControl", "DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormControl", "DevExpress.XtraBars.ToolbarForm.ToolbarFormControl"}) ' 'DockPanelFileList @@ -714,10 +738,109 @@ Partial Class frmDocumentResultList resources.ApplyResources(Me.DockPanel2_Container, "DockPanel2_Container") Me.DockPanel2_Container.Name = "DockPanel2_Container" ' + 'panelContainer1 + ' + Me.panelContainer1.ActiveChild = Me.DockPanelStatus + Me.panelContainer1.Controls.Add(Me.DockPanelStatus) + Me.panelContainer1.Controls.Add(Me.DockPanelMetadata) + Me.panelContainer1.Dock = DevExpress.XtraBars.Docking.DockingStyle.Right + Me.panelContainer1.ID = New System.Guid("3d77391e-21ef-4574-8521-d9f3b7468ebe") + resources.ApplyResources(Me.panelContainer1, "panelContainer1") + Me.panelContainer1.Name = "panelContainer1" + Me.panelContainer1.OriginalSize = New System.Drawing.Size(275, 200) + Me.panelContainer1.Tabbed = True + ' + 'DockPanelStatus + ' + Me.DockPanelStatus.Controls.Add(Me.ControlContainer1) + Me.DockPanelStatus.Dock = DevExpress.XtraBars.Docking.DockingStyle.Fill + Me.DockPanelStatus.FloatVertical = True + Me.DockPanelStatus.ID = New System.Guid("ef61c6cb-3dbd-4dd5-9df0-9d331a859d3d") + resources.ApplyResources(Me.DockPanelStatus, "DockPanelStatus") + Me.DockPanelStatus.Name = "DockPanelStatus" + Me.DockPanelStatus.Options.ShowCloseButton = False + Me.DockPanelStatus.OriginalSize = New System.Drawing.Size(273, 97) + ' + 'ControlContainer1 + ' + Me.ControlContainer1.Controls.Add(Me.LayoutControl1) + resources.ApplyResources(Me.ControlContainer1, "ControlContainer1") + Me.ControlContainer1.Name = "ControlContainer1" + ' + 'LayoutControl1 + ' + Me.LayoutControl1.Controls.Add(Me.txtCheckedOutWho) + Me.LayoutControl1.Controls.Add(Me.dateCheckedOutWhen) + resources.ApplyResources(Me.LayoutControl1, "LayoutControl1") + Me.LayoutControl1.Name = "LayoutControl1" + Me.LayoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = New System.Drawing.Rectangle(1068, 325, 650, 400) + Me.LayoutControl1.Root = Me.Root + ' + 'txtCheckedOutWho + ' + resources.ApplyResources(Me.txtCheckedOutWho, "txtCheckedOutWho") + Me.txtCheckedOutWho.MenuManager = Me.RibbonControl + Me.txtCheckedOutWho.Name = "txtCheckedOutWho" + Me.txtCheckedOutWho.Properties.ReadOnly = True + Me.txtCheckedOutWho.StyleController = Me.LayoutControl1 + ' + 'dateCheckedOutWhen + ' + resources.ApplyResources(Me.dateCheckedOutWhen, "dateCheckedOutWhen") + Me.dateCheckedOutWhen.MenuManager = Me.RibbonControl + Me.dateCheckedOutWhen.Name = "dateCheckedOutWhen" + Me.dateCheckedOutWhen.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("DateEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))}) + Me.dateCheckedOutWhen.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("DateEdit1.Properties.CalendarTimeProperties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))}) + Me.dateCheckedOutWhen.Properties.ReadOnly = True + Me.dateCheckedOutWhen.StyleController = Me.LayoutControl1 + ' + 'Root + ' + Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] + Me.Root.GroupBordersVisible = False + Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroup1, Me.EmptySpaceItem1}) + Me.Root.Name = "Root" + Me.Root.Size = New System.Drawing.Size(268, 434) + Me.Root.TextVisible = False + ' + 'LayoutControlGroup1 + ' + Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.LayoutControlItem2}) + Me.LayoutControlGroup1.Location = New System.Drawing.Point(0, 0) + Me.LayoutControlGroup1.Name = "LayoutControlGroup1" + Me.LayoutControlGroup1.Size = New System.Drawing.Size(248, 93) + resources.ApplyResources(Me.LayoutControlGroup1, "LayoutControlGroup1") + ' + 'LayoutControlItem1 + ' + Me.LayoutControlItem1.Control = Me.txtCheckedOutWho + Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 0) + Me.LayoutControlItem1.Name = "LayoutControlItem1" + Me.LayoutControlItem1.Size = New System.Drawing.Size(224, 24) + resources.ApplyResources(Me.LayoutControlItem1, "LayoutControlItem1") + Me.LayoutControlItem1.TextSize = New System.Drawing.Size(126, 13) + ' + 'LayoutControlItem2 + ' + Me.LayoutControlItem2.Control = Me.dateCheckedOutWhen + Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 24) + Me.LayoutControlItem2.Name = "LayoutControlItem2" + Me.LayoutControlItem2.Size = New System.Drawing.Size(224, 24) + resources.ApplyResources(Me.LayoutControlItem2, "LayoutControlItem2") + Me.LayoutControlItem2.TextSize = New System.Drawing.Size(126, 13) + ' + 'EmptySpaceItem1 + ' + Me.EmptySpaceItem1.AllowHotTrack = False + Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 93) + Me.EmptySpaceItem1.Name = "EmptySpaceItem1" + Me.EmptySpaceItem1.Size = New System.Drawing.Size(248, 321) + Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0) + ' 'DockPanelMetadata ' Me.DockPanelMetadata.Controls.Add(Me.DockPanel3_Container) - Me.DockPanelMetadata.Dock = DevExpress.XtraBars.Docking.DockingStyle.Right + Me.DockPanelMetadata.Dock = DevExpress.XtraBars.Docking.DockingStyle.Fill Me.DockPanelMetadata.ID = New System.Guid("a7688cec-f13e-448b-82cf-a6bb020fb3f7") resources.ApplyResources(Me.DockPanelMetadata, "DockPanelMetadata") Me.DockPanelMetadata.Name = "DockPanelMetadata" @@ -743,7 +866,7 @@ Partial Class frmDocumentResultList resources.ApplyResources(Me.DockPanelDocViewer, "DockPanelDocViewer") Me.DockPanelDocViewer.Name = "DockPanelDocViewer" Me.DockPanelDocViewer.Options.ShowCloseButton = False - Me.DockPanelDocViewer.OriginalSize = New System.Drawing.Size(324, 200) + Me.DockPanelDocViewer.OriginalSize = New System.Drawing.Size(329, 200) ' 'DockPanel1_Container ' @@ -761,7 +884,7 @@ Partial Class frmDocumentResultList resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.Controls.Add(Me.DockPanelDocViewer) - Me.Controls.Add(Me.DockPanelMetadata) + Me.Controls.Add(Me.panelContainer1) Me.Controls.Add(Me.DockPanelFileList) Me.Controls.Add(Me.RibbonStatusBar) Me.Controls.Add(Me.RibbonControl) @@ -794,6 +917,19 @@ Partial Class frmDocumentResultList CType(Me.DockManager1, System.ComponentModel.ISupportInitialize).EndInit() Me.DockPanelFileList.ResumeLayout(False) Me.DockPanel2_Container.ResumeLayout(False) + Me.panelContainer1.ResumeLayout(False) + Me.DockPanelStatus.ResumeLayout(False) + Me.ControlContainer1.ResumeLayout(False) + CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit() + Me.LayoutControl1.ResumeLayout(False) + CType(Me.txtCheckedOutWho.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateCheckedOutWhen.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateCheckedOutWhen.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).EndInit() Me.DockPanelMetadata.ResumeLayout(False) Me.DockPanel3_Container.ResumeLayout(False) Me.DockPanelDocViewer.ResumeLayout(False) @@ -884,4 +1020,15 @@ Partial Class frmDocumentResultList Friend WithEvents RibbonPageCategoryAttribute As DevExpress.XtraBars.Ribbon.RibbonPageCategory Friend WithEvents RibbonPageAttribute As DevExpress.XtraBars.Ribbon.RibbonPage Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents DockPanelStatus As DevExpress.XtraBars.Docking.DockPanel + Friend WithEvents ControlContainer1 As DevExpress.XtraBars.Docking.ControlContainer + Friend WithEvents panelContainer1 As DevExpress.XtraBars.Docking.DockPanel + Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl + Friend WithEvents txtCheckedOutWho As DevExpress.XtraEditors.TextEdit + Friend WithEvents dateCheckedOutWhen As DevExpress.XtraEditors.DateEdit + Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup + Friend WithEvents LayoutControlGroup1 As DevExpress.XtraLayout.LayoutControlGroup + Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents EmptySpaceItem1 As DevExpress.XtraLayout.EmptySpaceItem End Class diff --git a/GUIs.Common/frmDocumentResultList.resx b/GUIs.Common/frmDocumentResultList.resx index b73617c4..fa4484e5 100644 --- a/GUIs.Common/frmDocumentResultList.resx +++ b/GUIs.Common/frmDocumentResultList.resx @@ -391,7 +391,7 @@ Eigenschaften - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40 LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -496,7 +496,7 @@ 0, 0 - 318, 459 + 323, 459 @@ -518,7 +518,7 @@ 3, 26 - 318, 459 + 323, 459 0 @@ -539,7 +539,7 @@ 585, 158 - 324, 489 + 329, 489 Vorschau @@ -556,6 +556,136 @@ 0 + + 162, 45 + + + 82, 20 + + + 4 + + + txtCheckedOutWho + + + DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + LayoutControl1 + + + 4 + + + + + + 162, 69 + + + + Combo + + + Combo + + + 82, 20 + + + 5 + + + dateCheckedOutWhen + + + DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + LayoutControl1 + + + 5 + + + Fill + + + 0, 0 + + + Bearbeitet von + + + In Bearbeitung genommen + + + In Bearbeitung + + + 268, 434 + + + 0 + + + LayoutControl1 + + + LayoutControl1 + + + DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ControlContainer1 + + + 0 + + + 0, 0 + + + 268, 434 + + + 0 + + + ControlContainer1 + + + DevExpress.XtraBars.Docking.ControlContainer, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + DockPanelStatus + + + 0 + + + 4, 26 + + + 268, 434 + + + Status + + + DockPanelStatus + + + DevExpress.XtraBars.Docking.DockPanel, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + panelContainer1 + + + 0 + Fill @@ -563,7 +693,7 @@ 0, 0 - 273, 460 + 268, 434 0 @@ -581,10 +711,10 @@ 0 - 4, 26 + 0, 0 - 273, 460 + 268, 434 0 @@ -602,10 +732,10 @@ 0 - 909, 158 + 4, 26 - 280, 489 + 268, 434 Eigenschaften @@ -617,11 +747,32 @@ DevExpress.XtraBars.Docking.DockPanel, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - $this + panelContainer1 1 + + 914, 158 + + + 275, 489 + + + panelContainer1 + + + panelContainer1 + + + DevExpress.XtraBars.Docking.DockPanel, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + $this + + + 1 + 3, 26 @@ -1149,6 +1300,36 @@ DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + Root + + + DevExpress.XtraLayout.LayoutControlGroup, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + LayoutControlGroup1 + + + DevExpress.XtraLayout.LayoutControlGroup, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + LayoutControlItem1 + + + DevExpress.XtraLayout.LayoutControlItem, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + LayoutControlItem2 + + + DevExpress.XtraLayout.LayoutControlItem, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + EmptySpaceItem1 + + + DevExpress.XtraLayout.EmptySpaceItem, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + SvgImageCollection1 diff --git a/GUIs.Common/frmDocumentResultList.vb b/GUIs.Common/frmDocumentResultList.vb index bc5f9cf1..5f4c7e71 100644 --- a/GUIs.Common/frmDocumentResultList.vb +++ b/GUIs.Common/frmDocumentResultList.vb @@ -6,7 +6,6 @@ Imports DevExpress.Utils Imports DevExpress.XtraBars Imports DevExpress.XtraEditors Imports DevExpress.XtraGrid -Imports DevExpress.XtraGrid.Columns Imports DevExpress.XtraGrid.Views.BandedGrid Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.Grid @@ -21,6 +20,7 @@ Imports DigitalData.Modules.ZooFlow.Constants Imports DigitalData.Modules.Base.IDB.FileStore Imports DigitalData.Controls.MessageBoxEx Imports DigitalData.GUIs.Common.Base +Imports DigitalData.GUIs.Common.DocumentResultList Public Class frmDocumentResultList Implements IResultForm, IBaseForm @@ -39,6 +39,7 @@ Public Class frmDocumentResultList Private Client As Client Private Documentloader As DocumentResultList.Loader Private ControlManager As AttributeControls + Private CheckoutManager As CheckInOut Private ReadOnly Config As ConfigManager(Of DocumentResultList.Config) Private ReadOnly Environment As Environment @@ -63,6 +64,7 @@ Public Class frmDocumentResultList Private ReadOnly ColumnFilename As String = "Filename" Private ReadOnly ColumnDocumentId As String = "DocID" Private ReadOnly ColumnIcon As String = "ICON" + Private ReadOnly ColumnCheckedOut As String = "CHECKED_OUT" Private Property _ActiveGrid As GridControl = Nothing Private Property _ActiveGridBand As GridBand = Nothing @@ -98,15 +100,15 @@ Public Class frmDocumentResultList Params = pParams ResultLists = pParams.Results - Config = New ConfigManager(Of DocumentResultList.Config)(pLogConfig, oConfigPath, oConfigPath) + Config = New ConfigManager(Of Config)(pLogConfig, oConfigPath, oConfigPath) Helpers = New DocumentResultList.Helpers(pLogConfig) Filesystem = New Modules.Filesystem.File(pLogConfig) GridBuilder = New GridBuilder(New List(Of GridView) From {GridView1, GridView2, GridView3}) FileEx = New Modules.Windows.File(pLogConfig) - Watcher = New DocumentResultList.Watcher(pLogConfig) - LayoutManager = New DocumentResultList.Layout(pLogConfig, Config, New List(Of GridView) From {GridView1, GridView2, GridView3}) + Watcher = New Watcher(pLogConfig) + LayoutManager = New Layout(pLogConfig, Config, New List(Of GridView) From {GridView1, GridView2, GridView3}) - UserLanguage = Utils.NotNull(Me.Environment.User.Language, State.UserState.LANG_EN_US) + UserLanguage = Utils.NotNull(Environment.User.Language, State.UserState.LANG_EN_US) End Sub Private Function GetOperationMode() As OperationMode @@ -254,6 +256,15 @@ Public Class frmDocumentResultList 'End If Await CtrlObjectPropertyDialog.LoadObject(oObjectId) + + Dim oCheckoutState = Await CheckOutManager.GetCheckoutState(oObjectId) + If oCheckoutState IsNot Nothing Then + txtCheckedOutWho.EditValue = oCheckoutState.CheckedOutWho + dateCheckedOutWhen.EditValue = oCheckoutState.CheckedOutWhen + Else + txtCheckedOutWho.EditValue = Nothing + dateCheckedOutWhen.EditValue = Nothing + End If End If Else RibbonPageCategoryFile.Visible = False @@ -381,6 +392,7 @@ Public Class frmDocumentResultList Client = New Client(LogConfig, oAddress, oPort) ControlManager = New AttributeControls(LogConfig, Environment, Client) + CheckoutManager = New CheckInOut(LogConfig, Client) If Not Client.Connect() Then Logger.Warn("Client could not connect to Service at [{0}]", Environment.Service.Address) @@ -540,7 +552,7 @@ Public Class frmDocumentResultList Private Sub CreateDocumentGrid(GridView As BandedGridView, Result As DocumentResultList.DocumentResult) Try - If IsNothing(GridView.Columns(ColumnIcon)) Then + If GridView.Columns.Item(ColumnIcon) Is Nothing Then Dim oIconColumn = GridView.Columns.AddVisible(ColumnIcon, ColumnIcon) With oIconColumn .OptionsColumn.AllowSort = False @@ -557,7 +569,6 @@ Public Class frmDocumentResultList oFirstBand.Columns.MoveTo(0, oIconColumn) End If - Dim oColumnsToHide As New List(Of String) From { ColumnDocumentId, ColumnFilepath, @@ -632,40 +643,43 @@ Public Class frmDocumentResultList - 'Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell - ' If e.RowHandle <> GridControl.NewItemRowHandle AndAlso e.Column.FieldName = COLUMN_ICON Then - ' Dim oRow As DataRow = TryCast(sender, GridView)?.GetDataRow(e.RowHandle) - ' Dim oValue = oRow.Item(COLUMN_FILENAME) + Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell - ' If oValue.ToString.EndsWith(".pdf") Then - ' Dim oIcon = My.Resources.pdf - ' e.Cache.DrawImage(oIcon, e.Bounds.X + 0, e.Bounds.Y + 0, 18, 18) - ' End If - ' End If - ' 'Try - ' ' If e.RowHandle < 0 Then - ' ' Exit Sub - ' ' End If - ' ' e.DefaultDraw() + 'If e.RowHandle <> GridControl.NewItemRowHandle AndAlso e.Column.FieldName = ColumnIcon Then + ' Dim oRow As DataRow = TryCast(sender, GridView)?.GetDataRow(e.RowHandle) + ' Dim oValue = oRow.Item(COLUMN_FILENAME) - ' ' Dim oView As GridView = TryCast(sender, GridView) - ' ' Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo) - ' ' Dim oRow As DataRow = oView.GetDataRow(e.RowHandle) - ' ' Dim oValue = oRow.Item(COLUMN_FILENAME) + ' If oValue.ToString.EndsWith(".pdf") Then + ' Dim oIcon = My.Resources.pdf + ' e.Cache.DrawImage(oIcon, e.Bounds.X + 0, e.Bounds.Y + 0, 18, 18) + ' End If + 'End If - ' ' If e.Column.FieldName = COLUMN_ICON Then - ' ' Dim oIcon = Helpers.GetIconByExtension(oValue) - ' ' Dim offsetX = 0 - ' ' Dim offsetY = 0 + 'Try + ' If e.RowHandle < 0 Then + ' Exit Sub + ' End If - ' ' e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18) - ' ' End If - ' 'Catch ex As Exception - ' ' Logger.Error(ex) - ' 'End Try - 'End Sub + ' e.DefaultDraw() + + ' Dim oView As GridView = TryCast(sender, GridView) + ' Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo) + ' Dim oRow As DataRow = oView.GetDataRow(e.RowHandle) + ' Dim oValue = oRow.Item(COLUMN_FILENAME) + + ' If e.Column.FieldName = COLUMN_ICON Then + ' Dim oIcon = Helpers.GetIconByExtension(oValue) + ' Dim offsetX = 0 + ' Dim offsetY = 0 + + ' e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18) + ' End If + 'Catch ex As Exception + ' Logger.Error(ex) + 'End Try + End Sub Private Sub BarButtonItemExportGrid1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemExportGrid1.ItemClick Dim oActiveGrid = GetActiveGridControl() @@ -856,6 +870,43 @@ Public Class frmDocumentResultList Process.Start(oInfo) End Sub + Private Async Sub MenuItemCheckOutFile_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemCheckOutFile.ItemClick + Dim oObjectId = _CurrentDocument?.Id + Dim oResultComment As String = ShowCheckInOutCommentForm() + If IsNothing(oResultComment) Then + Exit Sub + End If + + Await Client.CheckOutFile(oObjectId, oResultComment) + + End Sub + + Private Sub MenuItemCheckInFile_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemCheckInFile.ItemClick + Dim oObjectId = _CurrentDocument?.Id + Client.CheckInFile(oObjectId) + End Sub + + Private Function ShowCheckInOutCommentForm() + Dim editor As New MemoEdit() + Dim args As New XtraInputBoxArgs With { + .Caption = "Checkout/in Kommentar", + .Prompt = "Kommentar", + .DefaultButtonIndex = 0, + .Editor = editor, + .DefaultResponse = "" + } + args.ContentPadding = args.ButtonPadding + + AddHandler args.Showing, AddressOf Args_Showing + + Dim result = XtraInputBox.Show(args).ToString() + Return result + End Function + + Private Sub Args_Showing(ByVal sender As Object, ByVal e As XtraMessageShowingArgs) + e.Form.Icon = Me.Icon + End Sub + #End Region #Region "Drag to Export" @@ -974,4 +1025,13 @@ Public Class frmDocumentResultList Private Sub CtrlObjectPropertyDialog_Leave(sender As Object, e As EventArgs) Handles CtrlObjectPropertyDialog.Leave RibbonPageCategoryAttribute.Visible = False End Sub + + Private Sub GridView1_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridView1.RowStyle + Dim oGridView As BandedGridView = sender + Dim oRow As DataRowView = oGridView.GetRow(e.RowHandle) + + If oRow IsNot Nothing AndAlso oRow.Row.Item(ColumnCheckedOut) IsNot Nothing AndAlso oRow.Row.Item(ColumnCheckedOut) = True Then + e.Appearance.BackColor = Color.LightSalmon + End If + End Sub End Class \ No newline at end of file diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 3ea33c20..11358b4d 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -236,6 +236,42 @@ Public Class Client End Try End Function + Public Async Function CheckOutFile(pObjectId As Long, pComment As String, Optional pOptions As Options.CheckOutInOptions = Nothing) As Task(Of Long) + Try + Dim oCheckOutFile As New Modules.IDB.CheckOutFile(LogConfig, Channel) + Return Await oCheckOutFile.RunAsync(pObjectId, pComment, pOptions) + + Catch ex As Exception + Logger.Error(ex) + Return Nothing + + End Try + End Function + + Public Async Function CheckOutFile(pObjectId As Long, Optional pOptions As Options.CheckOutInOptions = Nothing) As Task(Of Long) + Try + Dim oCheckOutFile As New Modules.IDB.CheckOutFile(LogConfig, Channel) + Return Await oCheckOutFile.RunAsync(pObjectId, String.Empty, pOptions) + + Catch ex As Exception + Logger.Error(ex) + Return Nothing + + End Try + End Function + + Public Async Function CheckInFile(pObjectId As Long, Optional pOptions As Options.CheckOutInOptions = Nothing) As Task(Of Long) + Try + Dim oCheckInFile As New Modules.IDB.CheckInFile(LogConfig, Channel) + Return Await oCheckInFile.RunAsync(pObjectId, pOptions) + + Catch ex As Exception + Logger.Error(ex) + Return Nothing + + End Try + End Function + Public Async Function Globix_ImportFileAsync( pFilePath As String, pProfileId As Integer, diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.IDB.CheckInOutFile.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.IDB.CheckInOutFile.xsd index a5fef09c..5464821b 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.IDB.CheckInOutFile.xsd +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.IDB.CheckInOutFile.xsd @@ -5,7 +5,7 @@ - + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb index ba0a54dc..ca2bcac0 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb @@ -2371,47 +2371,47 @@ Namespace EDMIServiceReference _ Private ActionField As EDMIServiceReference.CheckInOutFileAction - - _ - Private CommentField As Long - - _ + + + Private CommentField As String + + Private ObjectIdField As Long - - _ + + Private UserField As EDMIServiceReference.UserState - - _ + + Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData Get Return Me.extensionDataField End Get Set - Me.extensionDataField = value + Me.extensionDataField = Value End Set End Property - - _ + + Public Property Action() As EDMIServiceReference.CheckInOutFileAction Get Return Me.ActionField End Get Set - If (Me.ActionField.Equals(value) <> true) Then - Me.ActionField = value + If (Me.ActionField.Equals(Value) <> True) Then + Me.ActionField = Value Me.RaisePropertyChanged("Action") End If End Set End Property - - _ - Public Property Comment() As Long + + + Public Property Comment() As String Get Return Me.CommentField End Get Set - If (Me.CommentField.Equals(value) <> true) Then - Me.CommentField = value + If (Object.ReferenceEquals(Me.CommentField, Value) <> True) Then + Me.CommentField = Value Me.RaisePropertyChanged("Comment") End If End Set diff --git a/Modules.EDMIAPI/Modules/IDB/CheckInFile.vb b/Modules.EDMIAPI/Modules/IDB/CheckInFile.vb index af853037..4fe96ac2 100644 --- a/Modules.EDMIAPI/Modules/IDB/CheckInFile.vb +++ b/Modules.EDMIAPI/Modules/IDB/CheckInFile.vb @@ -20,12 +20,12 @@ Namespace Modules.IDB .Language = pOptions.Language, .UserName = pOptions.Username }, - .Action = CheckInOutFileAction.CheckOut, + .Action = CheckInOutFileAction.CheckIn, .ObjectId = pObjectId }) If oCheckInFileResponse.OK = False Then - Throw New ApplicationException("Could not Import File Contents!") + Throw New ApplicationException(oCheckInFileResponse.ErrorMessage) End If Return oCheckInFileResponse.ObjectId diff --git a/Modules.EDMIAPI/Modules/IDB/CheckOutFile.vb b/Modules.EDMIAPI/Modules/IDB/CheckOutFile.vb index 8707752d..1980cd73 100644 --- a/Modules.EDMIAPI/Modules/IDB/CheckOutFile.vb +++ b/Modules.EDMIAPI/Modules/IDB/CheckOutFile.vb @@ -15,7 +15,7 @@ Namespace Modules.IDB pOptions = New Options.CheckOutInOptions() End If - Dim oCheckOutFileResponse = Await Channel.CheckInOutFileAsync(New CheckInOutFileRequest With { + Dim oArgs = New CheckInOutFileRequest With { .User = New UserState With { .Language = pOptions.Language, .UserName = pOptions.Username @@ -23,10 +23,11 @@ Namespace Modules.IDB .Action = CheckInOutFileAction.CheckOut, .Comment = pComment, .ObjectId = pObjectId - }) + } + Dim oCheckOutFileResponse = Await Channel.CheckInOutFileAsync(oArgs) If oCheckOutFileResponse.OK = False Then - Throw New ApplicationException("Could not Import File Contents!") + Throw New ApplicationException(oCheckOutFileResponse.ErrorMessage) End If Return oCheckOutFileResponse.ObjectId diff --git a/Service.EDMIService/EDMIService.vbproj b/Service.EDMIService/EDMIService.vbproj index 3e7928b7..07993a73 100644 --- a/Service.EDMIService/EDMIService.vbproj +++ b/Service.EDMIService/EDMIService.vbproj @@ -155,6 +155,10 @@ + + + + diff --git a/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileMethod.vb b/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileMethod.vb index 5bd479d5..5e784a18 100644 --- a/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileMethod.vb +++ b/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileMethod.vb @@ -8,6 +8,18 @@ Namespace Methods.IDB.CheckInOutFile Public Class CheckInOutFileMethod Inherits BaseMethod + Private Enum CheckOutResult + CheckoutSuccessful + AlreadyCheckedOut + InternalError + End Enum + + Private Enum CheckInResult + CheckinSuccessful + NotCheckedOut + InternalError + End Enum + Private ReadOnly Connection As SqlConnection Private ReadOnly Transaction As SqlTransaction @@ -23,10 +35,30 @@ Namespace Methods.IDB.CheckInOutFile Dim oResult = False If pData.Action = CheckInOutFileAction.CheckOut Then - oResult = CheckOutFile(pData.ObjectId, pData.User.UserName, pData.Comment) + Select Case CheckOutFile(pData.ObjectId, pData.User.UserName, pData.Comment) + Case CheckOutResult.CheckoutSuccessful + oResult = True + + Case CheckOutResult.AlreadyCheckedOut + LogAndThrow($"File '{pData.ObjectId}' is already checked out.") + + Case CheckOutResult.InternalError + LogAndThrow($"Internal Error occurred while checking out file [{pData.ObjectId}].") + + End Select ElseIf pData.Action = CheckInOutFileAction.CheckIn Then - oResult = CheckInFile(pData.ObjectId, pData.User.UserName) + Select Case CheckInFile(pData.ObjectId, pData.User.UserName) + Case CheckInResult.CheckinSuccessful + oResult = True + + Case CheckInResult.NotCheckedOut + LogAndThrow($"File '{pData.ObjectId}' is not checked out.") + + Case CheckInResult.InternalError + LogAndThrow($"Internal Error occurred while checking in file [{pData.ObjectId}].") + + End Select Else LogAndThrow("Invalid action supplied!") @@ -50,22 +82,31 @@ Namespace Methods.IDB.CheckInOutFile End Try End Function - Private Function CheckOutFile(pObjectId As Long, pUsername As String, pComment As String) As Boolean + Private Function CheckOutFile(pObjectId As Long, pUsername As String, pComment As String) As CheckOutResult Try Dim oTable = TestFileIsCheckedOut(pObjectId) If oTable Is Nothing Then - Return False + Logger.Warn("File [{0}] could not be checked out because of an internal error!", pObjectId) + Return CheckOutResult.InternalError End If ' If there are rows, the file is already checked out (either by the calling user or somebody else) If oTable.Rows.Count > 0 Then ' TODO: Return the person who has this file checked out - Return False + Logger.Warn("File [{0}] is already checked out!", pObjectId) + Return CheckOutResult.AlreadyCheckedOut End If Dim oSQL = $"INSERT INTO TBIDB_OBJECT_CHECK_IN_OUT (IDB_OBJ_ID, CHECKED_OUT_WHEN, COMMENT, ADDED_WHO) VALUES ({pObjectId}, GETDATE(), '{pComment}', '{pUsername}')" - Return DatabaseIDB.ExecuteNonQuery(oSQL) + + If DatabaseIDB.ExecuteNonQuery(oSQL) = True Then + Logger.Info("File [{0}] checked out successfully!", pObjectId) + Return CheckOutResult.CheckoutSuccessful + Else + Logger.Warn("File [{0}] could not be checked out because of an internal error!", pObjectId) + Return CheckOutResult.InternalError + End If Catch ex As Exception Logger.Error(ex) @@ -78,18 +119,27 @@ Namespace Methods.IDB.CheckInOutFile Try Dim oTable = TestFileIsCheckedOut(pObjectId) If oTable Is Nothing Then - Return False + Logger.Warn("File [{0}] could not be checked in because of an internal error!", pObjectId) + Return CheckOutResult.InternalError End If ' If there are no rows, the file is not checked out - If oTable.Rows.Count > 0 Then - Return True + If oTable.Rows.Count = 0 Then + Logger.Warn("File [{0}] is not checked out!", pObjectId) + Return CheckInResult.NotCheckedOut End If Dim oSQL = $"UPDATE TBIDB_OBJECT_CHECK_IN_OUT SET CHECKED_IN_WHEN = GETDATE(), CHANGED_WHO = '{pUsername}' WHERE IDB_OBJ_ID = {pObjectId} AND ADDED_WHO = '{pUsername}' AND CHECKED_IN_WHEN IS NULL" - Return DatabaseIDB.ExecuteNonQuery(oSQL) + + If DatabaseIDB.ExecuteNonQuery(oSQL) = True Then + Logger.Info("File [{0}] checked in successfully!", pObjectId) + Return CheckInResult.CheckinSuccessful + Else + Logger.Warn("File [{0}] could not be checked in because of an internal error!", pObjectId) + Return CheckInResult.InternalError + End If Catch ex As Exception Logger.Error(ex) @@ -100,6 +150,7 @@ Namespace Methods.IDB.CheckInOutFile Private Function TestFileIsCheckedOut(pObjectId As Long) As DataTable Try + Logger.Debug("Checking if file [{0}] is checked out.", pObjectId) Dim oSqlCheck = $"SELECT * FROM TBIDB_OBJECT_CHECK_IN_OUT WHERE IDB_OBJ_ID = {pObjectId} AND CHECKED_IN_WHEN IS NULL" Dim oTable As DataTable = DatabaseIDB.GetDatatable(oSqlCheck) diff --git a/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileRequest.vb b/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileRequest.vb index e6e1cb2e..0af74e7f 100644 --- a/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileRequest.vb +++ b/Service.EDMIService/Methods/IDB/CheckInOutFile/CheckInOutFileRequest.vb @@ -9,7 +9,7 @@ Namespace Methods.IDB.CheckInOutFile Public Property ObjectId As Long - Public Property Comment As Long + Public Property Comment As String Public Property Action As CheckInOutFileAction diff --git a/Service.EDMIService/Methods/IDB/GetFileInfo/FileInfo.vb b/Service.EDMIService/Methods/IDB/GetFileInfo/FileInfo.vb new file mode 100644 index 00000000..4c4af604 --- /dev/null +++ b/Service.EDMIService/Methods/IDB/GetFileInfo/FileInfo.vb @@ -0,0 +1,13 @@ +Imports System.Runtime.Serialization + +Namespace Methods.IDB.GetFileInfo + + Public Class FileInfo + + Public Property IsCheckedOut As Boolean + + + Public Property CheckoutUser As String + End Class + +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoMethod.vb b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoMethod.vb new file mode 100644 index 00000000..74bce373 --- /dev/null +++ b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoMethod.vb @@ -0,0 +1,21 @@ +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Logging + +Namespace Methods.IDB.GetFileInfo + Public Class GetFileInfoMethod + Inherits BaseMethod + + Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState) + MyBase.New(pLogConfig, pDatabaseIDB, pDatabaseECM, pGlobalState) + End Sub + + Public Function Run(pData As GetFileInfoRequest) As GetFileInfoResponse + Dim oFileInfo = New FileInfo() With { + .CheckoutUser = Nothing, + .IsCheckedOut = False + } + Return New GetFileInfoResponse(oFileInfo) + + End Function + End Class +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoRequest.vb b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoRequest.vb new file mode 100644 index 00000000..54ebe2b6 --- /dev/null +++ b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoRequest.vb @@ -0,0 +1,10 @@ +Imports System.Runtime.Serialization + +Namespace Methods.IDB.GetFileInfo + + + Public Class GetFileInfoRequest + + Public Property ObjectId As Long + End Class +End Namespace diff --git a/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoResponse.vb b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoResponse.vb new file mode 100644 index 00000000..60841f8d --- /dev/null +++ b/Service.EDMIService/Methods/IDB/GetFileInfo/GetFileInfoResponse.vb @@ -0,0 +1,24 @@ +Imports System.Runtime.Serialization + +Namespace Methods.IDB.GetFileInfo + + + Public Class GetFileInfoResponse + Inherits Messages.BaseResponse + + + Public Property ObjectId As Long + + + Public Property FileInfo As FileInfo + + Public Sub New(pFileInfo As FileInfo) + MyBase.New() + FileInfo = pFileInfo + End Sub + + Public Sub New(pException As Exception, Optional pDetails As String = "") + MyBase.New(pException, pDetails) + End Sub + End Class +End Namespace diff --git a/Service.EDMIService/Scheduler/JobListener.vb b/Service.EDMIService/Scheduler/JobListener.vb index 995c2d55..84a664f0 100644 --- a/Service.EDMIService/Scheduler/JobListener.vb +++ b/Service.EDMIService/Scheduler/JobListener.vb @@ -75,7 +75,7 @@ Public Class JobListener ' Remove the temp table if it exists If DataSet.Tables.Contains(oDatatableNameTemp) Then - _Logger.Debug("Removing Table [{0}]", oDatatableNameTemp) + _Logger.Debug("Removing Temp-Table [{0}]", oDatatableNameTemp) DataSet.Tables.Item(oDatatableNameTemp).ChildRelations.Clear() DataSet.Tables.Item(oDatatableNameTemp).Constraints.Clear()