From: Vásáry Dániel Date: Thu, 28 Nov 2019 12:39:44 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=f850b0c660799434b9935cd4bb391c3542016d67;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31655 --- diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 5686b936..b3278a6d 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -173,7 +173,7 @@ namespace DxPlay { } } - public void OpenFile(FileInfo fileInfo) { + public void OpenFile(FileInfo fileInfo, bool redefineSegments) { logger.Debug("Open {0}", fileInfo.FullName); if (m_play != null) @@ -196,7 +196,7 @@ namespace DxPlay { logger.Error(e); } } - model.IsRedefineSegments = false; + model.IsRedefineSegments = redefineSegments; //for (int i = 0; i < 100; i++) { @@ -210,7 +210,7 @@ namespace DxPlay { private void Form1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); FileInfo fileInfo = new FileInfo(files[0]); - OpenFile(fileInfo); + OpenFile(fileInfo, false); } private void panel1_MouseDown(object sender, MouseEventArgs e) { @@ -496,7 +496,7 @@ namespace DxPlay { if (arguments.Length > 1) { FileInfo fi = new FileInfo(arguments[1]); if (fi.Exists) - OpenFile(fi); + OpenFile(fi, false); } } @@ -523,7 +523,7 @@ namespace DxPlay { private void menuOpenFile_Click(object sender, EventArgs e) { openFileDialogOpened = true; if (openFileDialog.ShowDialog() == DialogResult.OK) - OpenFile(new FileInfo(openFileDialog.FileName)); + OpenFile(new FileInfo(openFileDialog.FileName), false); openFileDialogOpened = false; } @@ -559,7 +559,7 @@ namespace DxPlay { if (openFileDialog.ShowDialog() == DialogResult.OK) { model.RedefineSegmentMediaID = Path.GetFileNameWithoutExtension(openFileDialog.FileName); model.IsRedefineSegments = true; - OpenFile(new FileInfo(openFileDialog.FileName)); + OpenFile(new FileInfo(openFileDialog.FileName), true); } openFileDialogOpened = false; model.IsRedefineSegments = true; diff --git a/client/DxPlay/PlayerGraph.cs b/client/DxPlay/PlayerGraph.cs index 8c38ff3d..3cfa8619 100644 --- a/client/DxPlay/PlayerGraph.cs +++ b/client/DxPlay/PlayerGraph.cs @@ -6,9 +6,9 @@ using System.Runtime.InteropServices; namespace DxPlay { public class PlayerGraph : FilterGraph, IDisposable { - #if DEBUG - private DsROTEntry m_DsRot; - #endif +#if DEBUG + private DsROTEntry m_DsRot; +#endif private static readonly Logger logger = LogManager.GetCurrentClassLogger(); public IVideoWindow VideoWindow { get; private set; } public ISampleGrabber SampleGrabber { get; private set; } @@ -60,7 +60,7 @@ namespace DxPlay { } else { logger.Warn("Audio pin not available"); } - + SearchAudioTracks(splitter); } catch (Exception e) { @@ -89,7 +89,7 @@ namespace DxPlay { private IBaseFilter AddRenderer(IGraphBuilder graphBuilder, IBaseFilter sampleGrabber, IntPtr handle) { logger.Debug("Add VideoMixingRenderer9 to graph"); - IBaseFilter videoRenderer = (IBaseFilter) new VideoMixingRenderer9(); + IBaseFilter videoRenderer = (IBaseFilter)new VideoMixingRenderer9(); DsError.ThrowExceptionForHR(graphBuilder.AddFilter(videoRenderer, "Video Mixing Renderer 9")); logger.Debug("Connect SampleGrabber -> VideoMixingRenderer9"); @@ -195,7 +195,7 @@ namespace DxPlay { videoDecoder = FilterProvider.GetVideoFilter(out lavVideoSettings); if (videoDecoder == null) videoDecoder = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Video Decoder"); - else + if (videoDecoder != null) graphBuilder.AddFilter(videoDecoder, "LAV Video Decoder"); return videoDecoder; } @@ -207,7 +207,7 @@ namespace DxPlay { audioDecoder = FilterProvider.GetAudioFilter(out lavAudioSettings, out lavAudioStatus); if (audioDecoder == null) audioDecoder = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Audio Decoder"); - else + if (audioDecoder != null) graphBuilder.AddFilter(audioDecoder, "LAV Audio Decoder"); return audioDecoder; } @@ -218,7 +218,8 @@ namespace DxPlay { splitter = FilterProvider.GetSplitter(out lavSplitterSettings); if (splitter == null) splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Splitter"); - else + + if (splitter != null) graphBuilder.AddFilter(splitter, "LAV Splitter"); return splitter; } @@ -233,7 +234,7 @@ namespace DxPlay { if (m_DsRot != null) m_DsRot.Dispose(); #endif - IMediaControl mediaCtrl = (IMediaControl) this; + IMediaControl mediaCtrl = (IMediaControl)this; if (mediaCtrl != null) { mediaCtrl.Stop(); IGraphBuilder graphBuilder = (IGraphBuilder)mediaCtrl; diff --git a/client/Maestro/Configuration/ACTIVE-configuration-promo.json b/client/Maestro/Configuration/ACTIVE-configuration-promo.json index 30d4f399..d2f3f999 100644 --- a/client/Maestro/Configuration/ACTIVE-configuration-promo.json +++ b/client/Maestro/Configuration/ACTIVE-configuration-promo.json @@ -1,6 +1,6 @@ { "title": "PROMO SZAKOSZTÁLY", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "defaultWindowColor": "#4DB6AC", @@ -54,10 +54,12 @@ }, { "$type": "TrafficMetadata", + "functionName": "clIFsp_ORI_MAM", + "version": 1, "server": { - "address": "Data Source=10.10.1.45;Initial Catalog=PA_Echo;Persist Security Info=True;", + "address": "Data Source=10.11.254.86;Initial Catalog=PA_Vivantis;Persist Security Info=True;", "userName": "MAM", - "password": "7RKZYBzumKjL40SJwuwiFCvX57xuCN8zay6OttUm2wbrgImyYZBHyZTUUYrXX31Ge2Uwew07HYsqh2uzdJeDBDwcVntxaHg3nIpv9Dyq/odVoiC4tUF/K+lgvKWANcrZ", + "password": "1LCAeMAI5W5eWdtaN25mHX/9JkXjkr0JZDvTZp//HYtUPo/UKyJnuZoLKFo9G9FbAhUha8xnniV+v/9BQ6c/7e0phmCYUdeLEdQcg0hHvU9njMSqYBV75b6oB9jhvtoZ", "timeout": 1000 }, "projectSettings": { diff --git a/client/Maestro/Configuration/dani-teszt-vezerlo.json b/client/Maestro/Configuration/dani-teszt-vezerlo.json index a9ac65b5..97de9a63 100644 --- a/client/Maestro/Configuration/dani-teszt-vezerlo.json +++ b/client/Maestro/Configuration/dani-teszt-vezerlo.json @@ -1,6 +1,6 @@ { "title": "Vezérlő", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "filter": "avi", diff --git a/client/Maestro/Configuration/editor.json b/client/Maestro/Configuration/editor.json new file mode 100644 index 00000000..dddcf810 --- /dev/null +++ b/client/Maestro/Configuration/editor.json @@ -0,0 +1,75 @@ +{ + "title": "Editor", + "active": true, + "startInTray": false, + "enableCustomMetadataId": true, + "player": { + "enabled": true, + "autoStart": false, + "segmentEditor": true + }, + "source": { + "$type": "UNCSource", + "filter": "avi,wav,mxf,mts", + "local": { + "address": "file://c:/remote/promise/FINISHED_SHOWS", + "timeout": 1000 + }, + "remote": { + "address": "ftp://10.11.1.100/Promise/FINISHED_SHOWS", + "userName": "editor1", + "password": "mBsAKn0RRr+lErAWAu+oMD/3CRxlBLNvm3UB84SKl5KBVYD5+wIANFL0eszfbAUtzYKqdN/dEB/6ItBNz9D6C4/hppcYrg0+73+xFW9KYEwd2KfgHaH5uslbA/8IyI/U", + "timeout": 1000 + } + }, + "metadatas": [ + { + "$type": "TrafficMetadata", + "functionName": "clIFsp_ORI_MAM", + "version": 1, + "server": { + "address": "Data Source=10.11.254.86;Initial Catalog=PA_Vivantis;Persist Security Info=True;", + "userName": "MAM", + "password": "1LCAeMAI5W5eWdtaN25mHX/9JkXjkr0JZDvTZp//HYtUPo/UKyJnuZoLKFo9G9FbAhUha8xnniV+v/9BQ6c/7e0phmCYUdeLEdQcg0hHvU9njMSqYBV75b6oB9jhvtoZ", + "timeout": 1000 + } + }, + { + "$type": "MediaCubeMetadata", + "server": { + "address": "http://10.11.1.90/services/rest/jobengine/", + "timeout": 1000 + } + } + ], + "targets": [ + { + "label": "Adáskész", + "processor": "FXPTargetProcessor", + "outputFormat": "%ID%", + "saveSegments": true, + "tag": "Adáskész", + "reference": ["Archiválás"], + "remote": { + "address": "ftp://10.11.1.100/Promise/PROGRAM/TEST", + "userName": "editor1", + "password": "mBsAKn0RRr+lErAWAu+oMD/3CRxlBLNvm3UB84SKl5KBVYD5+wIANFL0eszfbAUtzYKqdN/dEB/6ItBNz9D6C4/hppcYrg0+73+xFW9KYEwd2KfgHaH5uslbA/8IyI/U", + "timeout": 1000 + } + }, + { + "label": "Archiválás", + "processor": "FXPTargetProcessor", + "outputFormat": "%ID%", + "saveArchiveMetadata": true, + "tag": "Archiválás", + "remote": { + "address": "ftp://10.11.1.100/Promise/ARCHIVE/TEST", + "userName": "editor1", + "password": "mBsAKn0RRr+lErAWAu+oMD/3CRxlBLNvm3UB84SKl5KBVYD5+wIANFL0eszfbAUtzYKqdN/dEB/6ItBNz9D6C4/hppcYrg0+73+xFW9KYEwd2KfgHaH5uslbA/8IyI/U", + "timeout": 1000 + } + } + + ] +} diff --git a/client/Maestro/Maestro.csproj b/client/Maestro/Maestro.csproj index 1c93d4bc..a5cb64d7 100644 --- a/client/Maestro/Maestro.csproj +++ b/client/Maestro/Maestro.csproj @@ -300,6 +300,9 @@ Always + + Always + Always diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 1fabee9b..6d9a7c50 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -173,7 +173,7 @@ namespace Maestro { readOnly = ArchiveMetadata.ok; if (readOnly && ArchiveMetadata != null && !SelectedMetadata.IsRedefine) MsgBox.Warning("Az anyag már el van fogadva, a szegmens módosítás nem kerül mentésre. A szegmensek módosításához vissza kell vonni az anyag elfogadását az adástervező rendszerben."); - OpenFile(fileInfo, true, readOnly); + OpenFile(fileInfo, true, readOnly, !readOnly); UpdateDefineSegmentsStatus(); Cursor.Current = Cursors.Default; } diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index f178c58f..020e4f33 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -122,12 +122,12 @@ namespace Maestro { if (fileSourceItem == null) return; dgSource.Enabled = false; - OpenFile(fileSourceItem.FileInfo, false, false); + OpenFile(fileSourceItem.FileInfo, false, false, false); dgSource.Enabled = true; } } - private void OpenFile(FileInfo fileInfo, bool segmentEditor, bool readOnly) { + private void OpenFile(FileInfo fileInfo, bool segmentEditor, bool readOnly, bool redefineSegments) { Cursor = Cursors.WaitCursor; try { string[] extensions = Configuration.Player?.Extensions; @@ -144,9 +144,10 @@ namespace Maestro { AutoStart = Configuration.Player.AutoStart, SegmentEditor = Configuration.Player.SegmentEditor && segmentEditor }, + Metadata = trafficIDSelector.Parameters.Configuration, Segments = MovieSegments }; - player.OpenFile(fileInfo); + player.OpenFile(fileInfo, redefineSegments); if (!player.IsDisposed) player.ShowDialog(); } else { diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index b2df67a9..94978b5e 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -122,22 +122,41 @@ namespace Maestro { } + private bool HasNoneEmptySegments() { + if (MovieSegments?.Count == 0) + return false; + + if (MovieSegments?.Count == 1 && MovieSegments[0].IsGhost) + return false; + + return true; + } + private bool EnsureSegments(Target target) { - if ((target.SaveMorpheusMetadata || target.SaveSegments) && (MovieSegments == null || MovieSegments.Count == 0)) { - if (selectedMetadata?.VariantID != null && selectedMetadata?.VariantID != 0) { - List storedSegments = GetSegments(); - if (storedSegments != null && storedSegments.Count > 0) { - MovieSegments = new BindingList(storedSegments); + if (target.SaveMorpheusMetadata || target.SaveSegments) { + if (!HasNoneEmptySegments()) { + + //ha nincs aktualis szegmens, akkor lekerjuk, hatha volt korabban + if (selectedMetadata?.VariantID != null && selectedMetadata?.VariantID != 0) { + List storedSegments = GetSegments(); + if (storedSegments != null) + MovieSegments = new BindingList(storedSegments); } + + if (!HasNoneEmptySegments()) + MessageBox.Show(string.Format("A(z) '{0}' folyamat nem futtatható szegmens adatok nélkül.", target.Label)); + return false; } - if (MovieSegments == null) { - MessageBox.Show(String.Format("A {0} folyamat nem futtatható szegmens adatok nélkül.", target.Label)); + if (ArchiveMetadata == null) + ArchiveMetadata = GetArchiveMetadata(); + if (ArchiveMetadata.ok) { + MessageBox.Show(string.Format("A(z) '{0}' folyamat nem futtatható elfogadott kópián.", target.Label)); return false; } switch (selectedMetadata.Kind) { case MetadataType.TrafficPromo: { if (MovieSegments.Count != 1) { - MessageBox.Show(String.Format("Promó anyagnak csak egy szegmens adata lehet.")); + MessageBox.Show(string.Format("Promó anyagnak csak egy szegmens adata lehet.")); return false; } break; diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index dafec937..ffa61412 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAS - CAAAAk1TRnQBSQFMAgEBAgEAAZABAgGQAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAZgBAgGYAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/client/Maestro/Properties/AssemblyInfo.cs b/client/Maestro/Properties/AssemblyInfo.cs index 0bb442fa..f6952ada 100644 --- a/client/Maestro/Properties/AssemblyInfo.cs +++ b/client/Maestro/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.9.6")] -[assembly: AssemblyFileVersion("2.0.9.6")] +[assembly: AssemblyVersion("2.0.9.9")] +[assembly: AssemblyFileVersion("2.0.9.9")] diff --git a/client/MaestroShared/Metadata/MetadataType.cs b/client/MaestroShared/Metadata/MetadataType.cs index 2f35ebcd..5d42f7df 100644 --- a/client/MaestroShared/Metadata/MetadataType.cs +++ b/client/MaestroShared/Metadata/MetadataType.cs @@ -7,11 +7,14 @@ namespace MaestroShared.Metadata { public class MetadataTypeUtil { private const string REGEXP_TRAFFICMATERIALID = "^M{1}[0-9]{6}[A-Z]{1}$"; - private const string REGEXP_TRAFFICMATERIALID_V1 = "^M{1}[0-9]{6}[A-Z]{1}[0-9]{1}$"; - private const string REGEXP_TRAFFICMATERIALID_V2 = "^M{1}[0-9]{6}[A-Z]{1}[A-Z]{1}$"; + private const string REGEXP_TRAFFICMATERIALID_V1 = "^M{1}[0-9]{6}[A-Z]{1}[0-9]{1}$";//kenya + private const string REGEXP_TRAFFICMATERIALID_V2 = "^M{1}[0-9]{6}[A-Z]{1}[A-Z]{1}$";//kenya + private const string REGEXP_TRAFFICMATERIALID_V3 = "^M[0-9]{2}-[0-9]{6}-([0-9]|[A-Z])$";//mv private const string REGEXP_TRAFFICADID = "^R{1}[0-9]{6}[A-Z]{1}$"; - private const string REGEXP_TRAFFICALTERNATEADID = "^C{1}[0-9]{6}[A-Z]{1}$"; + private const string REGEXP_TRAFFICADID_V1 = "^C{1}[0-9]{6}[A-Z]{1}$";//kenya + private const string REGEXP_TRAFFICADID_V2 = "^R[0-9]{2}-[0-9]{6}-[0-9]$";//mv private const string REGEXP_TRAFFICPROMOID = "^P{1}[0-9]{6}[A-Z]{1}$"; + private const string REGEXP_TRAFFICPROMOID_V1 = "^P[0-9]{2}-[0-9]{6}-[0-9]$";//mv private const string REGEXP_OCTOPUSSTORYID = "^[0-9]+$"; private const string REGEXP_OCTOPUSPLACEHOLDERID = "^[0-9]+_[0-9]+$"; private const string REGEXP_OCTOPUSPLACEHOLDERVERSIONEDID = "^[0-9]+_[0-9]+-[0-9]{3}$"; @@ -34,15 +37,27 @@ namespace MaestroShared.Metadata { if (match.Success) return MetadataType.TrafficMaterialSegment; + match = Regex.Match(id, REGEXP_TRAFFICMATERIALID_V3); + if (match.Success) + return MetadataType.TrafficMaterial; + match = Regex.Match(id, REGEXP_TRAFFICPROMOID); if (match.Success) return MetadataType.TrafficPromo; + match = Regex.Match(id, REGEXP_TRAFFICPROMOID_V1); + if (match.Success) + return MetadataType.TrafficPromo; + match = Regex.Match(id, REGEXP_TRAFFICADID); if (match.Success) return MetadataType.TrafficAD; - match = Regex.Match(id, REGEXP_TRAFFICALTERNATEADID); + match = Regex.Match(id, REGEXP_TRAFFICADID_V1); + if (match.Success) + return MetadataType.TrafficAD; + + match = Regex.Match(id, REGEXP_TRAFFICADID_V2); if (match.Success) return MetadataType.TrafficAD; diff --git a/client/MaestroShared/Metadata/MovieSegment.cs b/client/MaestroShared/Metadata/MovieSegment.cs index 0d36f60a..c2419a14 100644 --- a/client/MaestroShared/Metadata/MovieSegment.cs +++ b/client/MaestroShared/Metadata/MovieSegment.cs @@ -17,8 +17,12 @@ namespace MaestroShared.Metadata { public int SegID; public bool ReadOnly; + public bool IsGhost { + get => TCIn.Frames == 0 && TCOut.Frames == 0; + } + public Timecode TCIn { - get => tcIn; + get => tcIn ?? new Timecode(); set { tcIn = value; NotifyPropertyChanged(); @@ -26,7 +30,7 @@ namespace MaestroShared.Metadata { } public Timecode TCOut { - get => tcOut; + get => tcOut ?? new Timecode(); set { tcOut = value; NotifyPropertyChanged(); diff --git a/client/MaestroShared/Metadata/Traffic.cs b/client/MaestroShared/Metadata/Traffic.cs index 02df4a7c..7d939c14 100644 --- a/client/MaestroShared/Metadata/Traffic.cs +++ b/client/MaestroShared/Metadata/Traffic.cs @@ -19,9 +19,10 @@ namespace MaestroShared.Metadata { public string Segment { get { if (SegmentCount != null && SegmentNr != null) - return string.Format($"{SegmentCount} / {SegmentNr} : {MovieSegment?.MediaID}"); + //return string.Format($"{SegmentCount} / {SegmentNr} : {MovieSegment?.MediaID}"); + return string.Format($"{VariantID} ({SegmentCount} / {SegmentNr})"); else - return ""; + return VariantID == 0 ? "Kópia nélküli" : VariantID.ToString(); } } } diff --git a/client/MaestroShared/Properties/AssemblyInfo.cs b/client/MaestroShared/Properties/AssemblyInfo.cs index c592cd27..f3891638 100644 --- a/client/MaestroShared/Properties/AssemblyInfo.cs +++ b/client/MaestroShared/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.9.5")] -[assembly: AssemblyFileVersion("2.0.9.5")] +[assembly: AssemblyVersion("2.0.9.8")] +[assembly: AssemblyFileVersion("2.0.9.8")] diff --git a/client/MaestroShared/Targets/UNCTargetProcessor.cs b/client/MaestroShared/Targets/UNCTargetProcessor.cs index 6fbb317e..b150fc17 100644 --- a/client/MaestroShared/Targets/UNCTargetProcessor.cs +++ b/client/MaestroShared/Targets/UNCTargetProcessor.cs @@ -88,7 +88,9 @@ namespace MaestroShared.Targets { EnsureDirectoryExistence(workingDir); //multiszegmens mukodes eseten a filenevet a traffic generalja - if (!true.Equals(Parameters?.TrafficMetadata?.MultiSegmentEnabled)) + //if (!true.Equals(Parameters?.TrafficMetadata?.MultiSegmentEnabled)) + //deha nem szegmentalok, akkor nem + if (OutputName == null) OutputName = CreateOutputFileName(); CreateOutput(workingDir); workFlowAction.source = Input; diff --git a/client/PlanAIRClient/Properties/AssemblyInfo.cs b/client/PlanAIRClient/Properties/AssemblyInfo.cs index ca4782af..1068caa6 100644 --- a/client/PlanAIRClient/Properties/AssemblyInfo.cs +++ b/client/PlanAIRClient/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.3")] -[assembly: AssemblyFileVersion("1.0.0.3")] +[assembly: AssemblyVersion("1.0.0.9")] +[assembly: AssemblyFileVersion("1.0.0.9")] diff --git a/client/PlanAIRClient/Resources.Designer.cs b/client/PlanAIRClient/Resources.Designer.cs index bcbde51c..1912ccce 100644 --- a/client/PlanAIRClient/Resources.Designer.cs +++ b/client/PlanAIRClient/Resources.Designer.cs @@ -179,7 +179,7 @@ namespace TrafficClient { } /// - /// Looks up a localized string similar to Szegmens. + /// Looks up a localized string similar to Kópia (Szegmens). /// internal static string SEGMENT { get { diff --git a/client/PlanAIRClient/Resources.resx b/client/PlanAIRClient/Resources.resx index 1e9af041..a5527092 100644 --- a/client/PlanAIRClient/Resources.resx +++ b/client/PlanAIRClient/Resources.resx @@ -170,6 +170,6 @@ Az azonosító jelenleg nem található a rendszerben. Kérem próbálja újra. - Szegmens + Kópia (Szegmens) \ No newline at end of file diff --git a/client/PlanAIRClient/TrafficAPI.cs b/client/PlanAIRClient/TrafficAPI.cs index 998c2ba3..257871b5 100644 --- a/client/PlanAIRClient/TrafficAPI.cs +++ b/client/PlanAIRClient/TrafficAPI.cs @@ -84,7 +84,7 @@ namespace TrafficClient { materialWorker.SetMaterialOK(itemID, false); DeleteUnmappedSegments(itemID, segments, selectedSegments); result = ModifySegments(itemID, segments, selectedSegments); - Parameters?.MessageBus.Send(new TrafficAPIRefreshMessage()); + //Parameters?.MessageBus.Send(new TrafficAPIRefreshMessage()); } else { //egyebkent nem fogadja el a szegmnesadatokat? @@ -115,7 +115,7 @@ namespace TrafficClient { string newSegmentName = null; for (int i = 0; i < segments.Count; i++) { MovieSegment actualSegment = segments[i]; - bool newSegment = selectedSegments.Count - 1 < i || (selectedSegments.Count == 1 && selectedSegments[0].SegmentId == null); + bool newSegment = selectedSegments == null || selectedSegments.Count - 1 < i || (selectedSegments.Count == 1 && (selectedSegments[0].SegmentId == null || selectedSegments[0].MovieSegment.IsGhost)); if (newSegment) { segNr++; } else { @@ -128,7 +128,7 @@ namespace TrafficClient { string fileName = null; - //ha redifine volt, akkor minden modositott szegmens tartalmazza a fajlnevet + //ha redefine volt, akkor minden modositott szegmens tartalmazza a fajlnevet //ha define akkor az null, de a masodik szegmensnel mar az elsovel letrehozott fajlnev kell if (!newSegment && actualSegment.SegID != 0) fileName = actualSegment.MediaID; @@ -141,6 +141,7 @@ namespace TrafficClient { } logger.Info("Adding segment {0} {1}", segNr, fileName ?? "null"); + result = materialWorker.AddMaterialSegment(itemID, actualSegment, fileName, segNr); if (newSegment && newSegmentName == null) newSegmentName = result; @@ -150,6 +151,21 @@ namespace TrafficClient { } private void DeleteUnmappedSegments(int itemID, List segments, List selectedSegments) { + if (selectedSegments == null) + return; + + List ghosts = new List(); + foreach (var s in segments) { + if (s.IsGhost) { + materialWorker.DeleteMaterialSegment(itemID, s.SegID); + ghosts.Add(s); + } + } + + foreach (MovieSegment s in ghosts) { + segments.Remove(s); + } + int delSegCount = selectedSegments.Count - segments.Count; while (delSegCount > 0) { if (selectedSegments[selectedSegments.Count - 1].SegmentId == null) diff --git a/client/PlanAIRClient/TrafficIDSelector.Designer.cs b/client/PlanAIRClient/TrafficIDSelector.Designer.cs index 0fd4c3ea..33c9b5d4 100644 --- a/client/PlanAIRClient/TrafficIDSelector.Designer.cs +++ b/client/PlanAIRClient/TrafficIDSelector.Designer.cs @@ -1,7 +1,5 @@ -namespace TrafficClient -{ - partial class TrafficIDSelector - { +namespace TrafficClient { + partial class TrafficIDSelector { /// /// Required designer variable. /// @@ -11,10 +9,8 @@ /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); @@ -26,12 +22,11 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() - { + private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.trafficAPIBindingSource = new System.Windows.Forms.BindingSource(this.components); this.dtScheduled = new System.Windows.Forms.DateTimePicker(); this.txtFilter = new System.Windows.Forms.TextBox(); @@ -44,10 +39,13 @@ this.chkProblematic = new System.Windows.Forms.CheckBox(); this.dgTraffic = new System.Windows.Forms.DataGridView(); this.pSeparator = new System.Windows.Forms.Panel(); + this.btnNewVersion = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.trafficAPIBindingSource)).BeginInit(); this.pFolderType.SuspendLayout(); this.pSearch.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgTraffic)).BeginInit(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // dtScheduled @@ -198,23 +196,23 @@ this.dgTraffic.BackgroundColor = System.Drawing.Color.White; this.dgTraffic.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dgTraffic.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgTraffic.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgTraffic.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dgTraffic.DataSource = this.trafficAPIBindingSource; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgTraffic.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgTraffic.DefaultCellStyle = dataGridViewCellStyle5; this.dgTraffic.Dock = System.Windows.Forms.DockStyle.Fill; this.dgTraffic.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgTraffic.EnableHeadersVisualStyles = false; @@ -223,11 +221,11 @@ this.dgTraffic.MultiSelect = false; this.dgTraffic.Name = "dgTraffic"; this.dgTraffic.RowHeadersVisible = false; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.dgTraffic.RowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.dgTraffic.RowsDefaultCellStyle = dataGridViewCellStyle6; this.dgTraffic.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); this.dgTraffic.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgTraffic.Size = new System.Drawing.Size(300, 321); + this.dgTraffic.Size = new System.Drawing.Size(300, 298); this.dgTraffic.TabIndex = 0; this.dgTraffic.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnCellContentClick); this.dgTraffic.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnCellDoubleClick); @@ -242,12 +240,34 @@ this.pSeparator.Size = new System.Drawing.Size(300, 6); this.pSeparator.TabIndex = 13; // + // btnNewVersion + // + this.btnNewVersion.Dock = System.Windows.Forms.DockStyle.Right; + this.btnNewVersion.Enabled = false; + this.btnNewVersion.Location = new System.Drawing.Point(239, 0); + this.btnNewVersion.Name = "btnNewVersion"; + this.btnNewVersion.Size = new System.Drawing.Size(61, 23); + this.btnNewVersion.TabIndex = 14; + this.btnNewVersion.Text = "Új kópia"; + this.btnNewVersion.UseVisualStyleBackColor = true; + this.btnNewVersion.Click += new System.EventHandler(this.OnNewVersion); + // + // panel1 + // + this.panel1.Controls.Add(this.btnNewVersion); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 377); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(300, 23); + this.panel1.TabIndex = 15; + // // TrafficIDSelector // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.dgTraffic); + this.Controls.Add(this.panel1); this.Controls.Add(this.pSeparator); this.Controls.Add(this.pSearch); this.Name = "TrafficIDSelector"; @@ -258,6 +278,7 @@ this.pSearch.ResumeLayout(false); this.pSearch.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgTraffic)).EndInit(); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -276,5 +297,7 @@ private System.Windows.Forms.DataGridView dgTraffic; private System.Windows.Forms.Panel pSeparator; private MaestroShared.Controls.NoFocusCueButton btnRefresh; + private System.Windows.Forms.Button btnNewVersion; + private System.Windows.Forms.Panel panel1; } } diff --git a/client/PlanAIRClient/TrafficIDSelector.cs b/client/PlanAIRClient/TrafficIDSelector.cs index 9f775eed..98dee561 100644 --- a/client/PlanAIRClient/TrafficIDSelector.cs +++ b/client/PlanAIRClient/TrafficIDSelector.cs @@ -50,11 +50,15 @@ namespace TrafficClient { private void OnRefreshTrafficGrid(IMessage m) { BeginInvoke((Action)(() => { + //TODO meg kene orizni a kijelolest RefreshKeepPosition(); })); } public TrafficParameters Parameters { + get { + return parameters; + } set { parameters = value; var server = parameters.Configuration?.Server; @@ -94,6 +98,8 @@ namespace TrafficClient { dgTraffic.Columns.AddRange(GetPromoColumns(metadata)); items = trafficAPI.GetPromos(txtFilter.Text, chkProblematic.Checked, scheduledDate, scheduledDate); } + if (items != null) + items = items.OrderBy(i => i.VariantID).ToList(); if (items == null || items.Count == 0) trafficAPIBindingSource.DataSource = null; @@ -119,7 +125,7 @@ namespace TrafficClient { } ProjectSettings projectConfiguration = parameters?.Configuration?.ProjectSettings; - string text = trafficItem.Title; + string text = trafficItem.Title == null || trafficItem.Title.Length == 0 ? trafficItem.EpisodeTitle : trafficItem.Title; EdiusProject.Open(projectConfiguration, id, text, parameters.UserName); } @@ -171,36 +177,65 @@ namespace TrafficClient { } List selectedItems = items?.Where(i => i.Selected).ToList(); - if (selectedItems?.Count() > 0) { + if (selectedItems?.Count > 0) { + btnNewVersion.Enabled = true; CreateVersionIfMissing(trafficItem); IDChangedEvent?.Invoke(trafficItem.MediaID, trafficItem.VariantID, trafficItem.Title, selectedItems); - } else + } else { + btnNewVersion.Enabled = false; IDChangedEvent?.Invoke(null, 0, null, null); + } + } + + void UpdateItem(ref TrafficItem trafficItem, int variantID) { + TrafficItem currentVersion = trafficAPI.GetMaterials(trafficItem.EpisodeID, false).Where(t => t.VariantID == variantID).FirstOrDefault(); + if (currentVersion != null) { + trafficItem.MediaID = currentVersion.MediaID; + trafficItem.MovieSegment = currentVersion.MovieSegment; + trafficItem.SegmentCount = currentVersion.SegmentCount; + trafficItem.SegmentNr = currentVersion.SegmentNr; + trafficItem.SegmentId = currentVersion.SegmentId; + trafficItem.VariantID = currentVersion.VariantID; + } } private void CreateVersionIfMissing(TrafficItem trafficItem) { - if (String.IsNullOrEmpty(trafficItem.MediaID)) { - var currentVersion = trafficAPI.GetMaterials(trafficItem.EpisodeID, false)?.FirstOrDefault(); - if (currentVersion == null || String.IsNullOrEmpty(currentVersion.MediaID)) { - TrafficVersion newVersion = trafficAPI.CreateMaterialVersion(trafficItem.EpisodeID, false); - if (newVersion != null) { - trafficItem.MediaID = newVersion.MediaID; - trafficItem.VariantID = newVersion.VariantID; + if (string.IsNullOrEmpty(trafficItem.MediaID)) { + if (MultiSegment) { + + //meg kopia sincs + if (trafficItem.VariantID == 0) { + TrafficVersion newVersion = trafficAPI.CreateMaterialVersion(trafficItem.EpisodeID, false); + if (newVersion != null) + UpdateItem(ref trafficItem, newVersion.VariantID); } + + trafficAPI.SaveSegments(trafficItem.VariantID, MetadataType.TrafficMaterial, new List() { new MovieSegment() }); + UpdateItem(ref trafficItem, trafficItem.VariantID); + if (trafficItem.VariantID == 0 || string.IsNullOrEmpty(trafficItem.MediaID)) + return; } else { - trafficItem.MediaID = currentVersion.MediaID; - trafficItem.VariantID = currentVersion.VariantID; + + var currentVersion = trafficAPI.GetMaterials(trafficItem.EpisodeID, false)?.FirstOrDefault(); + if (currentVersion == null || String.IsNullOrEmpty(currentVersion.MediaID)) { + TrafficVersion newVersion = trafficAPI.CreateMaterialVersion(trafficItem.EpisodeID, false); + if (newVersion != null) { + trafficItem.MediaID = newVersion.MediaID; + trafficItem.VariantID = newVersion.VariantID; + } + } else { + trafficItem.MediaID = currentVersion.MediaID; + trafficItem.VariantID = currentVersion.VariantID; + } + + if (trafficItem.VariantID == 0 || string.IsNullOrEmpty(trafficItem.MediaID)) + return; + } - if (trafficItem.VariantID == 0 || string.IsNullOrEmpty(trafficItem.MediaID)) - return; + } else if (ModifierKeys.HasFlag(Keys.Shift)) { - var currentVersion = trafficAPI.GetMaterials(trafficItem.EpisodeID, false)?.FirstOrDefault(); - TrafficVersion newVersion = trafficAPI.CreateMaterialVersion(trafficItem.EpisodeID, true); - if (newVersion != null) { - RefreshKeepPosition(); - } } } @@ -329,6 +364,23 @@ namespace TrafficClient { RefreshResults(); } + + + private void OnNewVersion(object sender, EventArgs e) { + + List items = trafficAPIBindingSource.DataSource as List; + string episodeID = items?.Where(i => i.Selected).FirstOrDefault()?.EpisodeID; + if (episodeID != null) { + if (!MsgBox.YesNoQuestion("Biztosan létrehoz egy új kópiát a kijelölt epizódhoz?")) + return; + var currentVersion = trafficAPI.GetMaterials(episodeID, false)?.FirstOrDefault(); + TrafficVersion newVersion = trafficAPI.CreateMaterialVersion(episodeID, true); + if (newVersion != null) + RefreshKeepPosition(); + + } + + } } public class TrafficAPIMessage : MaestroMessage { diff --git a/client/PlanAIRClient/Workers/MultiSegmentMaterialWorker.cs b/client/PlanAIRClient/Workers/MultiSegmentMaterialWorker.cs index 61443787..3fd93fa9 100644 --- a/client/PlanAIRClient/Workers/MultiSegmentMaterialWorker.cs +++ b/client/PlanAIRClient/Workers/MultiSegmentMaterialWorker.cs @@ -19,9 +19,19 @@ namespace TrafficClient.Workers { get => 6002; } + protected override TrafficItemMetadata CreateTrafficItemMetadata(SqlDataReader reader) { + PlanAirMaterialResult item = dataReader.ToMultiMaterialResult(reader); + TrafficItemMetadata trafficItem = ToTrafficItemMetadata(item); + return trafficItem; + } + protected override TrafficItem CreateTrafficItem(SqlDataReader reader) { PlanAirMaterialResult item = dataReader.ToMultiMaterialResult(reader); TrafficItem trafficItem = ToTrafficItem(item); + + //MediaVivantis-ban nem a v_VariantMediaID-ben van az azonosito?? + trafficItem.MediaID = item.v_SegMediaID; + return trafficItem; } diff --git a/client/PlanAIRClient/Workers/SingleSegmentMaterialWorker.cs b/client/PlanAIRClient/Workers/SingleSegmentMaterialWorker.cs index b1175aba..02828a0c 100644 --- a/client/PlanAIRClient/Workers/SingleSegmentMaterialWorker.cs +++ b/client/PlanAIRClient/Workers/SingleSegmentMaterialWorker.cs @@ -10,7 +10,6 @@ using TrafficClient.Model; namespace TrafficClient.Workers { public class SingleSegmentMaterialWorker : TrafficWorker { - private static Logger logger = LogManager.GetCurrentClassLogger(); protected virtual bool MultiSegmentEnabled { get => false; } @@ -33,19 +32,24 @@ namespace TrafficClient.Workers { SegmentNr = data.v_SegNr, SegmentId = data.v_SegID }; - if (data.v_SegID != null && data.v_SegTcOut > 0) { + + // 0 hosszu szegmensek is kellenek + //if (data.v_SegID != null && data.v_SegTcOut > 0) { + if (data.v_SegID != null) { result.MovieSegment = new MovieSegment { TCIn = new Timecode((int)data.v_SegTcIn), TCOut = new Timecode((int)data.v_SegTcOut), Comment = data.v_SegTitle, Optional = true.Equals(data.v_SegDropable), - MediaID = data.v_SegMediaID + MediaID = data.v_SegMediaID, + SegID = data.v_SegID ?? 0, + SegNr = data.v_SegNr ?? 0 }; } return result; } - private TrafficItemMetadata ToTrafficItemMetadata(PlanAirMaterialResult data) { + protected TrafficItemMetadata ToTrafficItemMetadata(PlanAirMaterialResult data) { return new TrafficItemMetadata() { EpisodeID = data.v_EpisodeID, EpisodeTitle = data.v_EpTitle, @@ -78,7 +82,6 @@ namespace TrafficClient.Workers { cmd.Parameters.AddWithValue("@@DateParam1", from.Value.Date); if (to != null) cmd.Parameters.AddWithValue("@@DateParam2", to.Value.Date); - using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (result == null) @@ -102,23 +105,30 @@ namespace TrafficClient.Workers { return trafficItem; } + protected virtual TrafficItemMetadata CreateTrafficItemMetadata(SqlDataReader reader) { + PlanAirMaterialResult item = dataReader.ToSingleMaterialResult(reader); + TrafficItemMetadata trafficItem = ToTrafficItemMetadata(item); + return trafficItem; + } + public List GetMaterialArchiveMetadata(string strParam) { List result = null; try { TryConnect(); using (SqlCommand cmd = CreateCommmad()) { cmd.CommandType = CommandType.StoredProcedure; - cmd.Parameters.AddWithValue("@Operation", 1002); + cmd.Parameters.AddWithValue("@Operation", GetMaterialsID); cmd.Parameters.AddWithValue("@@@Options", 0); cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); cmd.Parameters.AddWithValue("@@StrParam1", strParam); - using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if (result == null) result = new List(); - PlanAirMaterialResult item = dataReader.ToSingleMaterialResult(reader); - result.Add(ToTrafficItemMetadata(item)); + + TrafficItemMetadata trafficItem = CreateTrafficItemMetadata(reader); + result.Add(trafficItem); + } } } @@ -134,6 +144,10 @@ namespace TrafficClient.Workers { get => 1105; } + + // @Operation int, @@@Options int, @@ItemID int, @@IntParam1 int=Null, @@IntParam2 int=Null, @@IntParam3 int=Null, + // @@StrParam1 varchar(200)=Null, @@StrParam2 varchar(max)=Null, @@DateParam1 datetime=Null, @@DateParam2 datetime=Null + public TrafficVersion CreateMaterialVersion(string episodeID, bool recut) { TrafficVersion result = null; try { @@ -146,7 +160,6 @@ namespace TrafficClient.Workers { cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); cmd.Parameters.AddWithValue("@@StrParam1", episodeID); cmd.Parameters.AddWithValue("@@StrParam2", DBNull.Value); - using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { result = new TrafficVersion();