This commit is contained in:
Roland Drabesch
2022-10-21 13:51:49 +02:00
149 changed files with 4252 additions and 2502 deletions
+51
View File
@@ -0,0 +1,51 @@
[*.{appxmanifest,asax,ascx,aspx,axaml,axml,build,c,c++,cc,cginc,compute,config,cp,cpp,cs,cshtml,csproj,css,cu,cuh,cxx,dbml,discomap,dtd,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,htm,html,hxx,inc,inl,ino,ipp,jsproj,lsproj,master,mpp,mq4,mq5,mqh,njsproj,nuspec,paml,proj,props,razor,resw,resx,skin,StyleCop,targets,tasks,tpp,usf,ush,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4
[*]
# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.property_rule.import_to_resharper = as_predefined
dotnet_naming_rule.property_rule.severity = none
dotnet_naming_rule.property_rule.style = first_upper_style
dotnet_naming_rule.property_rule.symbols = property_symbols
dotnet_naming_style.first_upper_style.capitalization = first_word_upper
dotnet_naming_style.first_upper_style.word_separator = _
dotnet_naming_symbols.property_symbols.applicable_accessibilities = *
dotnet_naming_symbols.property_symbols.applicable_kinds = property
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning
dotnet_style_predefined_type_for_locals_parameters_members = false:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_csharp_naming_rule.enum_member = AaBb:do_not_check
# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_bad_child_statement_indent_highlighting = none
resharper_bad_control_braces_indent_highlighting = none
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_local_function_can_be_made_static_highlighting = warning
resharper_redundant_base_qualifier_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="C:\ProgrammeSensus\Repo\Lab\La_Operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -0,0 +1,3 @@
<SessionState ContinuousTestingIsOn="True" ContinuousTestingMode="1" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
<Solution />
</SessionState>
+13
View File
@@ -1,7 +1,20 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ParenthesesInsertType/@EntryValue">Left</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedLocalFunction/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedLocalFunction_002ECompiler/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedType_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DN/@EntryIndexedValue">DN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FW/@EntryIndexedValue">FW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LUT/@EntryIndexedValue">LUT</s:String>
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/SaveExtendedSearch/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/UseReSharperMouseBackForwardNavigation/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=accu/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Applic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Approver/@EntryIndexedValue">True</s:Boolean>
+5 -1
View File
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:Int64 x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/AutoNamingCompletedVersion/@EntryValue">2</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNamingAutoDetectionCompleted/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean>
@@ -26,9 +27,12 @@
<s:Boolean x:Key="/Default/Environment/ExcludedFiles/FilesAndFoldersToSkip/=1057AD21_002DBA22_002D4CAB_002DB3FE_002D88C5C9980E6A_002Fd_003AScripts_002Ff_003Ajquery_002D1_002E10_002E2_002Eintellisense_002Ejs/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/UseMsbuildSolutionBuilder/@EntryValue">NewVersion</s:String>
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a44a776d_002Dd671_002D4675_002Dac7b_002Db6775ec7f289/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas\AppData\Local\Temp\JetBrains\ReSharperPlatformVs15\vAny_33007af5\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a44a776d_002Dd671_002D4675_002Dac7b_002Db6775ec7f289/@EntryIndexedValue">&lt;SessionState ContinuousTestingIsOn="True" ContinuousTestingMode="1" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Profiling/Configurations/=0/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName&gt;D:\Workspace\WorkBenchV2\Main\ZeroFlowTool\bin\Debug\GenesisDisplayTool.exe&lt;/FileName&gt;&lt;WorkingDirectory&gt;D:\Workspace\WorkBenchV2\Main\ZeroFlowTool\bin\Debug&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="PerformanceInfo"&gt;&lt;MeasureType&gt;Sampling&lt;/MeasureType&gt;&lt;MeterKind&gt;Rdtsc&lt;/MeterKind&gt;&lt;InjectInfo&gt;&lt;SymbolSearch&gt;&lt;SearchPaths /&gt;&lt;/SymbolSearch&gt;&lt;Scope&gt;&lt;PatternFilters /&gt;&lt;DenyAttributeFilters /&gt;&lt;/Scope&gt;&lt;/InjectInfo&gt;&lt;/Info&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="PerformanceInfo"&gt;&lt;MeasureType&gt;TracingInject&lt;/MeasureType&gt;&lt;MeterKind&gt;Rdtsc&lt;/MeterKind&gt;&lt;InjectInfo&gt;&lt;SymbolSearch&gt;&lt;SearchPaths /&gt;&lt;/SymbolSearch&gt;&lt;Scope&gt;&lt;PatternFilters&gt;&lt;Item /&gt;&lt;/PatternFilters&gt;&lt;DenyAttributeFilters /&gt;&lt;/Scope&gt;&lt;/InjectInfo&gt;&lt;/Info&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/Profiling/Configurations/=2/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo" /&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;ReprofileDisableReason&gt;LaunchedByReSharperUnitTestRunner&lt;/ReprofileDisableReason&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
@@ -7,16 +7,16 @@ namespace CordonelAssemblyLine.Converter
{
public class MathConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public Object Convert(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
{
return double.Parse((string)value, CultureInfo.CurrentUICulture);
return double.Parse((String)value, CultureInfo.CurrentUICulture);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public Object ConvertBack(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
{
string format = "";
string strValue = (string)value;
String format = "";
String strValue = (String)value;
strValue = strValue.Replace("x", "*").Replace("X", "*");
if (strValue.ToUpper().Contains("E"))
{
@@ -39,6 +39,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\CordonelAssemblyLine.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,8 +25,8 @@ namespace CordonelAssemblyLine.Data
Remark = baseData.Remark;
Rev = baseData.Rev;
TesterName = baseData.TesterName;
Testpoints = new ObservableCollection<PressureTestPoints>();
baseData.TestPoints.ForEach(o => Testpoints.Add(o));
TestPoints = new ObservableCollection<PressureTestPoints>();
baseData.TestPoints.ForEach(o => TestPoints.Add(o));
TestPressure = baseData.TestPressure;
}
public PressureResultDataNotifyable()
@@ -39,108 +39,107 @@ namespace CordonelAssemblyLine.Data
}
public string PcbId;
public String PcbId;
private int rev = 0;
private Int32 _rev;
public int Rev
public Int32 Rev
{
get { return rev; }
get => _rev;
set
{
rev = value;
_rev = value;
InternalPropertyChanged(nameof(Rev));
}
}
private bool? passed = false;
public bool? Passed
private Boolean? _passed = false;
public Boolean? Passed
{
get { return passed; }
get => _passed;
set
{
passed = value;
_passed = value;
InternalPropertyChanged(nameof(Passed));
}
}
private string testerName = "";
private String _testerName = "";
public String TesterName
{
get { return testerName; }
get => _testerName;
set
{
testerName = value;
_testerName = value;
InternalPropertyChanged(nameof(TesterName));
}
}
private string testPressure = "6";
private String _testPressure = "6";
public String TestPressure
{
get { return testPressure; }
get => _testPressure;
set
{
testPressure = value;
_testPressure = value;
InternalPropertyChanged(nameof(TestPressure));
}
}
private string leakRate = " 0,00001";
private String _leakRate = " 0,00001";
public String LeakRate
{
get { return leakRate; }
get => _leakRate;
set
{
leakRate = value;
_leakRate = value;
InternalPropertyChanged(nameof(LeakRate));
}
}
private string remark = "";
private String _remark = "";
public String Remark
{
get { return remark; }
get => _remark;
set
{
remark = value;
_remark = value;
InternalPropertyChanged(nameof(Remark));
}
}
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>() {
new PressureTestPoints() { Ident = 1, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 2, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 3, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 4, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 5, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 6, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 7, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 8, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 9, Input = "0,000000200000" },
new PressureTestPoints() { Ident = 10, Input = "0,000000200000" }
};
public ObservableCollection<PressureTestPoints> Testpoints
private ObservableCollection<PressureTestPoints> _testPoints = new ObservableCollection<PressureTestPoints>
{
get { return testpoints; }
new PressureTestPoints { Ident = 1, Input = "0,000000200000" },
new PressureTestPoints { Ident = 2, Input = "0,000000200000" },
new PressureTestPoints { Ident = 3, Input = "0,000000200000" },
new PressureTestPoints { Ident = 4, Input = "0,000000200000" },
new PressureTestPoints { Ident = 5, Input = "0,000000200000" },
new PressureTestPoints { Ident = 6, Input = "0,000000200000" },
new PressureTestPoints { Ident = 7, Input = "0,000000200000" },
new PressureTestPoints { Ident = 8, Input = "0,000000200000" },
new PressureTestPoints { Ident = 9, Input = "0,000000200000" },
new PressureTestPoints { Ident = 10, Input = "0,000000200000" }
};
public ObservableCollection<PressureTestPoints> TestPoints
{
get => _testPoints;
set
{
testpoints = value;
InternalPropertyChanged(nameof(Testpoints));
_testPoints = value;
InternalPropertyChanged(nameof(TestPoints));
}
}
internal void SetAllTestPoints(string input)
internal void SetAllTestPoints(String input)
{
foreach (var item in Testpoints)
foreach (var item in TestPoints)
{
item.Input = input;
}
InternalPropertyChanged(nameof(Testpoints));
InternalPropertyChanged(nameof(TestPoints));
}
public PressureResultData ToBase()
{
@@ -151,7 +150,7 @@ namespace CordonelAssemblyLine.Data
baseData.Remark = Remark;
baseData.Rev = Rev;
baseData.TesterName = TesterName;
baseData.TestPoints = Testpoints.ToList();
baseData.TestPoints = TestPoints.ToList();
baseData.TestPressure = TestPressure;
return baseData;
}
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CordonelAssemblyLine.Event
{
public class StringArgs : EventArgs
{
public readonly string Content;
public StringArgs(string content)
public readonly String Content;
public StringArgs(String content)
{
Content = content;
}
+9 -9
View File
@@ -13,7 +13,7 @@ namespace CordonelAssemblyLine
public partial class Leak : Window
{
private LeakViewModel ViewModel = null;
public Leak(CancellationToken globalCancellationToken, int slotNR, int? stationID = null, string Tester= "-")
public Leak(CancellationToken globalCancellationToken, Int32 slotNR, Int32? stationID = null, String Tester= "-")
{
InitializeComponent();
ViewModel = new LeakViewModel(slotNR, stationID);
@@ -25,25 +25,25 @@ namespace CordonelAssemblyLine
}
private void BtnPresueFailed_Click(object sender, RoutedEventArgs e)
private void BtnPresueFailed_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(false);
}
private void BtnPresueOk_Click(object sender, RoutedEventArgs e)
private void BtnPresueOk_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(true);
}
private void ViewModel_OnStoreDone(object sender, StringArgs e)
private void ViewModel_OnStoreDone(Object sender, StringArgs e)
{
MessageBox.Show(e.Content);
}
private void ViewModel_MeterDetectedHandler(object sender, EventArgs e)
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
bool update = false;
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
@@ -64,9 +64,9 @@ namespace CordonelAssemblyLine
}
));
}
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
string input = "";
String input = "";
var obj = ((FrameworkElement)sender).DataContext;
if (obj is Xylem.Common.Logic.ProductionOrderCore.TestResults.PressureTestPoints ptp)
{
@@ -110,7 +110,7 @@ namespace CordonelAssemblyLine
//}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e)
{
ViewModel.Dispose();
this.Title = "";
+18 -17
View File
@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading;
using System.Windows;
@@ -13,13 +14,13 @@ namespace CordonelAssemblyLine
private Picking PickingWindow;
private Leak LeakWindow;
private Marriage MarriageWindow;
public string PickingSlot { get; set; }
public String PickingSlot { get; set; }
public string PickingBarcode { get; set; }
public string LeakSlot { get; set; }
public string LeakStationId { get; set; }
public string MarriageSlot { get; set; }
public string MarriageBarcode { get; set; }
public String PickingBarcode { get; set; }
public String LeakSlot { get; set; }
public String LeakStationId { get; set; }
public String MarriageSlot { get; set; }
public String MarriageBarcode { get; set; }
public MainWindow()
{
InitializeComponent();
@@ -43,7 +44,7 @@ namespace CordonelAssemblyLine
}
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
if (PickingWindow?.Title == "")
{
@@ -67,7 +68,7 @@ namespace CordonelAssemblyLine
}
private void Button_Click_1(object sender, RoutedEventArgs e)
private void Button_Click_1(Object sender, RoutedEventArgs e)
{
if (LeakWindow?.Title == "")
{
@@ -89,7 +90,7 @@ namespace CordonelAssemblyLine
}
}
private void Button_Click_2(object sender, RoutedEventArgs e)
private void Button_Click_2(Object sender, RoutedEventArgs e)
{
if (MarriageWindow?.Title == "")
{
@@ -112,10 +113,10 @@ namespace CordonelAssemblyLine
}
private System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement> progressbars = new System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement>();
string el1 = "nicht so lang";
string el2 = "Maximal dreißig zeichen 30!!!";
string el3 = "viel zu viele zeichen man kann auch nicht alles haben3";
private void Btn1_Click(object sender, RoutedEventArgs e)
String el1 = "nicht so lang";
String el2 = "Maximal dreißig zeichen 30!!!";
String el3 = "viel zu viele zeichen man kann auch nicht alles haben3";
private void Btn1_Click(Object sender, RoutedEventArgs e)
{
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Cloud, Name = el1});
progressbars.Add(new Ui.ProductionControls.ctlPictureProgressBar.ImageElement() { Image = Ui.ProductionControls.Enums.Img.Compare, Name = el2});
@@ -125,21 +126,21 @@ namespace CordonelAssemblyLine
}
private void Btn2_Click(object sender, RoutedEventArgs e)
private void Btn2_Click(Object sender, RoutedEventArgs e)
{
progressbars.Where(n => n.Name == el1).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Btn3_Click(object sender, RoutedEventArgs e)
private void Btn3_Click(Object sender, RoutedEventArgs e)
{
progressbars.Where(n => n.Name == el2).First().State = Ui.ProductionControls.Enums.ImgStatus.Success;
progressbars.Where(n => n.Name == el3).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e)
{
if (PickingWindow != null)
{
+15 -28
View File
@@ -1,60 +1,47 @@
using CordonelAssemblyLine.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace CordonelAssemblyLine
{
/// <summary>
/// Interaction logic for Marriage.xaml
/// </summary>
public partial class Marriage : Window
public partial class Marriage
{
MarriageViewModel Model;
CancellationToken GlobalCancellationToken;
public Marriage(CancellationToken globalCancellationToken, int slot, string barcode)
readonly MarriageViewModel _model;
readonly CancellationToken _globalCancellationToken;
public Marriage(CancellationToken globalCancellationToken, Int32 slot, String barcode)
{
GlobalCancellationToken = globalCancellationToken;
_globalCancellationToken = globalCancellationToken;
Model = new MarriageViewModel(barcode, slot);
Model.OnMsgRaise += Model_OnMsgRaise;
DataContext = Model;
_model = new MarriageViewModel(barcode, slot);
_model.OnMsgRaise += Model_OnMsgRaise;
DataContext = _model;
InitializeComponent();
}
private void Model_OnMsgRaise(object sender, string e)
private static void Model_OnMsgRaise(Object sender, String e)
{
MessageBox.Show(e,"Fehler beim Verheiraten");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
private void Window_Loaded(Object sender, RoutedEventArgs e)
{
Model.StartPicking(GlobalCancellationToken);
_model.StartPicking(_globalCancellationToken);
}
private void btnMarry_Click(object sender, RoutedEventArgs e)
private void btnMarry_Click(Object sender, RoutedEventArgs e)
{
Model.StartStore();
_model.StartStore();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e)
{
Model.Dispose();
_model.Dispose();
this.Title = "";
}
}
@@ -41,8 +41,8 @@ namespace CordonelAssemblyLine.Model
NotifyPropertyChanged(nameof(Result));
}
}
private string testerName;
public string TesterName
private String testerName;
public String TesterName
{
get { return testerName; }
set
@@ -52,8 +52,8 @@ namespace CordonelAssemblyLine.Model
}
}
private bool inputIsEnabled = false;
public bool InputIsEnabled
private Boolean inputIsEnabled = false;
public Boolean InputIsEnabled
{
get { return inputIsEnabled; }
set
@@ -63,16 +63,16 @@ namespace CordonelAssemblyLine.Model
}
}
private int intervalWithoutDetect = 1000;
private int intervalWithDetect = 10000;
private string _currentPcbID;
private Int32 intervalWithoutDetect = 1000;
private Int32 intervalWithDetect = 10000;
private String _currentPcbID;
private MeterBatch Batch = new MeterBatch();
public GenesisMeter CurrentMeter { get; private set; }
public bool Locked { get; set; } = false;
public int? StationID { get; set; } = null;
private string toolTip;
public string ToolTipInput
public Boolean Locked { get; set; } = false;
public Int32? StationID { get; set; } = null;
private String toolTip;
public String ToolTipInput
{
get
{
@@ -86,7 +86,7 @@ namespace CordonelAssemblyLine.Model
}
}
public string CurrentPcbID
public String CurrentPcbID
{
get
{
@@ -99,8 +99,8 @@ namespace CordonelAssemblyLine.Model
NotifyPropertyChanged(nameof(CurrentPcbID));
}
}
private bool _currentPcbHasPressure;
public bool CurrentPcbHasPressure
private Boolean _currentPcbHasPressure;
public Boolean CurrentPcbHasPressure
{
get
{
@@ -115,7 +115,7 @@ namespace CordonelAssemblyLine.Model
}
private Timer tmrAutoDetect;
public LeakViewModel(int slotNR, int? stationID = null)
public LeakViewModel(Int32 slotNR, Int32? stationID = null)
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
StationID = stationID;
@@ -134,7 +134,7 @@ namespace CordonelAssemblyLine.Model
}
public bool isHydraulicStaion()
public Boolean isHydraulicStaion()
{
if (!StationID.HasValue || StationID.Value == 1)
@@ -144,17 +144,17 @@ namespace CordonelAssemblyLine.Model
return true;
}
private readonly ILogger _logger;
private readonly int SlotNr;
private readonly Int32 SlotNr;
public void Log(string txt)
public void Log(String txt)
{
_logger?.Info(txt);
}
private bool Detect()
private Boolean Detect()
{
Log("Start Detect");
bool hasDetect = false;
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
{
Batch = new MeterBatch();
@@ -170,7 +170,7 @@ namespace CordonelAssemblyLine.Model
try
{
tryMeter.Login();
var hasPresure = RegisterConverter.ConvertTo<bool>(tryMeter.ReadRegister("METROLOGYASST_PressurePresent"));
var hasPresure = RegisterConverter.ConvertTo<Boolean>(tryMeter.ReadRegister("METROLOGYASST_PressurePresent"));
CurrentPcbHasPressure = hasPresure;
}
catch (Exception ex)
@@ -243,7 +243,7 @@ namespace CordonelAssemblyLine.Model
DisposeAllConnections();
}
public void TmrAutoDetect_Elapsed(object sender, EventArgs e)
public void TmrAutoDetect_Elapsed(Object sender, EventArgs e)
{
tmrAutoDetect.Enabled = false;
var hasDetect = Detect();
@@ -257,13 +257,13 @@ namespace CordonelAssemblyLine.Model
}
tmrAutoDetect.Enabled = true;
}
internal void ReloadData(bool reset)
internal void ReloadData(Boolean reset)
{
if (Result != null && Result.PcbId != CurrentPcbID)
{
InputIsEnabled = false;
Result = new PressureResultDataNotifyable() { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Result = new PressureResultDataNotifyable() { Remark = "loading", TestPoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Task<PressureResultDataNotifyable>.Run(() =>
{
try
@@ -290,7 +290,7 @@ namespace CordonelAssemblyLine.Model
PressureResultData = new PressureResultDataNotifyable();
if (!CurrentPcbHasPressure)
{
PressureResultData.Testpoints.Remove(PressureResultData.Testpoints.First(r => r.Ident == 10));
PressureResultData.TestPoints.Remove(PressureResultData.TestPoints.First(r => r.Ident == 10));
}
@@ -326,7 +326,7 @@ namespace CordonelAssemblyLine.Model
}
internal void StoreData(bool successfull)
internal void StoreData(Boolean successfull)
{
if (Result != null && Result.PcbId == CurrentPcbID)
@@ -21,154 +21,131 @@ using Xylem.Common.Utils.Logging;
namespace CordonelAssemblyLine.Model
{
internal class MarriageViewModel : INotifyPropertyChanged
internal sealed class MarriageViewModel : INotifyPropertyChanged
{
public event EventHandler<string> OnMsgRaise;
public MarriageViewModel(string scannerPort, int slotNr)
public event EventHandler<String> OnMsgRaise;
public MarriageViewModel(String scannerPort, Int32 slotNr)
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
ScannerPort = scannerPort;
SlotNr = slotNr;
_scannerPort = scannerPort;
_slotNr = slotNr;
}
private readonly ILogger _logger;
private string state = "Warte auf Scanner";
private string scanner = "keine Verbindung";
private string slot = "-";
private string result = "-";
private String _stateMsg = "Warte auf Scanner";
private String _scanner = "Keine Verbindung";
private String _slot = "-";
private String _result = "-";
private System.Windows.Media.Brush resultColor;
private System.Windows.Media.Brush _resultColor;
public System.Windows.Media.Brush ResultColor
{
get
{
return resultColor;
}
get => _resultColor;
set
{
resultColor = value;
NotifyPropertyChanged(nameof(ResultColor));
_resultColor = value;
NotifyPropertyChanged();
}
}
public string State
public String State
{
get
{
return state;
}
get => _stateMsg;
set
{
state = value;
NotifyPropertyChanged(nameof(State));
_stateMsg = value;
NotifyPropertyChanged();
}
}
public string Scanner
public String Scanner
{
get
{
return scanner;
}
get => _scanner;
set
{
scanner = value;
NotifyPropertyChanged(nameof(Scanner));
_scanner = value;
NotifyPropertyChanged();
}
}
public string Slot
public String Slot
{
get
{
return slot;
}
get => _slot;
set
{
slot = value;
NotifyPropertyChanged(nameof(Slot));
_slot = value;
NotifyPropertyChanged();
}
}
public string SerialNr
public String SerialNr
{
get
{
return serialNr;
}
get => _serialNr;
set
{
serialNr = value;
NotifyPropertyChanged(nameof(SerialNr));
_serialNr = value;
NotifyPropertyChanged();
}
}
public string Result
public String Result
{
get
{
return result;
}
get => _result;
set
{
result = value;
NotifyPropertyChanged(nameof(Result));
_result = value;
NotifyPropertyChanged();
}
}
public bool CanMarry
public Boolean CanMarry
{
get
{
return canMarry;
}
get => _canMarry;
set
{
canMarry = value;
NotifyPropertyChanged(nameof(CanMarry));
_canMarry = value;
NotifyPropertyChanged();
}
}
public string PcbId
public String PcbId
{
get
{
return pcbId;
}
get => _pcbId;
set
{
pcbId = value;
NotifyPropertyChanged(nameof(PcbId));
_pcbId = value;
NotifyPropertyChanged();
}
}
private string pcbId;
private bool canMarry = false;
private String _pcbId;
private Boolean _canMarry;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
Task s;
private bool CloseTask = false;
Task _s;
private Boolean _closeTask;
public void Dispose()
{
while (!s.IsCompleted)
while (!_s.IsCompleted)
{
CloseTask = true;
_closeTask = true;
}
}
public void StartStore()
{
sm = PickingStateMachine.Store;
_state = PickingStateMachine.Store;
}
public void StartPicking(CancellationToken cancle)
{
s = new Task(() => { PickingLoop(cancle); }, cancle);
s.Start();
_s = new Task(() => { PickingLoop(cancle); }, cancle);
_s.Start();
}
public enum PickingStateMachine
{
@@ -183,45 +160,44 @@ namespace CordonelAssemblyLine.Model
Done,
GetMappingMSG
}
private PickingStateMachine sm = PickingStateMachine.Init;
private PickingStateMachine _state = PickingStateMachine.Init;
private class BarScanner : IDisposable
{
public bool? IsRuning = null;
public Boolean? IsRuning;
public String Input = "";
private String Port;
private CancellationToken Cancellation;
private Task WaitForScannerTask;
public BarScanner(string port, CancellationToken cancellation)
private String _port;
private CancellationToken _cancellation;
private Task _waitForScannerTask;
public BarScanner(String port, CancellationToken cancellation)
{
Port = port;
Cancellation = cancellation;
_port = port;
_cancellation = cancellation;
}
public void Start()
{
if (!IsRuning.HasValue || !IsRuning.Value)
{
if (Port == null)
if (_port == null)
{
return;
}
WaitForScannerTask = new Task(() =>
_waitForScannerTask = new Task(() =>
{
try
{
using (var a = new SerialPort(Port))
using (var a = new SerialPort(_port))
{
a.Open();
a.NewLine = "\r";
while (true)
{
if (Cancellation.IsCancellationRequested)
if (_cancellation.IsCancellationRequested)
{
IsRuning = false;
break;
}
else
{
IsRuning = true;
Input = a.ReadLine();
a.Close();
@@ -230,54 +206,52 @@ namespace CordonelAssemblyLine.Model
}
}
}
}
catch (Exception ex)
catch (Exception)
{
IsRuning = false;
}
}, Cancellation);
WaitForScannerTask.Start();
}, _cancellation);
_waitForScannerTask.Start();
}
}
public void Dispose()
{
if (WaitForScannerTask.Status != TaskStatus.Faulted && WaitForScannerTask.Status != TaskStatus.RanToCompletion && WaitForScannerTask.Status != TaskStatus.Canceled)
if (_waitForScannerTask.Status != TaskStatus.Faulted && _waitForScannerTask.Status != TaskStatus.RanToCompletion && _waitForScannerTask.Status != TaskStatus.Canceled)
{
WaitForScannerTask.Dispose();
_waitForScannerTask.Dispose();
}
}
}
public bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
public Boolean Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 frequency, UInt32 meterSize, Boolean pressurePresent)
{
using (var Batch = new MeterBatch())
using (var batch = new MeterBatch())
{
using (var meter = new GenesisMeter())
{
meter.SetupFromConfigFile(SlotNr);
Batch.AddMeter(meter);
meter.SetupFromConfigFile(_slotNr);
batch.AddMeter(meter);
State = "Am Zähler anmelden";
if ((bool)meter.Login())
if (meter.Login())
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
meter.SetProcessState(DisplayCodes.PickingStarted);
var ret = RunCheck(checkAppsIdVersion, frequency, meterSize, pressurePresent, meter);
if (ret)
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={serialNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={_serialNr}";
var retString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
var result = false;
if (bool.TryParse(RetString, out result))
if (bool.TryParse(retString, out var result))
{
return result;
@@ -285,7 +259,7 @@ namespace CordonelAssemblyLine.Model
}
else
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
meter.SetProcessState(DisplayCodes.PickingFailed);
}
}
}
@@ -293,34 +267,34 @@ namespace CordonelAssemblyLine.Model
return false;
}
private bool RunCheck(Dictionary<uint, uint> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent, GenesisMeter meter)
private Boolean RunCheck(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 frequency, UInt32 meterSize, Boolean pressurePresent, GenesisMeter meter)
{
State = $"Üperprüfe Parameter";
var FrequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
if (FrequencyReadOut != Frequency)
var frequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
if (frequencyReadOut != frequency)
{
State = $"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz";
State = $"Falsche Frequenz! soll {frequency}MHz ist {frequencyReadOut}MHz";
return false;
}
var MeterSizeReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
if (MeterSizeReadOut != MeterSize)
var meterSizeReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
if (meterSizeReadOut != meterSize)
{
State = $"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN";
State = $"Meter Dn falsch! soll {meterSize}DN ist {meterSizeReadOut}DN";
return false;
}
var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (PressureReadOut != PressurePresent)
var pressureReadOut = RegisterConverter.ConvertTo<Boolean>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (pressureReadOut != pressurePresent)
{
if (PressurePresent)
if (pressurePresent)
{
State = $"Pcb mit Drucksensor. Laut Auftrag keine verbaut";
State = "Pcb mit Drucksensor. Laut Auftrag ist keiner verbaut";
}
else
{
State = $"Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
State = "Pcb ohne Drucksensor. Laut Auftrag soll einer verbaut werden";
}
//todo raus
return false;
@@ -331,17 +305,17 @@ namespace CordonelAssemblyLine.Model
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
var meterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (meterFWApp.Version != item.Value)
{
State = $"Falsche FW, bitte Updaten";
State = "Falsche FW, bitte Updaten";
return false;
}
}
catch (Exception)
{
State = $"Fehler beim auslesen der FW";
State = "Fehler beim auslesen der FW";
return false;
}
@@ -356,93 +330,91 @@ namespace CordonelAssemblyLine.Model
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (!storeRet.All(a => a.Equals(0)))
{
State = $"Filesystem corrupt";
State = "Filesystem corrupt";
return false;
}
}
catch (Exception)
{
State = $"Fehler beim überprüfen des Filesystems";
State = "Fehler beim überprüfen des Filesystems";
return false;
}
return true;
}
private PickingCompareItem OrderDetails;
private BarScanner barScanner;
private string serialNr;
//private PickingCompareItem _orderDetails;
private BarScanner _barScanner;
private String _serialNr;
private bool RequestDetails = false;
private readonly string ScannerPort;
private readonly int SlotNr;
private Boolean _requestDetails;
private readonly String _scannerPort;
private readonly Int32 _slotNr;
//PickingState,PickingScanner,PickingSlot,PickingResult
private void PickingLoop(CancellationToken token)
{
while (!token.IsCancellationRequested && !CloseTask)
while (!token.IsCancellationRequested && !_closeTask)
{
switch (sm)
switch (_state)
{
case PickingStateMachine.Init:
CanMarry = false;
State = "Initialisierung";
Slot = $"Inaktiv EP {SlotNr}";
Scanner = $"Geschlossen {ScannerPort}";
Slot = $"Inaktiv EP {_slotNr}";
Scanner = $"Geschlossen {_scannerPort}";
//CheckAllPorts?
Scanner = $"Öfffne {ScannerPort}";
Scanner = $"Öfffne {_scannerPort}";
//CheckAllPorts?
barScanner = new BarScanner(ScannerPort, token);
barScanner.Start();
_barScanner = new BarScanner(_scannerPort, token);
_barScanner.Start();
while (!barScanner.IsRuning.HasValue)
while (!_barScanner.IsRuning.HasValue)
{
Thread.Sleep(50);
}
if (barScanner.IsRuning.HasValue && barScanner.IsRuning.Value)
if (_barScanner.IsRuning.HasValue && _barScanner.IsRuning.Value)
{
Scanner = $"Offen {ScannerPort}";
sm = PickingStateMachine.WaitForScanning;
Scanner = $"Offen {_scannerPort}";
_state = PickingStateMachine.WaitForScanning;
}
else
{
Scanner = $"Nicht geöffnet {ScannerPort}";
sm = PickingStateMachine.Init;
Scanner = $"Nicht geöffnet {_scannerPort}";
_state = PickingStateMachine.Init;
Thread.Sleep(5000);
}
break;
case PickingStateMachine.WaitForScanning:
OrderDetails = null;
State = $"Warte auf Scannereingabe({ScannerPort})";
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
//_orderDetails = null;
State = $"Warte auf Scannereingabe({_scannerPort})";
if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input))
{
if (RequestDetails)
if (_requestDetails)
{
State = $"Abfrage ";
PcbId = barScanner.Input;
barScanner.Input = "";
sm = PickingStateMachine.GetMappingMSG;
PcbId = _barScanner.Input;
_barScanner.Input = "";
_state = PickingStateMachine.GetMappingMSG;
}
else
{
if (barScanner.Input.Contains("%RequestMapping%"))
if (_barScanner.Input.Contains("%RequestMapping%"))
{
RequestDetails = true;
_requestDetails = true;
State = $"PCB ID scannen!";
barScanner = new BarScanner(ScannerPort, token);
barScanner.Start();
_barScanner = new BarScanner(_scannerPort, token);
_barScanner.Start();
}
else
{
SerialNr = barScanner.Input;
Scanner = $"Geschlossen {ScannerPort}";
barScanner = null;
sm = PickingStateMachine.WaitForDetect;
SerialNr = _barScanner.Input;
Scanner = $"Geschlossen {_scannerPort}";
_barScanner = null;
_state = PickingStateMachine.WaitForDetect;
}
}
@@ -452,7 +424,7 @@ namespace CordonelAssemblyLine.Model
break;
case PickingStateMachine.WaitForDetect:
using (var Batch = new MeterBatch())
using (var batch = new MeterBatch())
{
using (var tryMeter = new GenesisMeter())
@@ -460,9 +432,9 @@ namespace CordonelAssemblyLine.Model
try
{
State = $"Warte auf Pcb";
Slot = $"Öffne EP {SlotNr}";
tryMeter.SetupFromConfigFile(SlotNr);
Batch.AddMeter(tryMeter);
Slot = $"Öffne EP {_slotNr}";
tryMeter.SetupFromConfigFile(_slotNr);
batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
PcbId = tryMeter.GetPcbId();
@@ -473,11 +445,11 @@ namespace CordonelAssemblyLine.Model
{
State = $"Pcb gefunden {PcbId}";
Log($"New PcbID detected {PcbId}");
sm = PickingStateMachine.GetMapping;
_state = PickingStateMachine.GetMapping;
}
else
{
Slot = $"Keine Konnektivität EP {SlotNr}";
Slot = $"Keine Konnektivität EP {_slotNr}";
Log($"No Meter found");
}
}
@@ -492,95 +464,96 @@ namespace CordonelAssemblyLine.Model
case PickingStateMachine.GetMappingMSG:
State = $"Lade Auftragsdaten {serialNr}";
var msgRetCode = 0;
var msgStr = LocalWebRequest.GetRequestWithError($"{ServiceUrls.MarriageServiceUrl()}GetPreMarriageStateMSG?PcbId={PcbId}", out msgRetCode, 15000);
State = $"Lade Auftragsdaten {_serialNr}";
var msgStr = LocalWebRequest.GetRequestWithError($"{ServiceUrls.MarriageServiceUrl()}" +
$"GetPreMarriageStateMSG?PcbId={PcbId}", out var msgRetCode, 15000);
var msgRetInt = MarriagePossibleEnum.None;
var sbMSG = new StringBuilder();
var sbMsg = new StringBuilder();
var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<object[]>(msgStr);
string retOrder = myJsonResponse[1]?.ToString();
string retSerial = myJsonResponse[2]?.ToString();
string retFreeSrn = myJsonResponse[3]?.ToString();
var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<Object[]>(msgStr);
String retOrder = myJsonResponse[1]?.ToString();
String retSerial = myJsonResponse[2]?.ToString();
String retFreeSrn = myJsonResponse[3]?.ToString();
sbMSG.AppendLine($"Abfrage");
sbMSG.AppendLine($"PCB Id: \t \t \t \t {PcbId}");
sbMSG.AppendLine($"Aufrag: \t \t \t \t {retOrder}");
sbMSG.AppendLine($"Seriennummer: \t \t \t \t {retSerial}");
sbMSG.AppendLine($"Noch Verfügbare Seriennummern des Auftrages: \t {retFreeSrn}");
sbMSG.AppendLine($"Zusätzliche Infos:");
sbMsg.AppendLine($"Abfrage");
sbMsg.AppendLine($"PCB Id: \t \t \t \t {PcbId}");
sbMsg.AppendLine($"Aufrag: \t \t \t \t {retOrder}");
sbMsg.AppendLine($"Seriennummer: \t \t \t \t {retSerial}");
sbMsg.AppendLine($"Noch Verfügbare Seriennummern des Auftrages: \t {retFreeSrn}");
sbMsg.AppendLine($"Zusätzliche Infos:");
if (msgRetCode != 200 || !MarriagePossibleEnum.TryParse(myJsonResponse[0].ToString(), out msgRetInt))
if (msgRetCode != 200 || !Enum.TryParse(myJsonResponse[0].ToString(), out msgRetInt))
{
sbMSG.AppendLine($"Technisches Problem beim abfragen der Verfügbarkeit. Code ({msgRetCode})");
sbMsg.AppendLine($"Technisches Problem beim abfragen der Verfügbarkeit. Code ({msgRetCode})");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueToAlreadyMarried))
{
sbMSG.AppendLine($"Pcb ist schon mit der Seriennummer {retSerial} verbunden");
sbMsg.AppendLine($"Pcb ist schon mit der Seriennummer {retSerial} verbunden");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDuePcbLocked))
{
sbMSG.AppendLine("Pcb ist schon mit einer anderen Seriennummer verbunden.");
sbMsg.AppendLine("Pcb ist schon mit einer anderen Seriennummer verbunden.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueSerialNumberBlocked))
{
sbMSG.AppendLine("Seriennummer ist schon mit einer anderen Pcb verbunden.");
sbMsg.AppendLine("Seriennummer ist schon mit einer anderen Pcb verbunden.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.PcbNotMatchingOrder))
{
sbMSG.AppendLine("Die Pcb ist noch keinem Auftrag zugeordnet.");
sbMsg.AppendLine("Die Pcb ist noch keinem Auftrag zugeordnet.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.Error))
{
sbMSG.AppendLine("Ein unbestimmter Fehler ist aufgetreten.");
sbMsg.AppendLine("Ein unbestimmter Fehler ist aufgetreten.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoPressureTestFound))
{
sbMSG.AppendLine("Druck Test fehlt");
sbMsg.AppendLine("Druck Test fehlt");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoHeTestFound))
{
sbMSG.AppendLine("Heliumtest fehlt");
sbMsg.AppendLine("Heliumtest fehlt");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.Possible))
{
sbMSG.AppendLine("Verheiraten möglich");
sbMsg.AppendLine("Verheiraten möglich");
}
OnMsgRaise?.Invoke(this, sbMSG.ToString());
sm = PickingStateMachine.WaitForScanning;
OnMsgRaise?.Invoke(this, sbMsg.ToString());
_state = PickingStateMachine.WaitForScanning;
Log($"No Meter found");
break;
case PickingStateMachine.GetMapping:
State = $"Lade Auftragsdaten {serialNr}";
var retCode = 0;
var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.MarriageServiceUrl()}GetPreMarriageState?SerialNumber={serialNr}&PcbId={PcbId}", out retCode, 15000);
State = $"Lade Auftragsdaten {_serialNr}";
var str = LocalWebRequest.GetRequestWithError(
$"{ServiceUrls.MarriageServiceUrl()}GetPreMarriageState?SerialNumber=" +
$"{_serialNr}&PcbId={PcbId}", out var retCode, 15000);
var retInt = MarriagePossibleEnum.None;
if (retCode != 200 || !MarriagePossibleEnum.TryParse(str, out retInt))
if (retCode != 200 || !Enum.TryParse(str, out retInt))
{
OnMsgRaise?.Invoke(this, $"Technisches Problem beim abfragen der Verfügbarkeit. Code ({retCode})");
sm = PickingStateMachine.MappingError;
_state = PickingStateMachine.MappingError;
}
List<string> MappingText = new List<string>();
List<String> mappingText = new List<String>();
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueToAlreadyMarried))
{
MappingText.Add("Pcb ist schon mit dieser Seriennummer verbunden.Display aktualisiert");
using (var Batch = new MeterBatch())
mappingText.Add("Pcb ist schon mit dieser Seriennummer verbunden.Display aktualisiert");
using (var batch = new MeterBatch())
{
using (var tryMeter = new GenesisMeter())
{
try
{
State = $"Warte auf Pcb";
Slot = $"Öffne EP {SlotNr}";
tryMeter.SetupFromConfigFile(SlotNr);
Batch.AddMeter(tryMeter);
Slot = $"Öffne EP {_slotNr}";
tryMeter.SetupFromConfigFile(_slotNr);
batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
PcbId = tryMeter.GetPcbId();
@@ -595,11 +568,11 @@ namespace CordonelAssemblyLine.Model
tryMeter.SetProcessState(DisplayCodes.Mounted);
tryMeter.PushProgress("AssemblyLine", Assembly.GetExecutingAssembly().GetName().Version.ToString());
sm = PickingStateMachine.Done;
_state = PickingStateMachine.Done;
}
else
{
Slot = $"Keine Konnektivität EP {SlotNr}";
Slot = $"Keine Konnektivität EP {_slotNr}";
Log($"No Meter found");
}
// OnMsgRaise?.Invoke(this, $"Zähler verheiratet. Kann zur Prüfstation");
@@ -613,45 +586,45 @@ namespace CordonelAssemblyLine.Model
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDuePcbLocked))
{
MappingText.Add("Pcb ist schon mit einer anderen Seriennummer verbunden.");
mappingText.Add("Pcb ist schon mit einer anderen Seriennummer verbunden.");
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueSerialNumberBlocked))
{
MappingText.Add("Seriennummer ist schon mit einer anderen Pcb verbunden.");
mappingText.Add("Seriennummer ist schon mit einer anderen Pcb verbunden.");
}
if (retInt.HasFlag(MarriagePossibleEnum.PcbNotMatchingOrder))
{
MappingText.Add("Die Pcb ist noch keinem Auftrag zugeordnet.");
mappingText.Add("Die Pcb ist noch keinem Auftrag zugeordnet.");
}
if (retInt.HasFlag(MarriagePossibleEnum.Error))
{
MappingText.Add("Ein unbestimmter Fehler ist aufgetreten.");
mappingText.Add("Ein unbestimmter Fehler ist aufgetreten.");
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoPressureTestFound))
{
MappingText.Add("Druck Test fehlt");
mappingText.Add("Druck Test fehlt");
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoHeTestFound))
{
MappingText.Add("Heliumtest fehlt");
mappingText.Add("Heliumtest fehlt");
}
if (MappingText.Any())
if (mappingText.Any())
{
var MsgText = "";
foreach (var item in MappingText)
var msgText = "";
foreach (var item in mappingText)
{
MsgText = MsgText + Environment.NewLine + item;
msgText = msgText + Environment.NewLine + item;
}
OnMsgRaise?.Invoke(this, $"Diese Kombination ist nicht möglich.{MsgText}");
sm = PickingStateMachine.MappingError;
OnMsgRaise?.Invoke(this, $"Diese Kombination ist nicht möglich.{msgText}");
_state = PickingStateMachine.MappingError;
Log($"No Meter found");
}
else
{
sm = PickingStateMachine.WaitForBuildingMeterReady;
_state = PickingStateMachine.WaitForBuildingMeterReady;
}
break;
@@ -662,19 +635,18 @@ namespace CordonelAssemblyLine.Model
State = $"Mapping nicht möglich, bitte erneut scannen";
Log($"Mapping nicht möglich, bitte erneut scannen");
Thread.Sleep(10000);
sm = PickingStateMachine.Init;
_state = PickingStateMachine.Init;
break;
case PickingStateMachine.Store:
CanMarry = false;
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={PcbId}&Scan={serialNr}&returnMetroData=0";
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={PcbId}" +
$"&Scan={_serialNr}&returnMetroData=0";
try
{
string resp = "";
String resp;
try
{
resp = LocalWebRequest.GetRequest(url, 18000);
}
catch (Exception ex)
{
@@ -682,26 +654,21 @@ namespace CordonelAssemblyLine.Model
{
throw;
}
else
{
resp = "already store";
}
}
if (resp.Trim().ToLower().Contains("store"))
{
using (var Batch = new MeterBatch())
using (var batch = new MeterBatch())
{
using (var tryMeter = new GenesisMeter())
{
try
{
State = $"Warte auf Pcb";
Slot = $"Öffne EP {SlotNr}";
tryMeter.SetupFromConfigFile(SlotNr);
Batch.AddMeter(tryMeter);
Slot = $"Öffne EP {_slotNr}";
tryMeter.SetupFromConfigFile(_slotNr);
batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
PcbId = tryMeter.GetPcbId();
@@ -716,11 +683,11 @@ namespace CordonelAssemblyLine.Model
tryMeter.SetProcessState(DisplayCodes.Mounted);
tryMeter.PushProgress("AssemblyLine", Assembly.GetExecutingAssembly().GetName().Version.ToString());
sm = PickingStateMachine.Done;
_state = PickingStateMachine.Done;
}
else
{
Slot = $"Keine Konnektivität EP {SlotNr}";
Slot = $"Keine Konnektivität EP {_slotNr}";
Log($"No Meter found");
}
OnMsgRaise?.Invoke(this, $"Zähler verheiratet. Kann zur Prüfstation");
@@ -736,7 +703,7 @@ namespace CordonelAssemblyLine.Model
{
OnMsgRaise?.Invoke(this, $"Fehler beim Speichern, bitte Support Kontaktieren.Response{resp}");
}
sm = PickingStateMachine.Init;
_state = PickingStateMachine.Init;
}
catch (Exception ex)
@@ -754,9 +721,7 @@ namespace CordonelAssemblyLine.Model
break;
case PickingStateMachine.Done:
OnMsgRaise?.Invoke(this, $"Bitte Display überprüfen. {Environment.NewLine}Sollte etwas anderes als {DisplayCodes.Mounted} im Display erscheinen ist der Zähler nicht erfolgreich bearbeitet.");
sm = PickingStateMachine.Init;
break;
default:
_state = PickingStateMachine.Init;
break;
}
Thread.Sleep(1000);
@@ -765,7 +730,7 @@ namespace CordonelAssemblyLine.Model
}
public void Log(string txt)
public void Log(String txt)
{
_logger?.Info(txt);
}
File diff suppressed because it is too large Load Diff
+19 -31
View File
@@ -1,58 +1,46 @@
using CordonelAssemblyLine.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace CordonelAssemblyLine
{
/// <summary>
/// Interaction logic for Picking.xaml
/// </summary>
public partial class Picking : Window
public partial class Picking
{
readonly PickingViewModel _model = new PickingViewModel();
readonly CancellationToken _globalCancellationToken;
PickingViewModel Model = new PickingViewModel();
CancellationToken GlobalCancellationToken;
string ScannerPort;
int SlotNr;
public Picking(CancellationToken globalCancellationToken, string scannerPort, int slotNr)
readonly String _scannerPort;
readonly Int32 _slotNr;
public Picking(CancellationToken globalCancellationToken, String scannerPort, Int32 slotNr)
{
ScannerPort = scannerPort;
SlotNr = slotNr;
GlobalCancellationToken = globalCancellationToken;
DataContext = Model;
_scannerPort = scannerPort;
_slotNr = slotNr;
_globalCancellationToken = globalCancellationToken;
DataContext = _model;
InitializeComponent();
this.Left = SystemParameters.VirtualScreenLeft;
this.Top = SystemParameters.VirtualScreenTop +250;
this.Height = SystemParameters.VirtualScreenHeight * 0.90;
this.Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
Left = SystemParameters.VirtualScreenLeft;
Top = SystemParameters.VirtualScreenTop +250;
Height = SystemParameters.VirtualScreenHeight * 0.90;
Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
private void Window_Loaded(Object sender, RoutedEventArgs e)
{
Model.StartPicking(GlobalCancellationToken, ScannerPort, SlotNr);
_model.StartPicking(_globalCancellationToken, _scannerPort, _slotNr);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, System.ComponentModel.CancelEventArgs e)
{
Model.Dispose();
this.Title = "";
_model.Dispose();
Title = "";
}
}
}
@@ -1996,6 +1996,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
/// <summary>
/// Set the process state to display and to the production data base
/// </summary>
/// <param name="newState"></param>
public void SetProcessState(DisplayCodes newState)
{
SetProcessState(newState, true);
}
/// <inheritdoc />
public void SetProcessState(DisplayCodes newState, Boolean webRequest)
{
@@ -2298,14 +2307,5 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
#endregion
/// <summary>
/// Set the process state
/// </summary>
/// <param name="newState"></param>
public void SetProcessState(DisplayCodes newState)
{
SetProcessState(newState, true);
}
}
}
@@ -1,5 +1,6 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
// ReSharper disable once InconsistentNaming
internal class st_radio_dewa
{
//todo find out struct definition and implement it
@@ -1,5 +1,6 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
// ReSharper disable once InconsistentNaming
internal class st_radio_tfx
{
//todo find out struct definition and implement it
@@ -88,6 +88,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
public static class Powermon
{
public static readonly String BatteryVoltage = "POWERMON_BatteryVoltage";
public static readonly String BatteryQuantity = "POWERMON_BatteryQuantity";
}
@@ -1 +1 @@
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3
46bd00889699f5a20a4981a22f62b66368323855
@@ -0,0 +1,21 @@
using System;
namespace Logic.ProductionToProductMapper.Cordonel
{
public class RegisterHisory
{
public RegisterHisory(String pcbId, Byte[] address, Byte[] value, DateTimeOffset date)
{
PcbId = pcbId;
Address = address;
Value = value;
Date = date;
}
public String PcbId { get; set; }
public Byte[] Address { get; set; }
public Byte[] Value { get; set; }
public DateTimeOffset Date { get; set; }
}
}
@@ -0,0 +1,22 @@
using Logic.ProductionToProductMapper.Cordonel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Logic.ProductionToProductMapper.Files.Lut
{
public class CordonelMetrologyLut
{
public int FileId { get; set; }
public string FileName { get; set; }
public MeterSize MeterSize { get; set; }
public string Region { get; set; }
public int CRC { get; set; }
public bool ForProduction { get; set; }
public List<byte> Content { get; set; }
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
namespace Xylem.Common.Logic.ProductionOrderCore.FW
{
public class CordonelFw
{
public int Id { get; set; }
public int Frequency { get; set; }
public int AppID { get; set; }
public int Version { get; set; }
public string Name { get; set; }
public string FileName { get; set; }
public DateTime? DeletedDate { get; set; }
public bool ForPressure { get; set; }
public int Metersize { get; set; }
public int? LutFileID { get; set; }
public Region Region { get; set; }
public bool CurrentForProd { get; set; }
public int? FileClusterStoreId { get; set; }
public bool IsDeleted() { return DeletedDate.HasValue; }
}
}
@@ -23,7 +23,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
public Int32 AssignedPicking { get; set; }
/// <summary>
///Number of pressure tested devices
/// Number of pressure tested devices
/// </summary>
public Int32 PressureTested { get; set; }
@@ -1,6 +1,5 @@
using ByteArrayStyle;
using Newtonsoft.Json;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -9,6 +8,7 @@ using System.Text;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore.Csd;
using Xylem.Common.Logic.ProductionOrderCore.Vako;
using Xylem.Common.Logic.ServiceCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
@@ -1,11 +1,11 @@
using Service.Core;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
using Xylem.Common.Logic.ProductionOrderCore.KitronTestResults;
using Xylem.Common.Logic.ServiceCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
{
public enum Region
{
EMEA,
NA,
China
}
}
@@ -88,6 +88,7 @@
</Compile>
<Compile Include="Csd\CsdParameterResult.cs" />
<Compile Include="File\BaseFile.cs" />
<Compile Include="FW\CordonelFw.cs" />
<Compile Include="FW\CordonelFWTypeEnum.cs" />
<Compile Include="IProductionData.cs" />
<Compile Include="KitronTestResults\JsonObject.cs" />
@@ -95,6 +96,7 @@
<Compile Include="OrderData\OrderOverViewCordonel.cs" />
<Compile Include="OrderData\OrderRadioParameter.cs" />
<Compile Include="OrderData\OrderProgrammingParameters.cs" />
<Compile Include="OrderData\Region.cs" />
<Compile Include="OrderData\ScanToSerialNr.cs" />
<Compile Include="OrderState.cs" />
<Compile Include="ProcessState\PressureTestResult.cs" />
@@ -1,8 +1,8 @@
using System;
using Service.Core;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Logic.ProductionOrderCore.Vako
{
+1 -1
View File
@@ -84,7 +84,7 @@ namespace Xylem.Common.Logic.RelatePcb
}
using (var sr = new StreamReader(responseStream))
{
var responseJson = sr.ReadToEnd();
sr.ReadToEnd();
return false;
}
}
@@ -82,7 +82,6 @@
<Compile Include="..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="DatabaseApiController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqlDataAccess.cs" />
</ItemGroup>
+26 -28
View File
@@ -5,22 +5,22 @@ using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;
namespace Service.Core
namespace Xylem.Common.Logic.ServiceCore
{
public class SqlDataAccess : IDisposable
{
private string _connectionString = "";
public SqlDataAccess(string ConnectionString)
private readonly String _connectionString;
public SqlDataAccess(String connectionString)
{
_connectionString = ConnectionString;
_connectionString = connectionString;
}
public string GenerateParam<T>(string name, string typeName,T value)
public String GenerateParam<T>(String name, String typeName,T value)
{
var sb = new StringBuilder();
sb.AppendLine($"Declare @{name} as {typeName}" );
if (value is string)
if (value is String)
{
sb.AppendLine($"set @{name} = '%{value.ToString()}%' ");
return sb.ToString();
@@ -32,12 +32,12 @@ namespace Service.Core
return sb.ToString();
}
if (value is int)
if (value is Int32)
{
var tmp = Convert.ToInt32(value);
sb.Append(tmp.ToString());
}
if (value is bool)
if (value is Boolean)
{
var tmp = Convert.ToBoolean(value);
@@ -54,6 +54,7 @@ namespace Service.Core
/// Creating a database connection if there is none.
/// </summary>
/// <remarks>Working with a global connection variable to make sure the connection would be closed at the end of working with it.</remarks>
// ReSharper disable once UnusedMember.Local
private void CreateConnection()
{
if (_con == null)
@@ -67,7 +68,7 @@ namespace Service.Core
}
}
public DataTable ExecuteQuery(string sqlStatement, List<SqlParameter> parameter = null)
public DataTable ExecuteQuery(String sqlStatement, List<SqlParameter> parameter = null)
{
DataTable ret;
SqlConnection connection = null;
@@ -92,7 +93,7 @@ namespace Service.Core
}
}
reader = cmd.ExecuteReader();
var entries = new object[reader.FieldCount];
var entries = new Object[reader.FieldCount];
ret = new DataTable();
var jcount = 0;
@@ -107,11 +108,11 @@ namespace Service.Core
var headline = reader.GetName(i);
if (!ret.Columns.Contains(headline))
{
ret.Columns.Add(headline, Type.GetType("System.Object"));
ret.Columns.Add(headline, Type.GetType("System.Object") ?? typeof(String));
}
else
{
ret.Columns.Add(headline + Guid.NewGuid().ToString(), Type.GetType("System.Object"));
ret.Columns.Add(headline + Guid.NewGuid(), Type.GetType("System.Object") ?? typeof(String));
}
@@ -144,7 +145,10 @@ namespace Service.Core
{
reader.Dispose();
}
catch { }
catch
{
// ignored
}
}
if (connection != null && connection.State == ConnectionState.Open)
{
@@ -155,13 +159,6 @@ namespace Service.Core
}
return ret;
}
/// <summary>
/// Executing Stored Procedure
/// </summary>
/// <param name="storedProcedure"> The Name of Stored Procedure</param>
/// <param name="values">Parameter names and values</param>
/// <returns>Result Set</returns>
/// <summary>
/// Closing and disposing the connection.
@@ -183,7 +180,8 @@ namespace Service.Core
/// </summary>
/// <param name="parameter">array to work on</param>
/// <returns>comma seperated string with parameters.</returns>
private string GenerateParameter(string[] parameter)
// ReSharper disable once UnusedMember.Local
private String GenerateParameter(String[] parameter)
{
var list = new StringBuilder();
var ret = "";
@@ -198,8 +196,8 @@ namespace Service.Core
var result = param;
var content = param;
const string mitpat = @"(?:^@\w[\w_\s]*=[\s]*(?:'(.*)'$|(.*)$)|^(?:'(.*)'$|(.*)$))";
const string numbpat = @"^[+-]?(?:\d+\.?|,?\d*|\d*(\.?|,?)\d+)[\r\n]*$";
const String mitpat = @"(?:^@\w[\w_\s]*=[\s]*(?:'(.*)'$|(.*)$)|^(?:'(.*)'$|(.*)$))";
const String numbpat = @"^[+-]?(?:\d+\.?|,?\d*|\d*(\.?|,?)\d+)[\r\n]*$";
if (!first || !result.Contains(","))
{
@@ -212,7 +210,7 @@ namespace Service.Core
var mch = Regex.Replace(orig, "[']+", "'");
mch = Regex.Replace(mch, "[']+", "''");
result = !String.IsNullOrEmpty(mch) ? content.Replace(orig, mch) : content;
result = !string.IsNullOrEmpty(mch) ? content.Replace(orig, mch) : content;
}
else if (mtch.Groups[2].Success)
{
@@ -220,7 +218,7 @@ namespace Service.Core
var mch = Regex.Replace(orig, "[']+", "'");
mch = Regex.Replace(mch, "[']+", "''");
if (!String.IsNullOrEmpty(mch))
if (!string.IsNullOrEmpty(mch))
{
if (Regex.IsMatch(mch, numbpat) || mch.ToLower() == "null")
{
@@ -242,7 +240,7 @@ namespace Service.Core
var mch = Regex.Replace(orig, "[']+", "'");
mch = Regex.Replace(mch, "[']+", "''");
result = !String.IsNullOrEmpty(mch) ? content.Replace(orig, mch) : content;
result = !string.IsNullOrEmpty(mch) ? content.Replace(orig, mch) : content;
}
else if (mtch.Groups[4].Success)
{
@@ -250,7 +248,7 @@ namespace Service.Core
var mch = Regex.Replace(orig, "[']+", "'");
mch = Regex.Replace(mch, "[']+", "''");
if (!String.IsNullOrEmpty(mch))
if (!string.IsNullOrEmpty(mch))
{
if (Regex.IsMatch(mch, numbpat) || mch.ToLower() == "null")
{
@@ -280,7 +278,7 @@ namespace Service.Core
public string GetConnectionString()
public String GetConnectionString()
{
//if (_conifg.SupportConnectionString)
//{
@@ -55,7 +55,7 @@ Scenario: 1.0_[SRS_TBF_COMMON_METRO_001]_DutVolumeCalculation_VALID_volume
# DutVolumeCm [m³] = (DutStopVolumeCm [m³] + DutOverflowVolumeCm [m³]) - DutStartVolumeCm [m³]
| Test | DutVolumeCm | State | Comment |
| 0 | 6.0 | Okay | Positive direction |
| 1 | 6.0 | Okay | Positive direction |
| 1 | 6.0 | Okay | Offset volume |
| 2 | -6.0 | Okay | Negative direction |
| 3 | -6.0 | Okay | Offset volume |
| 4 | 6.0 | Okay | Zero crossing |
@@ -170,7 +170,7 @@ this.ScenarioInitialize(scenarioInfo);
"1",
"6.0",
"Okay",
"Positive direction"});
"Offset volume"});
table2.AddRow(new string[] {
"2",
"-6.0",
@@ -1343,3 +1343,4 @@ this.ScenarioInitialize(scenarioInfo);
}
#pragma warning restore
#endregion
@@ -36,6 +36,7 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>7.3</LangVersion>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -186,6 +187,9 @@
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="MeasurementResults.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -57,20 +57,20 @@ namespace Xylem.Common.Metrology.Measurements
/// The Result is NOT being stored to the meter.
/// CAN BE USED FOR STATIC START/STOP AND FLYING START/STOP PROCEDURE
/// </summary>
/// <param name="RefVolumeCm">reference volume in m³</param>
/// <param name="refVolumeCm">reference volume in m³</param>
/// <param name="refTimeS">reference time in seconds</param>
/// <param name="reqDeviationPercent">the deviation to set the calibration in %</param>
/// <returns> calibration factor as relative value or null if calibration factor cannot be calculated</returns>
/// <history date="06-Dec-2018" author="Thomas Wiedebusch">
/// - The scale factor for calibration is going to adjusted here to keep the measurement result accurate.
/// </history>
public Double? CalculateCalibFactorRel(Double RefVolumeCm, Double? refTimeS = null, Double reqDeviationPercent = 0.0)
public Double? CalculateCalibFactorRel(Double refVolumeCm, Double? refTimeS = null, Double reqDeviationPercent = 0.0)
{
//the deviation can be positive or negative
var reqDeviationRel = 1.0 + reqDeviationPercent / 100;
//for calibration the RefVolumeCm is essential, the refTimeS is needed for flying start/stop
var measurementResult = GetFinalMeasurementResult(RefVolumeCm, refTimeS);
var measurementResult = GetFinalMeasurementResult(refVolumeCm, refTimeS);
//adjust the calibration scale factor to the required deviation
return measurementResult.ScaleFactorRefToDut * reqDeviationRel;
@@ -1,6 +1,4 @@
using System;
namespace Xylem.Common.Metrology.Measurements.Consts
namespace Xylem.Common.Metrology.Measurements.Consts
{
/// <summary>
/// information about measurement results to identify on input depending results
@@ -67,25 +67,25 @@ namespace Xylem.Common.Metrology.Measurements
/// The timing will be set by the IntermediateUpdateTimeS.
/// </summary>
/// <param name="refTimeS"></param>
/// <param name="RefVolumeCm"></param>
/// <param name="refVolumeCm"></param>
/// <returns></returns>
MeasurementResults GetShortTermMeasurementResult(Double? RefVolumeCm = null, Double? refTimeS = null);
MeasurementResults GetShortTermMeasurementResult(Double? refVolumeCm = null, Double? refTimeS = null);
/// <summary>
/// Returning the intermediate results of the ongoing measurement from the start of measurement until now!
/// </summary>
/// <param name="refTimeS"></param>
/// <param name="RefVolumeCm"></param>
/// <param name="refVolumeCm"></param>
/// <returns></returns>
MeasurementResults GetIntermediateMeasurementResult(Double? RefVolumeCm = null, Double? refTimeS = null);
MeasurementResults GetIntermediateMeasurementResult(Double? refVolumeCm = null, Double? refTimeS = null);
/// <summary>
/// Returning the results of the measurements from start until stop.
/// </summary>
/// <param name="refTimeS">Measurement duration is needed explicit for flying start/stop procedure</param>
/// <param name="RefVolumeCm">reference volume is ALWAYS needed for scale and deviation</param>
/// <param name="refVolumeCm">reference volume is ALWAYS needed for scale and deviation</param>
/// <returns></returns>
MeasurementResults GetFinalMeasurementResult(Double? RefVolumeCm, Double? refTimeS = null);
MeasurementResults GetFinalMeasurementResult(Double? refVolumeCm, Double? refTimeS = null);
/// <summary>
@@ -13,7 +13,7 @@ namespace Service.MeterProcessState
{
public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; }
public static string PublicClientId { get; private set; }
public static String PublicClientId { get; private set; }
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
@@ -12,23 +12,23 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
/// <param name="description">The <see cref="ApiDescription"/>.</param>
/// <returns>The ID as a string.</returns>
public static string GetFriendlyId(this ApiDescription description)
public static String GetFriendlyId(this ApiDescription description)
{
string path = description.RelativePath;
string[] urlParts = path.Split('?');
string localPath = urlParts[0];
string queryKeyString = null;
String path = description.RelativePath;
String[] urlParts = path.Split('?');
String localPath = urlParts[0];
String queryKeyString = null;
if (urlParts.Length > 1)
{
string query = urlParts[1];
string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys;
queryKeyString = String.Join("_", queryKeys);
String query = urlParts[1];
String[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys;
queryKeyString = string.Join("_", queryKeys);
}
StringBuilder friendlyPath = new StringBuilder();
friendlyPath.AppendFormat("{0}-{1}",
description.HttpMethod.Method,
localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
localPath.Replace("/", "-").Replace("{", string.Empty).Replace("}", string.Empty));
if (queryKeyString != null)
{
friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-'));
@@ -11,7 +11,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.Controllers
/// </summary>
public class HelpController : Controller
{
private const string ErrorViewName = "Error";
private const String ErrorViewName = "Error";
public HelpController()
: this(GlobalConfiguration.Configuration)
@@ -31,9 +31,9 @@ namespace Service.MeterProcessState.Areas.HelpPage.Controllers
return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
}
public ActionResult Api(string apiId)
public ActionResult Api(String apiId)
{
if (!String.IsNullOrEmpty(apiId))
if (!string.IsNullOrEmpty(apiId))
{
HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId);
if (apiModel != null)
@@ -45,9 +45,9 @@ namespace Service.MeterProcessState.Areas.HelpPage.Controllers
return View(ErrorViewName);
}
public ActionResult ResourceModel(string modelName)
public ActionResult ResourceModel(String modelName)
{
if (!String.IsNullOrEmpty(modelName))
if (!string.IsNullOrEmpty(modelName))
{
ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator();
ModelDescription modelDescription;
@@ -1,3 +1,4 @@
using System;
using System.Web.Http;
using System.Web.Mvc;
@@ -5,7 +6,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
{
public class HelpPageAreaRegistration : AreaRegistration
{
public override string AreaName
public override String AreaName
{
get
{
@@ -18,7 +18,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
{
public static class HelpPageConfigurationExtensions
{
private const string ApiModelPrefix = "MS_HelpPageApiModel_";
private const String ApiModelPrefix = "MS_HelpPageApiModel_";
/// <summary>
/// Sets the documentation provider for help page.
@@ -35,7 +35,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sampleObjects">The sample objects.</param>
public static void SetSampleObjects(this HttpConfiguration config, IDictionary<Type, object> sampleObjects)
public static void SetSampleObjects(this HttpConfiguration config, IDictionary<Type, Object> sampleObjects)
{
config.GetHelpPageSampleGenerator().SampleObjects = sampleObjects;
}
@@ -48,7 +48,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
public static void SetSampleRequest(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType, String controllerName, String actionName)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, new[] { "*" }), sample);
}
@@ -62,7 +62,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
public static void SetSampleRequest(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType, String controllerName, String actionName, params String[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, parameterNames), sample);
}
@@ -75,7 +75,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
public static void SetSampleResponse(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType, String controllerName, String actionName)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, new[] { "*" }), sample);
}
@@ -89,7 +89,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
public static void SetSampleResponse(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType, String controllerName, String actionName, params String[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, parameterNames), sample);
}
@@ -100,7 +100,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample.</param>
/// <param name="mediaType">The media type.</param>
public static void SetSampleForMediaType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType)
public static void SetSampleForMediaType(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType), sample);
}
@@ -112,7 +112,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="sample">The sample.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="type">The parameter type or return type of an action.</param>
public static void SetSampleForType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, Type type)
public static void SetSampleForType(this HttpConfiguration config, Object sample, MediaTypeHeaderValue mediaType, Type type)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, type), sample);
}
@@ -125,7 +125,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName)
public static void SetActualRequestType(this HttpConfiguration config, Type type, String controllerName, String actionName)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, new[] { "*" }), type);
}
@@ -139,7 +139,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
public static void SetActualRequestType(this HttpConfiguration config, Type type, String controllerName, String actionName, params String[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, parameterNames), type);
}
@@ -152,7 +152,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName)
public static void SetActualResponseType(this HttpConfiguration config, Type type, String controllerName, String actionName)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, new[] { "*" }), type);
}
@@ -166,7 +166,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
public static void SetActualResponseType(this HttpConfiguration config, Type type, String controllerName, String actionName, params String[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, parameterNames), type);
}
@@ -216,14 +216,14 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <returns>
/// An <see cref="HelpPageApiModel"/>
/// </returns>
public static HelpPageApiModel GetHelpPageApiModel(this HttpConfiguration config, string apiDescriptionId)
public static HelpPageApiModel GetHelpPageApiModel(this HttpConfiguration config, String apiDescriptionId)
{
object model;
string modelId = ApiModelPrefix + apiDescriptionId;
Object model;
String modelId = ApiModelPrefix + apiDescriptionId;
if (!config.Properties.TryGetValue(modelId, out model))
{
Collection<ApiDescription> apiDescriptions = config.Services.GetApiExplorer().ApiDescriptions;
ApiDescription apiDescription = apiDescriptions.FirstOrDefault(api => String.Equals(api.GetFriendlyId(), apiDescriptionId, StringComparison.OrdinalIgnoreCase));
ApiDescription apiDescription = apiDescriptions.FirstOrDefault(api => string.Equals(api.GetFriendlyId(), apiDescriptionId, StringComparison.OrdinalIgnoreCase));
if (apiDescription != null)
{
model = GenerateApiModel(apiDescription, config);
@@ -307,7 +307,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
uriParameter.Annotations.Add(new ParameterAnnotation() { Documentation = "Required" });
}
object defaultValue = parameterDescriptor.DefaultValue;
Object defaultValue = parameterDescriptor.DefaultValue;
if (defaultValue != null)
{
uriParameter.Annotations.Add(new ParameterAnnotation() { Documentation = "Default value is " + Convert.ToString(defaultValue, CultureInfo.InvariantCulture) });
@@ -320,21 +320,21 @@ namespace Service.MeterProcessState.Areas.HelpPage
// If parameterDescriptor is null, this is an undeclared route parameter which only occurs
// when source is FromUri. Ignored in request model and among resource parameters but listed
// as a simple string here.
ModelDescription modelDescription = modelGenerator.GetOrCreateModelDescription(typeof(string));
ModelDescription modelDescription = modelGenerator.GetOrCreateModelDescription(typeof(String));
AddParameterDescription(apiModel, apiParameter, modelDescription);
}
}
}
}
private static bool IsBindableWithTypeConverter(Type parameterType)
private static Boolean IsBindableWithTypeConverter(Type parameterType)
{
if (parameterType == null)
{
return false;
}
return TypeDescriptor.GetConverter(parameterType).CanConvertFrom(typeof(string));
return TypeDescriptor.GetConverter(parameterType).CanConvertFrom(typeof(String));
}
private static ParameterDescription AddParameterDescription(HelpPageApiModel apiModel,
@@ -404,13 +404,13 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
catch (Exception e)
{
apiModel.ErrorMessages.Add(String.Format(CultureInfo.CurrentCulture,
apiModel.ErrorMessages.Add(string.Format(CultureInfo.CurrentCulture,
"An exception has occurred while generating the sample. Exception message: {0}",
HelpPageSampleGenerator.UnwrapException(e).Message));
}
}
private static bool TryGetResourceParameter(ApiDescription apiDescription, HttpConfiguration config, out ApiParameterDescription parameterDescription, out Type resourceType)
private static Boolean TryGetResourceParameter(ApiDescription apiDescription, HttpConfiguration config, out ApiParameterDescription parameterDescription, out Type resourceType)
{
parameterDescription = apiDescription.ParameterDescriptions.FirstOrDefault(
p => p.Source == ApiParameterSource.FromBody ||
@@ -455,7 +455,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
return modelGenerator;
}
private static void LogInvalidSampleAsError(HelpPageApiModel apiModel, object sample)
private static void LogInvalidSampleAsError(HelpPageApiModel apiModel, Object sample)
{
InvalidSample invalidSample = sample as InvalidSample;
if (invalidSample != null)
@@ -1,11 +1,13 @@
using System;
namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
{
public class EnumValueDescription
{
public string Documentation { get; set; }
public String Documentation { get; set; }
public string Name { get; set; }
public String Name { get; set; }
public string Value { get; set; }
public String Value { get; set; }
}
}
@@ -5,8 +5,8 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
{
public interface IModelDocumentationProvider
{
string GetDocumentation(MemberInfo member);
String GetDocumentation(MemberInfo member);
string GetDocumentation(Type type);
String GetDocumentation(Type type);
}
}
@@ -7,10 +7,10 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
/// </summary>
public abstract class ModelDescription
{
public string Documentation { get; set; }
public String Documentation { get; set; }
public Type ModelType { get; set; }
public string Name { get; set; }
public String Name { get; set; }
}
}
@@ -19,49 +19,49 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
public class ModelDescriptionGenerator
{
// Modify this to support more data annotation attributes.
private readonly IDictionary<Type, Func<object, string>> AnnotationTextGenerator = new Dictionary<Type, Func<object, string>>
private readonly IDictionary<Type, Func<Object, String>> AnnotationTextGenerator = new Dictionary<Type, Func<Object, String>>
{
{ typeof(RequiredAttribute), a => "Required" },
{ typeof(RangeAttribute), a =>
{
RangeAttribute range = (RangeAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Range: inclusive between {0} and {1}", range.Minimum, range.Maximum);
return string.Format(CultureInfo.CurrentCulture, "Range: inclusive between {0} and {1}", range.Minimum, range.Maximum);
}
},
{ typeof(MaxLengthAttribute), a =>
{
MaxLengthAttribute maxLength = (MaxLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Max length: {0}", maxLength.Length);
return string.Format(CultureInfo.CurrentCulture, "Max length: {0}", maxLength.Length);
}
},
{ typeof(MinLengthAttribute), a =>
{
MinLengthAttribute minLength = (MinLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Min length: {0}", minLength.Length);
return string.Format(CultureInfo.CurrentCulture, "Min length: {0}", minLength.Length);
}
},
{ typeof(StringLengthAttribute), a =>
{
StringLengthAttribute strLength = (StringLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "String length: inclusive between {0} and {1}", strLength.MinimumLength, strLength.MaximumLength);
return string.Format(CultureInfo.CurrentCulture, "String length: inclusive between {0} and {1}", strLength.MinimumLength, strLength.MaximumLength);
}
},
{ typeof(DataTypeAttribute), a =>
{
DataTypeAttribute dataType = (DataTypeAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Data type: {0}", dataType.CustomDataType ?? dataType.DataType.ToString());
return string.Format(CultureInfo.CurrentCulture, "Data type: {0}", dataType.CustomDataType ?? dataType.DataType.ToString());
}
},
{ typeof(RegularExpressionAttribute), a =>
{
RegularExpressionAttribute regularExpression = (RegularExpressionAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Matching regular expression pattern: {0}", regularExpression.Pattern);
return string.Format(CultureInfo.CurrentCulture, "Matching regular expression pattern: {0}", regularExpression.Pattern);
}
},
};
// Modify this to add more default documentations.
private readonly IDictionary<Type, string> DefaultTypeDocumentation = new Dictionary<Type, string>
private readonly IDictionary<Type, String> DefaultTypeDocumentation = new Dictionary<Type, String>
{
{ typeof(Int16), "integer" },
{ typeof(Int32), "integer" },
@@ -94,10 +94,10 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
}
_documentationProvider = new Lazy<IModelDocumentationProvider>(() => config.Services.GetDocumentationProvider() as IModelDocumentationProvider);
GeneratedModels = new Dictionary<string, ModelDescription>(StringComparer.OrdinalIgnoreCase);
GeneratedModels = new Dictionary<String, ModelDescription>(StringComparer.OrdinalIgnoreCase);
}
public Dictionary<string, ModelDescription> GeneratedModels { get; private set; }
public Dictionary<String, ModelDescription> GeneratedModels { get; private set; }
private IModelDocumentationProvider DocumentationProvider
{
@@ -121,13 +121,13 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
}
ModelDescription modelDescription;
string modelName = ModelNameHelper.GetModelName(modelType);
String modelName = ModelNameHelper.GetModelName(modelType);
if (GeneratedModels.TryGetValue(modelName, out modelDescription))
{
if (modelType != modelDescription.ModelType)
{
throw new InvalidOperationException(
String.Format(
string.Format(
CultureInfo.CurrentCulture,
"A model description could not be created. Duplicate model name '{0}' was found for types '{1}' and '{2}'. " +
"Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.",
@@ -185,27 +185,27 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
if (modelType == typeof(NameValueCollection))
{
return GenerateDictionaryModelDescription(modelType, typeof(string), typeof(string));
return GenerateDictionaryModelDescription(modelType, typeof(String), typeof(String));
}
if (typeof(IDictionary).IsAssignableFrom(modelType))
{
return GenerateDictionaryModelDescription(modelType, typeof(object), typeof(object));
return GenerateDictionaryModelDescription(modelType, typeof(Object), typeof(Object));
}
if (typeof(IEnumerable).IsAssignableFrom(modelType))
{
return GenerateCollectionModelDescription(modelType, typeof(object));
return GenerateCollectionModelDescription(modelType, typeof(Object));
}
return GenerateComplexTypeModelDescription(modelType);
}
// Change this to provide different name for the member.
private static string GetMemberName(MemberInfo member, bool hasDataContractAttribute)
private static String GetMemberName(MemberInfo member, Boolean hasDataContractAttribute)
{
JsonPropertyAttribute jsonProperty = member.GetCustomAttribute<JsonPropertyAttribute>();
if (jsonProperty != null && !String.IsNullOrEmpty(jsonProperty.PropertyName))
if (jsonProperty != null && !string.IsNullOrEmpty(jsonProperty.PropertyName))
{
return jsonProperty.PropertyName;
}
@@ -213,7 +213,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
if (hasDataContractAttribute)
{
DataMemberAttribute dataMember = member.GetCustomAttribute<DataMemberAttribute>();
if (dataMember != null && !String.IsNullOrEmpty(dataMember.Name))
if (dataMember != null && !string.IsNullOrEmpty(dataMember.Name))
{
return dataMember.Name;
}
@@ -222,7 +222,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
return member.Name;
}
private static bool ShouldDisplayMember(MemberInfo member, bool hasDataContractAttribute)
private static Boolean ShouldDisplayMember(MemberInfo member, Boolean hasDataContractAttribute)
{
JsonIgnoreAttribute jsonIgnore = member.GetCustomAttribute<JsonIgnoreAttribute>();
XmlIgnoreAttribute xmlIgnore = member.GetCustomAttribute<XmlIgnoreAttribute>();
@@ -230,7 +230,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
NonSerializedAttribute nonSerialized = member.GetCustomAttribute<NonSerializedAttribute>();
ApiExplorerSettingsAttribute apiExplorerSetting = member.GetCustomAttribute<ApiExplorerSettingsAttribute>();
bool hasMemberAttribute = member.DeclaringType.IsEnum ?
Boolean hasMemberAttribute = member.DeclaringType.IsEnum ?
member.GetCustomAttribute<EnumMemberAttribute>() != null :
member.GetCustomAttribute<DataMemberAttribute>() != null;
@@ -249,9 +249,9 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
(!hasDataContractAttribute || hasMemberAttribute);
}
private string CreateDefaultDocumentation(Type type)
private String CreateDefaultDocumentation(Type type)
{
string documentation;
String documentation;
if (DefaultTypeDocumentation.TryGetValue(type, out documentation))
{
return documentation;
@@ -271,7 +271,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
IEnumerable<Attribute> attributes = property.GetCustomAttributes();
foreach (Attribute attribute in attributes)
{
Func<object, string> textGenerator;
Func<Object, String> textGenerator;
if (AnnotationTextGenerator.TryGetValue(attribute.GetType(), out textGenerator))
{
annotations.Add(
@@ -297,7 +297,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
}
// Sort the rest based on alphabetic order of the documentation
return String.Compare(x.Documentation, y.Documentation, StringComparison.OrdinalIgnoreCase);
return string.Compare(x.Documentation, y.Documentation, StringComparison.OrdinalIgnoreCase);
});
foreach (ParameterAnnotation annotation in annotations)
@@ -332,7 +332,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
};
GeneratedModels.Add(complexModelDescription.Name, complexModelDescription);
bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
Boolean hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
PropertyInfo[] properties = modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo property in properties)
{
@@ -399,7 +399,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
ModelType = modelType,
Documentation = CreateDefaultDocumentation(modelType)
};
bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
Boolean hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
foreach (FieldInfo field in modelType.GetFields(BindingFlags.Public | BindingFlags.Static))
{
if (ShouldDisplayMember(field, hasDataContractAttribute))
@@ -8,11 +8,11 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false, Inherited = false)]
public sealed class ModelNameAttribute : Attribute
{
public ModelNameAttribute(string name)
public ModelNameAttribute(String name)
{
Name = name;
}
public string Name { get; private set; }
public String Name { get; private set; }
}
}
@@ -8,26 +8,26 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
internal static class ModelNameHelper
{
// Modify this to provide custom model name mapping.
public static string GetModelName(Type type)
public static String GetModelName(Type type)
{
ModelNameAttribute modelNameAttribute = type.GetCustomAttribute<ModelNameAttribute>();
if (modelNameAttribute != null && !String.IsNullOrEmpty(modelNameAttribute.Name))
if (modelNameAttribute != null && !string.IsNullOrEmpty(modelNameAttribute.Name))
{
return modelNameAttribute.Name;
}
string modelName = type.Name;
String modelName = type.Name;
if (type.IsGenericType)
{
// Format the generic type name to something like: GenericOfAgurment1AndArgument2
Type genericType = type.GetGenericTypeDefinition();
Type[] genericArguments = type.GetGenericArguments();
string genericTypeName = genericType.Name;
String genericTypeName = genericType.Name;
// Trim the generic parameter counts from the name
genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`'));
string[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray();
modelName = String.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, String.Join("And", argumentTypeNames));
String[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray();
modelName = string.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, string.Join("And", argumentTypeNames));
}
return modelName;
@@ -6,6 +6,6 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
{
public Attribute AnnotationAttribute { get; set; }
public string Documentation { get; set; }
public String Documentation { get; set; }
}
}
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -12,9 +13,9 @@ namespace Service.MeterProcessState.Areas.HelpPage.ModelDescriptions
public Collection<ParameterAnnotation> Annotations { get; private set; }
public string Documentation { get; set; }
public String Documentation { get; set; }
public string Name { get; set; }
public String Name { get; set; }
public ModelDescription TypeDescription { get; set; }
}
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net.Http.Headers;
@@ -17,9 +18,9 @@ namespace Service.MeterProcessState.Areas.HelpPage.Models
public HelpPageApiModel()
{
UriParameters = new Collection<ParameterDescription>();
SampleRequests = new Dictionary<MediaTypeHeaderValue, object>();
SampleResponses = new Dictionary<MediaTypeHeaderValue, object>();
ErrorMessages = new Collection<string>();
SampleRequests = new Dictionary<MediaTypeHeaderValue, Object>();
SampleResponses = new Dictionary<MediaTypeHeaderValue, Object>();
ErrorMessages = new Collection<String>();
}
/// <summary>
@@ -35,7 +36,7 @@ namespace Service.MeterProcessState.Areas.HelpPage.Models
/// <summary>
/// Gets or sets the documentation for the request.
/// </summary>
public string RequestDocumentation { get; set; }
public String RequestDocumentation { get; set; }
/// <summary>
/// Gets or sets the <see cref="ModelDescription"/> that describes the request body.
@@ -72,17 +73,17 @@ namespace Service.MeterProcessState.Areas.HelpPage.Models
/// <summary>
/// Gets the sample requests associated with the API.
/// </summary>
public IDictionary<MediaTypeHeaderValue, object> SampleRequests { get; private set; }
public IDictionary<MediaTypeHeaderValue, Object> SampleRequests { get; private set; }
/// <summary>
/// Gets the sample responses associated with the API.
/// </summary>
public IDictionary<MediaTypeHeaderValue, object> SampleResponses { get; private set; }
public IDictionary<MediaTypeHeaderValue, Object> SampleResponses { get; private set; }
/// <summary>
/// Gets the error messages associated with this model.
/// </summary>
public Collection<string> ErrorMessages { get; private set; }
public Collection<String> ErrorMessages { get; private set; }
private static IList<ParameterDescription> GetParameterDescriptions(ModelDescription modelDescription)
{
@@ -26,9 +26,9 @@ namespace Service.MeterProcessState.Areas.HelpPage
public HelpPageSampleGenerator()
{
ActualHttpMessageTypes = new Dictionary<HelpPageSampleKey, Type>();
ActionSamples = new Dictionary<HelpPageSampleKey, object>();
SampleObjects = new Dictionary<Type, object>();
SampleObjectFactories = new List<Func<HelpPageSampleGenerator, Type, object>>
ActionSamples = new Dictionary<HelpPageSampleKey, Object>();
SampleObjects = new Dictionary<Type, Object>();
SampleObjectFactories = new List<Func<HelpPageSampleGenerator, Type, Object>>
{
DefaultSampleObjectFactory,
};
@@ -42,12 +42,12 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <summary>
/// Gets the objects that are used directly as samples for certain actions.
/// </summary>
public IDictionary<HelpPageSampleKey, object> ActionSamples { get; internal set; }
public IDictionary<HelpPageSampleKey, Object> ActionSamples { get; internal set; }
/// <summary>
/// Gets the objects that are serialized as samples by the supported formatters.
/// </summary>
public IDictionary<Type, object> SampleObjects { get; internal set; }
public IDictionary<Type, Object> SampleObjects { get; internal set; }
/// <summary>
/// Gets factories for the objects that the supported formatters will serialize as samples. Processed in order,
@@ -59,14 +59,14 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <code>SampleObjectFactories.Add(func)</code> to provide a fallback.</remarks>
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
Justification = "This is an appropriate nesting of generic types")]
public IList<Func<HelpPageSampleGenerator, Type, object>> SampleObjectFactories { get; private set; }
public IList<Func<HelpPageSampleGenerator, Type, Object>> SampleObjectFactories { get; private set; }
/// <summary>
/// Gets the request body samples for a given <see cref="ApiDescription"/>.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleRequests(ApiDescription api)
public IDictionary<MediaTypeHeaderValue, Object> GetSampleRequests(ApiDescription api)
{
return GetSample(api, SampleDirection.Request);
}
@@ -76,7 +76,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleResponses(ApiDescription api)
public IDictionary<MediaTypeHeaderValue, Object> GetSampleResponses(ApiDescription api)
{
return GetSample(api, SampleDirection.Response);
}
@@ -87,18 +87,18 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The samples keyed by media type.</returns>
public virtual IDictionary<MediaTypeHeaderValue, object> GetSample(ApiDescription api, SampleDirection sampleDirection)
public virtual IDictionary<MediaTypeHeaderValue, Object> GetSample(ApiDescription api, SampleDirection sampleDirection)
{
if (api == null)
{
throw new ArgumentNullException("api");
}
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
String controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
String actionName = api.ActionDescriptor.ActionName;
IEnumerable<String> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
Type type = ResolveType(api, controllerName, actionName, parameterNames, sampleDirection, out formatters);
var samples = new Dictionary<MediaTypeHeaderValue, object>();
var samples = new Dictionary<MediaTypeHeaderValue, Object>();
// Use the samples provided directly for actions
var actionSamples = GetAllActionSamples(controllerName, actionName, parameterNames, sampleDirection);
@@ -111,14 +111,14 @@ namespace Service.MeterProcessState.Areas.HelpPage
// Here we cannot rely on formatters because we don't know what's in the HttpResponseMessage, it might not even use formatters.
if (type != null && !typeof(HttpResponseMessage).IsAssignableFrom(type))
{
object sampleObject = GetSampleObject(type);
Object sampleObject = GetSampleObject(type);
foreach (var formatter in formatters)
{
foreach (MediaTypeHeaderValue mediaType in formatter.SupportedMediaTypes)
{
if (!samples.ContainsKey(mediaType))
{
object sample = GetActionSample(controllerName, actionName, parameterNames, type, formatter, mediaType, sampleDirection);
Object sample = GetActionSample(controllerName, actionName, parameterNames, type, formatter, mediaType, sampleDirection);
// If no sample found, try generate sample using formatter and sample object
if (sample == null && sampleObject != null)
@@ -146,9 +146,9 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="mediaType">The media type.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The sample that matches the parameters.</returns>
public virtual object GetActionSample(string controllerName, string actionName, IEnumerable<string> parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection)
public virtual Object GetActionSample(String controllerName, String actionName, IEnumerable<String> parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection)
{
object sample;
Object sample;
// First, try to get the sample provided for the specified mediaType, sampleDirection, controllerName, actionName and parameterNames.
// If not found, try to get the sample provided for the specified mediaType, sampleDirection, controllerName and actionName regardless of the parameterNames.
@@ -175,14 +175,14 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <returns>The sample object.</returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")]
public virtual object GetSampleObject(Type type)
public virtual Object GetSampleObject(Type type)
{
object sampleObject;
Object sampleObject;
if (!SampleObjects.TryGetValue(type, out sampleObject))
{
// No specific object available, try our factories.
foreach (Func<HelpPageSampleGenerator, Type, object> factory in SampleObjectFactories)
foreach (Func<HelpPageSampleGenerator, Type, Object> factory in SampleObjectFactories)
{
if (factory == null)
{
@@ -214,9 +214,9 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <returns>The type.</returns>
public virtual Type ResolveHttpRequestMessageType(ApiDescription api)
{
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
String controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
String actionName = api.ActionDescriptor.ActionName;
IEnumerable<String> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
return ResolveType(api, controllerName, actionName, parameterNames, SampleDirection.Request, out formatters);
}
@@ -231,11 +231,11 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="sampleDirection">The value indicating whether the sample is for a request or a response.</param>
/// <param name="formatters">The formatters.</param>
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", Justification = "This is only used in advanced scenarios.")]
public virtual Type ResolveType(ApiDescription api, string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection, out Collection<MediaTypeFormatter> formatters)
public virtual Type ResolveType(ApiDescription api, String controllerName, String actionName, IEnumerable<String> parameterNames, SampleDirection sampleDirection, out Collection<MediaTypeFormatter> formatters)
{
if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
{
throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
throw new InvalidEnumArgumentException("sampleDirection", (Int32)sampleDirection, typeof(SampleDirection));
}
if (api == null)
{
@@ -285,7 +285,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="mediaType">Type of the media.</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as InvalidSample.")]
public virtual object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, object value, Type type, MediaTypeHeaderValue mediaType)
public virtual Object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, Object value, Type type, MediaTypeHeaderValue mediaType)
{
if (formatter == null)
{
@@ -296,7 +296,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
throw new ArgumentNullException("mediaType");
}
object sample = String.Empty;
Object sample = string.Empty;
MemoryStream ms = null;
HttpContent content = null;
try
@@ -308,7 +308,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
formatter.WriteToStreamAsync(type, value, ms, content, null).Wait();
ms.Position = 0;
StreamReader reader = new StreamReader(ms);
string serializedSampleString = reader.ReadToEnd();
String serializedSampleString = reader.ReadToEnd();
if (mediaType.MediaType.ToUpperInvariant().Contains("XML"))
{
serializedSampleString = TryFormatXml(serializedSampleString);
@@ -322,7 +322,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
else
{
sample = new InvalidSample(String.Format(
sample = new InvalidSample(string.Format(
CultureInfo.CurrentCulture,
"Failed to generate the sample for media type '{0}'. Cannot use formatter '{1}' to write type '{2}'.",
mediaType,
@@ -332,7 +332,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
catch (Exception e)
{
sample = new InvalidSample(String.Format(
sample = new InvalidSample(string.Format(
CultureInfo.CurrentCulture,
"An exception has occurred while using the formatter '{0}' to generate sample for media type '{1}'. Exception message: {2}",
formatter.GetType().Name,
@@ -365,7 +365,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
// Default factory for sample objects
private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type)
private static Object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type)
{
// Try to create a default sample object
ObjectGenerator objectGenerator = new ObjectGenerator();
@@ -373,11 +373,11 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatJson(string str)
private static String TryFormatJson(String str)
{
try
{
object parsedJson = JsonConvert.DeserializeObject(str);
Object parsedJson = JsonConvert.DeserializeObject(str);
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
}
catch
@@ -388,7 +388,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatXml(string str)
private static String TryFormatXml(String str)
{
try
{
@@ -402,7 +402,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
}
private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type)
private static Boolean IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type)
{
switch (sampleDirection)
{
@@ -414,14 +414,14 @@ namespace Service.MeterProcessState.Areas.HelpPage
return false;
}
private IEnumerable<KeyValuePair<HelpPageSampleKey, object>> GetAllActionSamples(string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection)
private IEnumerable<KeyValuePair<HelpPageSampleKey, Object>> GetAllActionSamples(String controllerName, String actionName, IEnumerable<String> parameterNames, SampleDirection sampleDirection)
{
HashSet<string> parameterNamesSet = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
HashSet<String> parameterNamesSet = new HashSet<String>(parameterNames, StringComparer.OrdinalIgnoreCase);
foreach (var sample in ActionSamples)
{
HelpPageSampleKey sampleKey = sample.Key;
if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
if (string.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
(sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) &&
sampleDirection == sampleKey.SampleDirection)
{
@@ -430,9 +430,9 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
}
private static object WrapSampleIfString(object sample)
private static Object WrapSampleIfString(Object sample)
{
string stringSample = sample as string;
String stringSample = sample as String;
if (stringSample != null)
{
return new TextSample(stringSample);
@@ -21,10 +21,10 @@ namespace Service.MeterProcessState.Areas.HelpPage
throw new ArgumentNullException("mediaType");
}
ActionName = String.Empty;
ControllerName = String.Empty;
ActionName = string.Empty;
ControllerName = string.Empty;
MediaType = mediaType;
ParameterNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
ParameterNames = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
}
/// <summary>
@@ -50,11 +50,11 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
public HelpPageSampleKey(SampleDirection sampleDirection, String controllerName, String actionName, IEnumerable<String> parameterNames)
{
if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
{
throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
throw new InvalidEnumArgumentException("sampleDirection", (Int32)sampleDirection, typeof(SampleDirection));
}
if (controllerName == null)
{
@@ -71,7 +71,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
ControllerName = controllerName;
ActionName = actionName;
ParameterNames = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
ParameterNames = new HashSet<String>(parameterNames, StringComparer.OrdinalIgnoreCase);
SampleDirection = sampleDirection;
}
@@ -83,7 +83,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, String controllerName, String actionName, IEnumerable<String> parameterNames)
: this(sampleDirection, controllerName, actionName, parameterNames)
{
if (mediaType == null)
@@ -100,7 +100,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <value>
/// The name of the controller.
/// </value>
public string ControllerName { get; private set; }
public String ControllerName { get; private set; }
/// <summary>
/// Gets the name of the action.
@@ -108,7 +108,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <value>
/// The name of the action.
/// </value>
public string ActionName { get; private set; }
public String ActionName { get; private set; }
/// <summary>
/// Gets the media type.
@@ -121,7 +121,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// <summary>
/// Gets the parameter names.
/// </summary>
public HashSet<string> ParameterNames { get; private set; }
public HashSet<String> ParameterNames { get; private set; }
public Type ParameterType { get; private set; }
@@ -130,7 +130,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
public SampleDirection? SampleDirection { get; private set; }
public override bool Equals(object obj)
public override Boolean Equals(Object obj)
{
HelpPageSampleKey otherKey = obj as HelpPageSampleKey;
if (otherKey == null)
@@ -138,17 +138,17 @@ namespace Service.MeterProcessState.Areas.HelpPage
return false;
}
return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
return string.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
(MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) &&
ParameterType == otherKey.ParameterType &&
SampleDirection == otherKey.SampleDirection &&
ParameterNames.SetEquals(otherKey.ParameterNames);
}
public override int GetHashCode()
public override Int32 GetHashCode()
{
int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();
Int32 hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();
if (MediaType != null)
{
hashCode ^= MediaType.GetHashCode();
@@ -161,7 +161,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
{
hashCode ^= ParameterType.GetHashCode();
}
foreach (string parameterName in ParameterNames)
foreach (String parameterName in ParameterNames)
{
hashCode ^= parameterName.ToUpperInvariant().GetHashCode();
}
@@ -11,7 +11,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// Initializes a new instance of the <see cref="ImageSample"/> class.
/// </summary>
/// <param name="src">The URL of an image.</param>
public ImageSample(string src)
public ImageSample(String src)
{
if (src == null)
{
@@ -20,20 +20,20 @@ namespace Service.MeterProcessState.Areas.HelpPage
Src = src;
}
public string Src { get; private set; }
public String Src { get; private set; }
public override bool Equals(object obj)
public override Boolean Equals(Object obj)
{
ImageSample other = obj as ImageSample;
return other != null && Src == other.Src;
}
public override int GetHashCode()
public override Int32 GetHashCode()
{
return Src.GetHashCode();
}
public override string ToString()
public override String ToString()
{
return Src;
}
@@ -7,7 +7,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
public class InvalidSample
{
public InvalidSample(string errorMessage)
public InvalidSample(String errorMessage)
{
if (errorMessage == null)
{
@@ -16,20 +16,20 @@ namespace Service.MeterProcessState.Areas.HelpPage
ErrorMessage = errorMessage;
}
public string ErrorMessage { get; private set; }
public String ErrorMessage { get; private set; }
public override bool Equals(object obj)
public override Boolean Equals(Object obj)
{
InvalidSample other = obj as InvalidSample;
return other != null && ErrorMessage == other.ErrorMessage;
}
public override int GetHashCode()
public override Int32 GetHashCode()
{
return ErrorMessage.GetHashCode();
}
public override string ToString()
public override String ToString()
{
return ErrorMessage;
}
@@ -13,7 +13,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
public class ObjectGenerator
{
internal const int DefaultCollectionSize = 2;
internal const Int32 DefaultCollectionSize = 2;
private readonly SimpleTypeObjectGenerator SimpleObjectGenerator = new SimpleTypeObjectGenerator();
/// <summary>
@@ -30,13 +30,13 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
/// <param name="type">The type.</param>
/// <returns>An object of the given type.</returns>
public object GenerateObject(Type type)
public Object GenerateObject(Type type)
{
return GenerateObject(type, new Dictionary<Type, object>());
return GenerateObject(type, new Dictionary<Type, Object>());
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Here we just want to return null if anything goes wrong.")]
private object GenerateObject(Type type, Dictionary<Type, object> createdObjectReferences)
private Object GenerateObject(Type type, Dictionary<Type, Object> createdObjectReferences)
{
try
{
@@ -101,7 +101,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
return null;
}
private static object GenerateGenericType(Type type, int collectionSize, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateGenericType(Type type, Int32 collectionSize, Dictionary<Type, Object> createdObjectReferences)
{
Type genericTypeDefinition = type.GetGenericTypeDefinition();
if (genericTypeDefinition == typeof(Nullable<>))
@@ -165,13 +165,13 @@ namespace Service.MeterProcessState.Areas.HelpPage
return null;
}
private static object GenerateTuple(Type type, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateTuple(Type type, Dictionary<Type, Object> createdObjectReferences)
{
Type[] genericArgs = type.GetGenericArguments();
object[] parameterValues = new object[genericArgs.Length];
bool failedToCreateTuple = true;
Object[] parameterValues = new Object[genericArgs.Length];
Boolean failedToCreateTuple = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < genericArgs.Length; i++)
for (Int32 i = 0; i < genericArgs.Length; i++)
{
parameterValues[i] = objectGenerator.GenerateObject(genericArgs[i], createdObjectReferences);
failedToCreateTuple &= parameterValues[i] == null;
@@ -180,11 +180,11 @@ namespace Service.MeterProcessState.Areas.HelpPage
{
return null;
}
object result = Activator.CreateInstance(type, parameterValues);
Object result = Activator.CreateInstance(type, parameterValues);
return result;
}
private static bool IsTuple(Type genericTypeDefinition)
private static Boolean IsTuple(Type genericTypeDefinition)
{
return genericTypeDefinition == typeof(Tuple<>) ||
genericTypeDefinition == typeof(Tuple<,>) ||
@@ -196,32 +196,32 @@ namespace Service.MeterProcessState.Areas.HelpPage
genericTypeDefinition == typeof(Tuple<,,,,,,,>);
}
private static object GenerateKeyValuePair(Type keyValuePairType, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateKeyValuePair(Type keyValuePairType, Dictionary<Type, Object> createdObjectReferences)
{
Type[] genericArgs = keyValuePairType.GetGenericArguments();
Type typeK = genericArgs[0];
Type typeV = genericArgs[1];
ObjectGenerator objectGenerator = new ObjectGenerator();
object keyObject = objectGenerator.GenerateObject(typeK, createdObjectReferences);
object valueObject = objectGenerator.GenerateObject(typeV, createdObjectReferences);
Object keyObject = objectGenerator.GenerateObject(typeK, createdObjectReferences);
Object valueObject = objectGenerator.GenerateObject(typeV, createdObjectReferences);
if (keyObject == null && valueObject == null)
{
// Failed to create key and values
return null;
}
object result = Activator.CreateInstance(keyValuePairType, keyObject, valueObject);
Object result = Activator.CreateInstance(keyValuePairType, keyObject, valueObject);
return result;
}
private static object GenerateArray(Type arrayType, int size, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateArray(Type arrayType, Int32 size, Dictionary<Type, Object> createdObjectReferences)
{
Type type = arrayType.GetElementType();
Array result = Array.CreateInstance(type, size);
bool areAllElementsNull = true;
Boolean areAllElementsNull = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
for (Int32 i = 0; i < size; i++)
{
object element = objectGenerator.GenerateObject(type, createdObjectReferences);
Object element = objectGenerator.GenerateObject(type, createdObjectReferences);
result.SetValue(element, i);
areAllElementsNull &= element == null;
}
@@ -234,10 +234,10 @@ namespace Service.MeterProcessState.Areas.HelpPage
return result;
}
private static object GenerateDictionary(Type dictionaryType, int size, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateDictionary(Type dictionaryType, Int32 size, Dictionary<Type, Object> createdObjectReferences)
{
Type typeK = typeof(object);
Type typeV = typeof(object);
Type typeK = typeof(Object);
Type typeV = typeof(Object);
if (dictionaryType.IsGenericType)
{
Type[] genericArgs = dictionaryType.GetGenericArguments();
@@ -245,31 +245,31 @@ namespace Service.MeterProcessState.Areas.HelpPage
typeV = genericArgs[1];
}
object result = Activator.CreateInstance(dictionaryType);
Object result = Activator.CreateInstance(dictionaryType);
MethodInfo addMethod = dictionaryType.GetMethod("Add") ?? dictionaryType.GetMethod("TryAdd");
MethodInfo containsMethod = dictionaryType.GetMethod("Contains") ?? dictionaryType.GetMethod("ContainsKey");
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
for (Int32 i = 0; i < size; i++)
{
object newKey = objectGenerator.GenerateObject(typeK, createdObjectReferences);
Object newKey = objectGenerator.GenerateObject(typeK, createdObjectReferences);
if (newKey == null)
{
// Cannot generate a valid key
return null;
}
bool containsKey = (bool)containsMethod.Invoke(result, new object[] { newKey });
Boolean containsKey = (Boolean)containsMethod.Invoke(result, new Object[] { newKey });
if (!containsKey)
{
object newValue = objectGenerator.GenerateObject(typeV, createdObjectReferences);
addMethod.Invoke(result, new object[] { newKey, newValue });
Object newValue = objectGenerator.GenerateObject(typeV, createdObjectReferences);
addMethod.Invoke(result, new Object[] { newKey, newValue });
}
}
return result;
}
private static object GenerateEnum(Type enumType)
private static Object GenerateEnum(Type enumType)
{
Array possibleValues = Enum.GetValues(enumType);
if (possibleValues.Length > 0)
@@ -279,10 +279,10 @@ namespace Service.MeterProcessState.Areas.HelpPage
return null;
}
private static object GenerateQueryable(Type queryableType, int size, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateQueryable(Type queryableType, Int32 size, Dictionary<Type, Object> createdObjectReferences)
{
bool isGeneric = queryableType.IsGenericType;
object list;
Boolean isGeneric = queryableType.IsGenericType;
Object list;
if (isGeneric)
{
Type listType = typeof(List<>).MakeGenericType(queryableType.GetGenericArguments());
@@ -290,7 +290,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
}
else
{
list = GenerateArray(typeof(object[]), size, createdObjectReferences);
list = GenerateArray(typeof(Object[]), size, createdObjectReferences);
}
if (list == null)
{
@@ -306,19 +306,19 @@ namespace Service.MeterProcessState.Areas.HelpPage
return Queryable.AsQueryable((IEnumerable)list);
}
private static object GenerateCollection(Type collectionType, int size, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateCollection(Type collectionType, Int32 size, Dictionary<Type, Object> createdObjectReferences)
{
Type type = collectionType.IsGenericType ?
collectionType.GetGenericArguments()[0] :
typeof(object);
object result = Activator.CreateInstance(collectionType);
typeof(Object);
Object result = Activator.CreateInstance(collectionType);
MethodInfo addMethod = collectionType.GetMethod("Add");
bool areAllElementsNull = true;
Boolean areAllElementsNull = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
for (Int32 i = 0; i < size; i++)
{
object element = objectGenerator.GenerateObject(type, createdObjectReferences);
addMethod.Invoke(result, new object[] { element });
Object element = objectGenerator.GenerateObject(type, createdObjectReferences);
addMethod.Invoke(result, new Object[] { element });
areAllElementsNull &= element == null;
}
@@ -330,16 +330,16 @@ namespace Service.MeterProcessState.Areas.HelpPage
return result;
}
private static object GenerateNullable(Type nullableType, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateNullable(Type nullableType, Dictionary<Type, Object> createdObjectReferences)
{
Type type = nullableType.GetGenericArguments()[0];
ObjectGenerator objectGenerator = new ObjectGenerator();
return objectGenerator.GenerateObject(type, createdObjectReferences);
}
private static object GenerateComplexObject(Type type, Dictionary<Type, object> createdObjectReferences)
private static Object GenerateComplexObject(Type type, Dictionary<Type, Object> createdObjectReferences)
{
object result = null;
Object result = null;
if (createdObjectReferences.TryGetValue(type, out result))
{
@@ -360,7 +360,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
return null;
}
result = defaultCtor.Invoke(new object[0]);
result = defaultCtor.Invoke(new Object[0]);
}
createdObjectReferences.Add(type, result);
SetPublicProperties(type, result, createdObjectReferences);
@@ -368,7 +368,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
return result;
}
private static void SetPublicProperties(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
private static void SetPublicProperties(Type type, Object obj, Dictionary<Type, Object> createdObjectReferences)
{
PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
ObjectGenerator objectGenerator = new ObjectGenerator();
@@ -376,32 +376,32 @@ namespace Service.MeterProcessState.Areas.HelpPage
{
if (property.CanWrite)
{
object propertyValue = objectGenerator.GenerateObject(property.PropertyType, createdObjectReferences);
Object propertyValue = objectGenerator.GenerateObject(property.PropertyType, createdObjectReferences);
property.SetValue(obj, propertyValue, null);
}
}
}
private static void SetPublicFields(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
private static void SetPublicFields(Type type, Object obj, Dictionary<Type, Object> createdObjectReferences)
{
FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
ObjectGenerator objectGenerator = new ObjectGenerator();
foreach (FieldInfo field in fields)
{
object fieldValue = objectGenerator.GenerateObject(field.FieldType, createdObjectReferences);
Object fieldValue = objectGenerator.GenerateObject(field.FieldType, createdObjectReferences);
field.SetValue(obj, fieldValue);
}
}
private class SimpleTypeObjectGenerator
{
private long _index = 0;
private static readonly Dictionary<Type, Func<long, object>> DefaultGenerators = InitializeGenerators();
private Int64 _index = 0;
private static readonly Dictionary<Type, Func<Int64, Object>> DefaultGenerators = InitializeGenerators();
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "These are simple type factories and cannot be split up.")]
private static Dictionary<Type, Func<long, object>> InitializeGenerators()
private static Dictionary<Type, Func<Int64, Object>> InitializeGenerators()
{
return new Dictionary<Type, Func<long, object>>
return new Dictionary<Type, Func<Int64, Object>>
{
{ typeof(Boolean), index => true },
{ typeof(Byte), index => (Byte)64 },
@@ -412,16 +412,16 @@ namespace Service.MeterProcessState.Areas.HelpPage
{ typeof(Decimal), index => (Decimal)index },
{ typeof(Double), index => (Double)(index + 0.1) },
{ typeof(Guid), index => Guid.NewGuid() },
{ typeof(Int16), index => (Int16)(index % Int16.MaxValue) },
{ typeof(Int32), index => (Int32)(index % Int32.MaxValue) },
{ typeof(Int16), index => (Int16)(index % short.MaxValue) },
{ typeof(Int32), index => (Int32)(index % int.MaxValue) },
{ typeof(Int64), index => (Int64)index },
{ typeof(Object), index => new object() },
{ typeof(Object), index => new Object() },
{ typeof(SByte), index => (SByte)64 },
{ typeof(Single), index => (Single)(index + 0.1) },
{
typeof(String), index =>
{
return String.Format(CultureInfo.CurrentCulture, "sample string {0}", index);
return string.Format(CultureInfo.CurrentCulture, "sample string {0}", index);
}
},
{
@@ -430,24 +430,24 @@ namespace Service.MeterProcessState.Areas.HelpPage
return TimeSpan.FromTicks(1234567);
}
},
{ typeof(UInt16), index => (UInt16)(index % UInt16.MaxValue) },
{ typeof(UInt32), index => (UInt32)(index % UInt32.MaxValue) },
{ typeof(UInt16), index => (UInt16)(index % ushort.MaxValue) },
{ typeof(UInt32), index => (UInt32)(index % uint.MaxValue) },
{ typeof(UInt64), index => (UInt64)index },
{
typeof(Uri), index =>
{
return new Uri(String.Format(CultureInfo.CurrentCulture, "http://webapihelppage{0}.com", index));
return new Uri(string.Format(CultureInfo.CurrentCulture, "http://webapihelppage{0}.com", index));
}
},
};
}
public static bool CanGenerateObject(Type type)
public static Boolean CanGenerateObject(Type type)
{
return DefaultGenerators.ContainsKey(type);
}
public object GenerateObject(Type type)
public Object GenerateObject(Type type)
{
return DefaultGenerators[type](++_index);
}
@@ -7,7 +7,7 @@ namespace Service.MeterProcessState.Areas.HelpPage
/// </summary>
public class TextSample
{
public TextSample(string text)
public TextSample(String text)
{
if (text == null)
{
@@ -16,20 +16,20 @@ namespace Service.MeterProcessState.Areas.HelpPage
Text = text;
}
public string Text { get; private set; }
public String Text { get; private set; }
public override bool Equals(object obj)
public override Boolean Equals(Object obj)
{
TextSample other = obj as TextSample;
return other != null && Text == other.Text;
}
public override int GetHashCode()
public override Int32 GetHashCode()
{
return Text.GetHashCode();
}
public override string ToString()
public override String ToString()
{
return Text;
}
@@ -15,17 +15,17 @@ namespace Service.MeterProcessState.Areas.HelpPage
public class XmlDocumentationProvider : IDocumentationProvider, IModelDocumentationProvider
{
private XPathNavigator _documentNavigator;
private const string TypeExpression = "/doc/members/member[@name='T:{0}']";
private const string MethodExpression = "/doc/members/member[@name='M:{0}']";
private const string PropertyExpression = "/doc/members/member[@name='P:{0}']";
private const string FieldExpression = "/doc/members/member[@name='F:{0}']";
private const string ParameterExpression = "param[@name='{0}']";
private const String TypeExpression = "/doc/members/member[@name='T:{0}']";
private const String MethodExpression = "/doc/members/member[@name='M:{0}']";
private const String PropertyExpression = "/doc/members/member[@name='P:{0}']";
private const String FieldExpression = "/doc/members/member[@name='F:{0}']";
private const String ParameterExpression = "param[@name='{0}']";
/// <summary>
/// Initializes a new instance of the <see cref="XmlDocumentationProvider"/> class.
/// </summary>
/// <param name="documentPath">The physical path to XML document.</param>
public XmlDocumentationProvider(string documentPath)
public XmlDocumentationProvider(String documentPath)
{
if (documentPath == null)
{
@@ -35,19 +35,19 @@ namespace Service.MeterProcessState.Areas.HelpPage
_documentNavigator = xpath.CreateNavigator();
}
public string GetDocumentation(HttpControllerDescriptor controllerDescriptor)
public String GetDocumentation(HttpControllerDescriptor controllerDescriptor)
{
XPathNavigator typeNode = GetTypeNode(controllerDescriptor.ControllerType);
return GetTagValue(typeNode, "summary");
}
public virtual string GetDocumentation(HttpActionDescriptor actionDescriptor)
public virtual String GetDocumentation(HttpActionDescriptor actionDescriptor)
{
XPathNavigator methodNode = GetMethodNode(actionDescriptor);
return GetTagValue(methodNode, "summary");
}
public virtual string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
public virtual String GetDocumentation(HttpParameterDescriptor parameterDescriptor)
{
ReflectedHttpParameterDescriptor reflectedParameterDescriptor = parameterDescriptor as ReflectedHttpParameterDescriptor;
if (reflectedParameterDescriptor != null)
@@ -55,8 +55,8 @@ namespace Service.MeterProcessState.Areas.HelpPage
XPathNavigator methodNode = GetMethodNode(reflectedParameterDescriptor.ActionDescriptor);
if (methodNode != null)
{
string parameterName = reflectedParameterDescriptor.ParameterInfo.Name;
XPathNavigator parameterNode = methodNode.SelectSingleNode(String.Format(CultureInfo.InvariantCulture, ParameterExpression, parameterName));
String parameterName = reflectedParameterDescriptor.ParameterInfo.Name;
XPathNavigator parameterNode = methodNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, ParameterExpression, parameterName));
if (parameterNode != null)
{
return parameterNode.Value.Trim();
@@ -67,22 +67,22 @@ namespace Service.MeterProcessState.Areas.HelpPage
return null;
}
public string GetResponseDocumentation(HttpActionDescriptor actionDescriptor)
public String GetResponseDocumentation(HttpActionDescriptor actionDescriptor)
{
XPathNavigator methodNode = GetMethodNode(actionDescriptor);
return GetTagValue(methodNode, "returns");
}
public string GetDocumentation(MemberInfo member)
public String GetDocumentation(MemberInfo member)
{
string memberName = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", GetTypeName(member.DeclaringType), member.Name);
string expression = member.MemberType == MemberTypes.Field ? FieldExpression : PropertyExpression;
string selectExpression = String.Format(CultureInfo.InvariantCulture, expression, memberName);
String memberName = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", GetTypeName(member.DeclaringType), member.Name);
String expression = member.MemberType == MemberTypes.Field ? FieldExpression : PropertyExpression;
String selectExpression = string.Format(CultureInfo.InvariantCulture, expression, memberName);
XPathNavigator propertyNode = _documentNavigator.SelectSingleNode(selectExpression);
return GetTagValue(propertyNode, "summary");
}
public string GetDocumentation(Type type)
public String GetDocumentation(Type type)
{
XPathNavigator typeNode = GetTypeNode(type);
return GetTagValue(typeNode, "summary");
@@ -93,27 +93,27 @@ namespace Service.MeterProcessState.Areas.HelpPage
ReflectedHttpActionDescriptor reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor;
if (reflectedActionDescriptor != null)
{
string selectExpression = String.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo));
String selectExpression = string.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo));
return _documentNavigator.SelectSingleNode(selectExpression);
}
return null;
}
private static string GetMemberName(MethodInfo method)
private static String GetMemberName(MethodInfo method)
{
string name = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", GetTypeName(method.DeclaringType), method.Name);
String name = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", GetTypeName(method.DeclaringType), method.Name);
ParameterInfo[] parameters = method.GetParameters();
if (parameters.Length != 0)
{
string[] parameterTypeNames = parameters.Select(param => GetTypeName(param.ParameterType)).ToArray();
name += String.Format(CultureInfo.InvariantCulture, "({0})", String.Join(",", parameterTypeNames));
String[] parameterTypeNames = parameters.Select(param => GetTypeName(param.ParameterType)).ToArray();
name += string.Format(CultureInfo.InvariantCulture, "({0})", string.Join(",", parameterTypeNames));
}
return name;
}
private static string GetTagValue(XPathNavigator parentNode, string tagName)
private static String GetTagValue(XPathNavigator parentNode, String tagName)
{
if (parentNode != null)
{
@@ -129,25 +129,25 @@ namespace Service.MeterProcessState.Areas.HelpPage
private XPathNavigator GetTypeNode(Type type)
{
string controllerTypeName = GetTypeName(type);
string selectExpression = String.Format(CultureInfo.InvariantCulture, TypeExpression, controllerTypeName);
String controllerTypeName = GetTypeName(type);
String selectExpression = string.Format(CultureInfo.InvariantCulture, TypeExpression, controllerTypeName);
return _documentNavigator.SelectSingleNode(selectExpression);
}
private static string GetTypeName(Type type)
private static String GetTypeName(Type type)
{
string name = type.FullName;
String name = type.FullName;
if (type.IsGenericType)
{
// Format the generic type name to something like: Generic{System.Int32,System.String}
Type genericType = type.GetGenericTypeDefinition();
Type[] genericArguments = type.GetGenericArguments();
string genericTypeName = genericType.FullName;
String genericTypeName = genericType.FullName;
// Trim the generic parameter counts from the name
genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`'));
string[] argumentTypeNames = genericArguments.Select(t => GetTypeName(t)).ToArray();
name = String.Format(CultureInfo.InvariantCulture, "{0}{{{1}}}", genericTypeName, String.Join(",", argumentTypeNames));
String[] argumentTypeNames = genericArguments.Select(t => GetTypeName(t)).ToArray();
name = string.Format(CultureInfo.InvariantCulture, "{0}{{{1}}}", genericTypeName, string.Join(",", argumentTypeNames));
}
if (type.IsNested)
{
@@ -0,0 +1,169 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
[RoutePrefix("api/EasyAccess")]
public class EasyAccessController : ApiController
{
public static class GlobalConfig
{
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
[Route("GetLeakDataFull")]
public async Task<HttpResponseMessage> GetLeakDataFull(String PcbId = "" , string Auftrag = "")
{
try
{
var returnPw = "Not assigned";
var resDic = new List<Tuple<string, string>>();
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
StringBuilder query = new StringBuilder();
query.AppendLine("SELECT * ");
query.AppendLine(" FROM [Auftrag].[dbo].[Cordonel_PressureTest] pt ");
query.AppendLine(" inner join Cordonel_PressureTest_He he on pt.CordonelPressureTest_Id = he.CordonelPressureTestHe_TestID ");
query.AppendLine(" left outer join Druckpruefung c on pt.[CordonelPressureTest_PcbId] = c.FabNr ");
query.AppendLine(" where 1 = 1 ");
if (!string.IsNullOrEmpty(PcbId))
{
query.AppendLine($" and pt.[CordonelPressureTest_PcbId] = {PcbId} ");
}
if (!string.IsNullOrEmpty(Auftrag))
{
query.AppendLine($" and pt.[CordonelPressureTest_FertigungsAuftragsNr] = {Auftrag} ");
}
query.AppendLine(" order by 1 desc ");
var retDic = new List<Tuple<string, string>>();
var dt = dataAccess.ExecuteQuery(query.ToString());
foreach (var item in dt.Select())
{
var sb = new StringBuilder();
try
{
sb.Append(item["CordonelPressureTest_Id"]).Append(";");
sb.Append(item["CordonelPressureTest_PcbId"]).Append(";");
sb.Append(item["CordonelPressureTest_FertigungsAuftragsNr"]).Append(";");
sb.Append(item["CordonelPressureTest_Date"]).Append(";");
sb.Append(item["CordonelPressureTest_Valid"]).Append(";");
sb.Append(item["CordonelPressureTest_IsDeleted"]).Append(";");
sb.Append(item["CordonelPressureTest_Text"]).Append(";");
sb.Append(item["CordonelPressureTestHe_LeakRate"]).Append(";");
sb.Append(item["CordonelPressureTestHe_TestPressure"]).Append(";");
sb.Append(item["CordonelPressureTestHe_TesterName"]).Append(";");
if (item["Pruefgang"] != DBNull.Value)
{
sb.Append(item["Pruefgang"]).Append(";");
sb.Append(item["Datum"]).Append(";");
sb.Append(item["StartDruck"]).Append(";");
sb.Append(item["EndDruck"]).Append(";");
sb.Append(item["Pruefzeit"]).Append(";");
sb.Append(item["Pruefer"]).Append(";");
sb.Append(item["Dicht"]).Append(";");
}
else
{
sb.Append("keine Kottmann Prüfung gefunden;;;;;;;");
}
retDic.Add( new Tuple<string,string>(item["CordonelPressureTest_Id"].ToString(), sb.ToString()));
}
catch (Exception ex)
{
throw;
}
}
var sbRet = new StringBuilder();
sbRet.Append("CordonelPressureTest_Id").Append(";");
sbRet.Append("CordonelPressureTest_PcbId").Append(";");
sbRet.Append("CordonelPressureTest_FertigungsAuftragsNr").Append(";");
sbRet.Append("CordonelPressureTest_Date").Append(";");
sbRet.Append("CordonelPressureTest_Valid").Append(";");
sbRet.Append("CordonelPressureTest_IsDeleted").Append(";");
sbRet.Append("CordonelPressureTest_Text").Append(";");
sbRet.Append("CordonelPressureTestHe_LeakRate").Append(";");
sbRet.Append("CordonelPressureTestHe_TestPressure").Append(";");
sbRet.Append("CordonelPressureTestHe_TesterName").Append(";");
sbRet.Append("Pruefgang").Append(";");
sbRet.Append("Datum").Append(";");
sbRet.Append("StartDruck").Append(";");
sbRet.Append("EndDruck").Append(";");
sbRet.Append("Pruefzeit").Append(";");
sbRet.Append("Pruefer").Append(";");
sbRet.Append("Dicht").Append(";");
sbRet.Append("HE_TestPoints").Append(";");
sbRet.AppendLine();
foreach (var item in retDic)
{
dt = dataAccess.ExecuteQuery($" select * from Cordonel_PressureTest_TestPoints where CordonelPressureTest_Id = {item.Item1} order by CordonelPressureTest_TestPointNr ASC");
var sbTp = new StringBuilder();
foreach (var itemTP in dt.Select())
{
sbTp.Append("Nr ");
sbTp.Append(itemTP["CordonelPressureTest_TestPointNr"]);
sbTp.Append("= ");
sbTp.Append(itemTP["CordonelPressureTest_TestPointResult"]);
sbTp.Append(" and ");
}
sbRet.Append(item.Item2);
sbRet.Append(sbTp.ToString());
sbRet.AppendLine(";");
}
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StringContent(sbRet.ToString());
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); //attachment will force download
result.Content.Headers.ContentDisposition.FileName = "RecordExport.csv";
return result;
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ToString() + "<br >" + ex.InnerException.ToString());
}
}
}
}
@@ -1,6 +1,5 @@
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -13,22 +12,26 @@ using System.Web;
using System.Web.Http;
using Xylem.Common.Logic.ProductionOrderCore.File;
using Xylem.Common.Logic.ProductionOrderCore.FW;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
/// <summary>
///
/// </summary>
[RoutePrefix("api/FileUpToDate")]
public class FileUpToDateController : ApiController
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
private async Task<HttpResponseMessage> InsertFileDb(string FileName, string FileContent = null, bool isForDevloper = true)
private async Task<HttpResponseMessage> InsertFileDb(String FileName, String FileContent = null, Boolean isForDevloper = true)
{
try
{
@@ -44,7 +47,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
private string DbAccessWriteFile(string FileName, string FileContent, bool isForDevloper)
private String DbAccessWriteFile(String FileName, String FileContent, Boolean isForDevloper)
{
if (string.IsNullOrEmpty(FileName))
{
@@ -105,7 +108,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public async Task<HttpResponseMessage> PostFileJsonContent([FromBody] BaseFile file)
{
//why file is empty on large files??
string jsonData = JsonConvert.SerializeObject(file);
String jsonData = JsonConvert.SerializeObject(file);
return await InsertFileDb(file.FileName, file.FileContent, file.ForDeveloper ?? true);
}
@@ -114,10 +117,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("PostFwUpdateReportFile"), HttpPost]
public async Task<HttpResponseMessage> PostFwUpdateReportFile(int PcbId, int UserId, [FromBody] BaseFile file)
public async Task<HttpResponseMessage> PostFwUpdateReportFile(Int32 PcbId, Int32 UserId, [FromBody] BaseFile file)
{
//why file is empty on large files??
string jsonData = JsonConvert.SerializeObject(file);
String jsonData = JsonConvert.SerializeObject(file);
var a = await InsertFileDb(file.FileName, file.FileContent, file.ForDeveloper ?? true);
var fileID = 0;
@@ -162,10 +165,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("PostLutFile"), HttpPost]
public async Task<HttpResponseMessage> PostLutFile(int DataLength, string version, int crc, int Metersize, string Region)
public async Task<HttpResponseMessage> PostLutFile(Int32 DataLength, String version, Int32 crc, Int32 Metersize, String Region)
{
var httpFiles = HttpContext.Current.Request.Files;
var listOfFiles = new List<Tuple<string, byte[]>>();
var listOfFiles = new List<Tuple<String, Byte[]>>();
foreach (var a in httpFiles)
{
try
@@ -173,7 +176,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
if (HttpContext.Current.Request.Files[a.ToString()] is HttpPostedFile f)
{
listOfFiles.Add(new Tuple<string, byte[]>(f.FileName, GetFileBytes(f)));
listOfFiles.Add(new Tuple<String, Byte[]>(f.FileName, GetFileBytes(f)));
}
}
catch (Exception)
@@ -193,8 +196,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
try
{
int? retId = null;
int FileCounter = StoreFiles(out retId, true, listOfFiles.First().Item1, FileCategoryID: 7, listOfFiles: listOfFiles);
Int32? retId = null;
Int32 FileCounter = StoreFiles(out retId, true, listOfFiles.First().Item1, FileCategoryID: 7, listOfFiles: listOfFiles);
if (FileCounter == listOfFiles.Count && retId.HasValue)
{
@@ -236,9 +239,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
public virtual byte[] GetFileBytes(HttpPostedFile uploadedFile)
public virtual Byte[] GetFileBytes(HttpPostedFile uploadedFile)
{
var bytes = new byte[uploadedFile.ContentLength];
var bytes = new Byte[uploadedFile.ContentLength];
uploadedFile.InputStream.Read(bytes, 0, uploadedFile.ContentLength);
return bytes;
}
@@ -249,7 +252,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("GetLutFiles"), HttpGet]
public async Task<HttpResponseMessage> GetLutFiles(int? Metersize = null, string Region = null, bool? ForProd = null)
public async Task<HttpResponseMessage> GetLutFiles(Int32? Metersize = null, String Region = null, Boolean? ForProd = null)
{
try
@@ -287,7 +290,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
if (ForProd.HasValue)
{
sb.AppendLine($" and CurrentVersionForProd ={(ForProd.Value? "1" : "0") } ");
sb.AppendLine($" and CurrentVersionForProd ={(ForProd.Value ? "1" : "0") } ");
}
var retDT = dataacces.ExecuteQuery(sb.ToString());
@@ -311,17 +314,17 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("PostFWFileBinaryContent"), HttpPost]
public async Task<HttpResponseMessage> PostFWFileBinaryContent(bool IsDevloper, string FWname, MeterSize? meterSize = null, CordonelFWTypeEnum? fWTypeEnum = null, int FileCategoryID = 1, string FileDateString = "CURRENT_TIMESTAMP")
public async Task<HttpResponseMessage> PostFWFileBinaryContent(Boolean IsDevloper, String FWname, MeterSize? meterSize = null, CordonelFWTypeEnum? fWTypeEnum = null, Int32 FileCategoryID = 1, String FileDateString = "CURRENT_TIMESTAMP")
{
var httpFiles = HttpContext.Current.Request.Files;
var listOfFiles = new List<Tuple<string, byte[]>>();
var listOfFiles = new List<Tuple<String, Byte[]>>();
foreach (var a in httpFiles)
{
try
{
if (HttpContext.Current.Request.Files[a.ToString()] is HttpPostedFile f)
{
listOfFiles.Add(new Tuple<string, byte[]>(a.ToString(), GetFileBytes(f)));
listOfFiles.Add(new Tuple<String, Byte[]>(a.ToString(), GetFileBytes(f)));
}
}
catch (Exception)
@@ -336,8 +339,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
return await Task.Run(() =>
{
int? retId = null;
int FileCounter = StoreFiles(out retId, IsDevloper, FWname, meterSize, fWTypeEnum, FileCategoryID, FileDateString, listOfFiles);
Int32? retId = null;
Int32 FileCounter = StoreFiles(out retId, IsDevloper, FWname, meterSize, fWTypeEnum, FileCategoryID, FileDateString, listOfFiles);
if (FileCounter == listOfFiles.Count && retId.HasValue)
{
@@ -348,7 +351,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
});
}
public int StoreFiles(out int? FileClusterStoreId, bool IsDevloper, string FWname, MeterSize? meterSize = null, CordonelFWTypeEnum? fWTypeEnum = null, int FileCategoryID = 1, string FileDateString = "CURRENT_TIMESTAMP", List<Tuple<string, byte[]>> listOfFiles = null)
public Int32 StoreFiles(out Int32? FileClusterStoreId, Boolean IsDevloper, String FWname, MeterSize? meterSize = null, CordonelFWTypeEnum? fWTypeEnum = null, Int32 FileCategoryID = 1, String FileDateString = "CURRENT_TIMESTAMP", List<Tuple<String, Byte[]>> listOfFiles = null)
{
//1 Cordonel FW
//2 Cordonel Configruation File
@@ -381,7 +384,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" SELECT @@IDENTITY ");
var ret = dataacces.ExecuteQuery(sb.ToString());
FileClusterStoreId = (int)((decimal)ret.Rows[0][0]);
FileClusterStoreId = (Int32)((Decimal)ret.Rows[0][0]);
if (meterSize.HasValue && fWTypeEnum.HasValue)
{
sb = new StringBuilder();
@@ -396,17 +399,17 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" SELECT @@IDENTITY ");
ret = dataacces.ExecuteQuery(sb.ToString());
var CordonelFwFileId = (int)((decimal)ret.Rows[0][0]);
var CordonelFwFileId = (Int32)((Decimal)ret.Rows[0][0]);
}
}
int FileCounter = 0;
Int32 FileCounter = 0;
if (listOfFiles.Any())
{
//addMapEntrie
for (int i = 0; i < listOfFiles.Count; i++)
for (Int32 i = 0; i < listOfFiles.Count; i++)
{
var content = listOfFiles[i].Item2;
@@ -425,7 +428,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
parameters.Add(FileContent);
var retDT = dataacces.ExecuteQuery("INSERT INTO [dbo].[File] ([FileContent], [FileName]) VALUES (@FileContent, @FileName) ;SELECT @@IDENTITY ", parameters);
var FileId = (int)((decimal)retDT.Rows[0][0]);
var FileId = (Int32)((Decimal)retDT.Rows[0][0]);
var sb = new StringBuilder();
@@ -439,7 +442,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var retDTMap = dataacces.ExecuteQuery(sb.ToString());
if (retDTMap != null && retDTMap.Rows.Count > 0 && (int)((decimal)retDTMap.Rows[0][0]) > -1)
if (retDTMap != null && retDTMap.Rows.Count > 0 && (Int32)((Decimal)retDTMap.Rows[0][0]) > -1)
{
FileCounter = FileCounter + 1;
}
@@ -454,6 +457,139 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
/// <summary>
/// Retruns filted FW files for Cordonel without content
/// </summary>
/// <returns></returns>
[Route("GetCorondelFw"), HttpGet]
public async Task<HttpResponseMessage> GetCorondelFw(Int32? Metersize = null, int? Frequency = null, String Region = null, Boolean? ForProd = null , Boolean? Deleted = false)
{
try
{
return await Task.Run(() =>
{
var ret = new List<CordonelFw>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb.AppendLine($" SELECT [CordonelCurrentFw_ID] ");
sb.AppendLine($" ,[CordonelCurrentFw_Frequency] ");
sb.AppendLine($" ,[CordonelCurrentFw_AppID] ");
sb.AppendLine($" ,[CordonelCurrentFw_Version] ");
sb.AppendLine($" ,[CordonelCurrentFw_Name] ");
sb.AppendLine($" ,[CordonelCurrentFw_Deleted] ");
sb.AppendLine($" ,[CordonelCurrentFw_ForPressure] ");
sb.AppendLine($" ,[CordonelCurrentFw_Metersize] ");
sb.AppendLine($" ,[CordonelCurrentFw_LutFileID] ");
sb.AppendLine($" ,[CordonelCurrentFw_Region] ");
sb.AppendLine($" ,[CordonelCurrentFw_CurrentForProd] ");
sb.AppendLine($" ,[CordonelCurrentFw_FileClusterStoreId] ");
sb.AppendLine($" ,[FileName] ");
sb.AppendLine($" FROM[Auftrag].[dbo].[Cordonel_CurrentFw] ");
sb.AppendLine($" left outer join [Auftrag].[dbo].[FileClusterStore] on [FileId] = [CordonelCurrentFw_FileClusterStoreId]");
sb.AppendLine($" where 1= 1 ");
if (Metersize.HasValue)
{
sb.AppendLine($" and CordonelCurrentFw_Metersize= {Metersize.Value} ");
}
if (!string.IsNullOrEmpty(Region))
{
sb.AppendLine($" and CordonelCurrentFw_Region ='{Region}' ");
}
if (ForProd.HasValue)
{
sb.AppendLine($" and CordonelCurrentFw_CurrentForProd ={(ForProd.Value ? "1" : "0") } ");
}
if (Deleted.HasValue)
{
sb.AppendLine($" and CordonelCurrentFw_Deleted is {(Deleted.Value ? "not" : "")} null");
}
var retDT = dataacces.ExecuteQuery(sb.ToString());
foreach (DataRow item in retDT.Rows)
{
var add = new CordonelFw() { Id = (int)item["CordonelCurrentFw_ID"] };
add.Frequency = (int)item["CordonelCurrentFw_Frequency"];
add.Name = (string)item["CordonelCurrentFw_Name"];
add.FileName = "";
if (item["FileName"].GetType() != typeof(DBNull))
{
add.FileName = (string)item["FileName"];
}
if (item["CordonelCurrentFw_Deleted"].GetType() != typeof(DBNull))
{
add.DeletedDate = (DateTime)item["CordonelCurrentFw_Deleted"];
}
add.AppID = (int)item["CordonelCurrentFw_AppID"];
add.Version = (int)item["CordonelCurrentFw_Version"];
add.Metersize = (Int16)item["CordonelCurrentFw_Metersize"];
add.LutFileID = null;
if (item["CordonelCurrentFw_LutFileID"].GetType() != typeof(DBNull))
{
add.LutFileID = (Int16)item["CordonelCurrentFw_LutFileID"];
}
add.FileClusterStoreId = null;
if (item["CordonelCurrentFw_FileClusterStoreId"].GetType() != typeof(DBNull))
{
add.FileClusterStoreId = (int)item["CordonelCurrentFw_FileClusterStoreId"];
}
add.CurrentForProd = false;
if (item["CordonelCurrentFw_CurrentForProd"].GetType() != typeof(DBNull))
{
add.CurrentForProd = (bool)item["CordonelCurrentFw_CurrentForProd"];
}
switch ((string)item["CordonelCurrentFw_Region"].ToString())
{
case "emea":
add.Region = Logic.ProductionOrderCore.OrderData.Region.EMEA;
break;
case "na":
add.Region = Logic.ProductionOrderCore.OrderData.Region.NA;
break;
case "china":
add.Region = Logic.ProductionOrderCore.OrderData.Region.China;
break;
default:
add.Region = Logic.ProductionOrderCore.OrderData.Region.EMEA;
break;
}
ret.Add(add);
}
return Request.CreateResponse(HttpStatusCode.OK, ret);
}
});
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
}
/// <summary>
/// Returns a list of all Fw Files (FileCategoryID = 1) that match the filters and are not deleted
/// </summary>
@@ -465,7 +601,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="CordonelFwFile_Type">null for all</param>
/// <returns></returns>
[Route("GetFwFiles"), HttpGet]
public async Task<HttpResponseMessage> GetFwFiles(int? FileId = null, string FileName = "", bool? FileIsLatest = null, bool? FileIsForDeveloperOnly = null, int? CordonelFwFile_Dn = null, int? CordonelFwFile_Type = null, int? FileCategoryID = 1)
public async Task<HttpResponseMessage> GetFwFiles(Int32? FileId = null, String FileName = "", Boolean? FileIsLatest = null, Boolean? FileIsForDeveloperOnly = null, Int32? CordonelFwFile_Dn = null, Int32? CordonelFwFile_Type = null, Int32? FileCategoryID = 1)
{
return await Task.Run(() =>
{
@@ -506,7 +642,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("GetFileParts"), HttpGet]
public async Task<HttpResponseMessage> GetFileParts(int? ParentFileId = null, int? FileId = null, string FileName = "", bool readContent = false)
public async Task<HttpResponseMessage> GetFileParts(Int32? ParentFileId = null, Int32? FileId = null, String FileName = "", Boolean readContent = false)
{
return await Task.Run(() =>
{
@@ -562,7 +698,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("GetUpdateFileContent"), HttpGet]
public async Task<HttpResponseMessage> GetUpdateFileContent(string FileName, DateTimeOffset? ClientFileDate = null, bool isDeveloper = false)
public async Task<HttpResponseMessage> GetUpdateFileContent(String FileName, DateTimeOffset? ClientFileDate = null, Boolean isDeveloper = false)
{
try
{
@@ -599,7 +735,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("GetFileList"), HttpGet]
public async Task<HttpResponseMessage> GetFileList(int? FileID = null, string FileName = "", bool? latest = null, bool? isDeveloper = null)
public async Task<HttpResponseMessage> GetFileList(Int32? FileID = null, String FileName = "", Boolean? latest = null, Boolean? isDeveloper = null)
{
try
{
@@ -618,7 +754,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
private List<BaseFile> GetFiles(int? FileID = null, string FileName = "", bool? latest = true, bool? isDeveloper = false, DateTime? FileDateIsGreaterThan = null)
private List<BaseFile> GetFiles(Int32? FileID = null, String FileName = "", Boolean? latest = true, Boolean? isDeveloper = false, DateTime? FileDateIsGreaterThan = null)
{
var ret = new List<BaseFile>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
@@ -633,7 +769,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
else
{
if (!String.IsNullOrEmpty(FileName))
if (!string.IsNullOrEmpty(FileName))
{
sb.AppendLine($" and FileName like '%{FileName}%' ");
}
@@ -682,12 +818,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
ret.Add(
new BaseFile()
{
FileId = (int)row["FileId"],
FileName = (string)row["FileName"],
FileContent = (string)row["FileContent"],
IsLatest = (bool)row["FileIsLatest"],
FileId = (Int32)row["FileId"],
FileName = (String)row["FileName"],
FileContent = (String)row["FileContent"],
IsLatest = (Boolean)row["FileIsLatest"],
UploadDate = (DateTime)row["FileDate"],
ForDeveloper = (bool)row["FileIsForDeveloperOnly"],
ForDeveloper = (Boolean)row["FileIsForDeveloperOnly"],
});
}
@@ -701,14 +837,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <returns></returns>
[Route("GetFileContent"), HttpGet]
public async Task<HttpResponseMessage> GetFileContent(int? FileID = null, string FileName = "", bool isDeveloper = false)
public async Task<HttpResponseMessage> GetFileContent(Int32? FileID = null, String FileName = "", Boolean isDeveloper = false)
{
try
{
return await Task.Run(async () =>
{
bool? islatest = null;
if (!String.IsNullOrEmpty(FileName) && !FileID.HasValue)
Boolean? islatest = null;
if (!string.IsNullOrEmpty(FileName) && !FileID.HasValue)
{
islatest = true;
}
@@ -10,11 +10,11 @@ using System.Web.Http;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Service.Core;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.ProductionOrderCore.KitronTestResults;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.ProductionOrderCore.Vako;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -13,6 +12,7 @@ using System.Web;
using System.Web.Http;
using Xylem.Common.Cryptology.Security;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.ServiceCore;
using Xylem.ServiceFwUpdate.Common.FwUpdateDb;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery;
@@ -23,14 +23,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
//
[Route("GetUserList"), HttpGet]
public async Task<HttpResponseMessage> GetUserList(string LogInName = "", int? Id = null)
public async Task<HttpResponseMessage> GetUserList(String LogInName = "", Int32? Id = null)
{
return await Task.Run(() =>
@@ -46,7 +46,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
});
}
private System.Collections.Generic.List<UserInformation> getUserList(string LogInName = "", int? Id = null)
private System.Collections.Generic.List<UserInformation> getUserList(String LogInName = "", Int32? Id = null)
{
var ret = new System.Collections.Generic.List<UserInformation>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
@@ -69,16 +69,16 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new UserInformation((int)row["UserId"])
new UserInformation((Int32)row["UserId"])
{
FullName = row["FullName"] == DBNull.Value ? "" : (string)row["FullName"],
LogInName = (string)row["LogInName"],
Domain = (string)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (string)row["HardwareId"],
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (string)row["PasswordHash"],
FullName = row["FullName"] == DBNull.Value ? "" : (String)row["FullName"],
LogInName = (String)row["LogInName"],
Domain = (String)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (String)row["HardwareId"],
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (String)row["PasswordHash"],
RegisterDate = (DateTimeOffset)row["RegisterDate"],
ValidDate = (DateTimeOffset)row["ValidDate"],
AccountActive = (bool)row["AccountActive"],
AccountActive = (Boolean)row["AccountActive"],
});
}
@@ -106,13 +106,13 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new UserInformation((int)row["UserId"])
new UserInformation((Int32)row["UserId"])
{
FullName = row["FullName"] == DBNull.Value ? "" : (string)row["FullName"],
LogInName = (string)row["LogInName"],
Domain = (string)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (string)row["HardwareId"],
AccountActive = (bool)row["AccountActive"],
FullName = row["FullName"] == DBNull.Value ? "" : (String)row["FullName"],
LogInName = (String)row["LogInName"],
Domain = (String)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (String)row["HardwareId"],
AccountActive = (Boolean)row["AccountActive"],
});
}
@@ -133,7 +133,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("RefreshUsersHardwareId"), HttpGet]
public async Task<HttpResponseMessage> RefreshUsersHardwareId(int id, string HardwareId)
public async Task<HttpResponseMessage> RefreshUsersHardwareId(Int32 id, String HardwareId)
{
return await Task.Run(() =>
{
@@ -157,7 +157,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("RefreshUsersPasswordHash"), HttpGet]
public async Task<HttpResponseMessage> RefreshUsersPasswordHash(int id, string PasswordHash)
public async Task<HttpResponseMessage> RefreshUsersPasswordHash(Int32 id, String PasswordHash)
{
return await Task.Run(() =>
{
@@ -184,7 +184,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("EditUserValidity"), HttpGet]
public async Task<HttpResponseMessage> EditUserValidity(int id, DateTimeOffset? ValidDate = null, bool? AccountActive = null)
public async Task<HttpResponseMessage> EditUserValidity(Int32 id, DateTimeOffset? ValidDate = null, Boolean? AccountActive = null)
{
return await Task.Run(() =>
{
@@ -236,7 +236,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetFileContent"), HttpGet]
public async Task<HttpResponseMessage> GetFileContent(int FileId)
public async Task<HttpResponseMessage> GetFileContent(Int32 FileId)
{
return await Task.Run(() =>
{
@@ -262,7 +262,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetFWUpdateSafeContainers"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateSafeContainers(int UserId)
public async Task<HttpResponseMessage> GetFWUpdateSafeContainers(Int32 UserId)
{
return await Task.Run(() =>
{
@@ -286,10 +286,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
ret.Add(
new FwUpdateSafeDb()
{
ContainerId = (int)row["FWUpdateSafeContainer_ID"],
Name = (string)row["FWUpdateSafeContainer_Name"],
UserId = (int)row["FWUpdateSafeContainer_UserId"],
FilePartId = (int)row["FWUpdateSafeContainer_FileId"],
ContainerId = (Int32)row["FWUpdateSafeContainer_ID"],
Name = (String)row["FWUpdateSafeContainer_Name"],
UserId = (Int32)row["FWUpdateSafeContainer_UserId"],
FilePartId = (Int32)row["FWUpdateSafeContainer_FileId"],
ValidDate = (DateTime)row["FWUpdateSafeContainer_ValidDate"]
});
@@ -306,7 +306,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
});
}
[Route("AddPcbIdsToSafe"), HttpPost]
public async Task<HttpResponseMessage> AddPcbIdsToSafe(int ContainerDbId, [FromBody] List<int> PcbIds)
public async Task<HttpResponseMessage> AddPcbIdsToSafe(Int32 ContainerDbId, [FromBody] List<Int32> PcbIds)
{
return await Task.Run(() =>
{
@@ -348,14 +348,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetPcbIdsFromSafe"), HttpGet]
public async Task<HttpResponseMessage> GetPcbIdsFromSafe(int ContainerDbId)
public async Task<HttpResponseMessage> GetPcbIdsFromSafe(Int32 ContainerDbId)
{
return await Task.Run(() =>
{
try
{
var ret = new System.Collections.Generic.List<int>();
var ret = new System.Collections.Generic.List<Int32>();
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
@@ -368,7 +368,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
ret.Add((int)row["FWUpdateSafeContainer_PcbId"]);
ret.Add((Int32)row["FWUpdateSafeContainer_PcbId"]);
}
}
@@ -392,7 +392,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <returns></returns>
[Route("PostFWUpdateSafeOdd"), HttpPost]
public async Task<HttpResponseMessage> PostFWUpdateSafeOdd(int PUserId, string PFileName, DateTime PValidDate, string PBuilderOperatorName = "none")
public async Task<HttpResponseMessage> PostFWUpdateSafeOdd(Int32 PUserId, String PFileName, DateTime PValidDate, String PBuilderOperatorName = "none")
{
if (PFileName.Length > 150)
{
@@ -452,8 +452,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
await content.ReadAsMultipartAsync(provider);
string uploadingFileName = provider.FileData.Select(x => x.LocalFileName).FirstOrDefault();
string originalFileName = String.Concat(fileuploadPath, "\\" + (provider.Contents[0].Headers.ContentDisposition.FileName).Trim(new Char[] { '"' }));
String uploadingFileName = provider.FileData.Select(x => x.LocalFileName).FirstOrDefault();
String originalFileName = string.Concat(fileuploadPath, "\\" + (provider.Contents[0].Headers.ContentDisposition.FileName).Trim(new Char[] { '"' }));
if (File.Exists(originalFileName))
{
@@ -480,7 +480,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
});
}
[Route("GetFWUpdateSafeContainerContent"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateSafeContainerContent(int SafeContainerId)
public async Task<HttpResponseMessage> GetFWUpdateSafeContainerContent(Int32 SafeContainerId)
{
return await Task.Run(() =>
{
@@ -500,8 +500,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
var content = new byte[] { };
var filePath = $"C:\\\\Temp\\{(int)row["FWUpdateSafeContainer_ID"]}\\{(string)row["FWUpdateSafeContainer_Name"]}";
var content = new Byte[] { };
var filePath = $"C:\\\\Temp\\{(Int32)row["FWUpdateSafeContainer_ID"]}\\{(String)row["FWUpdateSafeContainer_Name"]}";
if (File.Exists(filePath))
{
content = File.ReadAllBytes(filePath);
@@ -513,10 +513,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
ret.Add(
new FwUpdateSafeDb()
{
ContainerId = (int)row["FWUpdateSafeContainer_ID"],
Name = (string)row["FWUpdateSafeContainer_Name"],
UserId = (int)row["FWUpdateSafeContainer_UserId"],
FilePartId = (int)row["FWUpdateSafeContainer_FileId"],
ContainerId = (Int32)row["FWUpdateSafeContainer_ID"],
Name = (String)row["FWUpdateSafeContainer_Name"],
UserId = (Int32)row["FWUpdateSafeContainer_UserId"],
FilePartId = (Int32)row["FWUpdateSafeContainer_FileId"],
ValidDate = (DateTime)row["FWUpdateSafeContainer_ValidDate"],
Content = content
});
@@ -594,9 +594,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public virtual byte[] GetFileBytes(HttpPostedFile uploadedFile)
public virtual Byte[] GetFileBytes(HttpPostedFile uploadedFile)
{
var bytes = new byte[uploadedFile.ContentLength];
var bytes = new Byte[uploadedFile.ContentLength];
uploadedFile.InputStream.Read(bytes, 0, uploadedFile.ContentLength);
return bytes;
}
@@ -660,7 +660,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetFWUpdateReportFile"), HttpGet]
public async Task<HttpResponseMessage> GetFWUpdateReportFile(int? PcbId = null, int? UserId = null, int? OrderNr = null, bool WithContent = true)
public async Task<HttpResponseMessage> GetFWUpdateReportFile(Int32? PcbId = null, Int32? UserId = null, Int32? OrderNr = null, Boolean WithContent = true)
{
return await Task.Run(() =>
{
@@ -704,8 +704,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
var addOBJ = JsonConvert.DeserializeObject<FwUpdateReportDb>(UTF32Encoding.UTF32.GetString((byte[])row["FileContent"]));
addOBJ.FileId = (int)row["FWUpdateReport_ID"];
var addOBJ = JsonConvert.DeserializeObject<FwUpdateReportDb>(UTF32Encoding.UTF32.GetString((Byte[])row["FileContent"]));
addOBJ.FileId = (Int32)row["FWUpdateReport_ID"];
addOBJ.Date = (DateTime)row["FWUpdateReport_Date"];
ret.Add(addOBJ);
}
@@ -723,12 +723,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetRecoveryFile"), HttpGet]
public async Task<HttpResponseMessage> GetRecoveryFile(int PcbID, int? RadioFrq, string Region, string FlexnetVersion)
public async Task<HttpResponseMessage> GetRecoveryFile(Int32 PcbID, Int32? RadioFrq, String Region, String FlexnetVersion)
{
var file = new RecoverySettings() { PcbId = PcbID, RadioFrequencyMhz = RadioFrq, Region = Region, Release = FlexnetVersion };
file.RecoveryRegisters = new List<RecoveryRegisterItem>();
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 }, IsCiritcal = true, ReadbackValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 } });
@@ -761,18 +761,18 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x0c } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_MainAlarmMask", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_ExtendedAlarmMask", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x01 }, IsCiritcal = true, ReadbackValue = new Byte[] { 0x00, 0x00, 0x00, 0x0c } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_MainAlarmMask", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_ExtendedAlarmMask", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new byte[] { 0x00, 0x00, 0x00, 0xFF }, IsCiritcal = true, ReadbackValue = new byte[] { 0x00, 0x00, 0x00, 0x0c } });
file.RecoveryRegisters.Add(new RecoveryRegisterItem() { RegisterIdent = "SENSUSRADIO_SystemState", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0xFF }, IsCiritcal = true, ReadbackValue = new Byte[] { 0x00, 0x00, 0x00, 0x0c } });
var blacklist = new List<string>()
var blacklist = new List<String>()
{
"CUSTOMER_RebootCount",
"GENESISFLOW_ForwardArrow",
@@ -785,7 +785,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
};
var Crit = new List<string>()
var Crit = new List<String>()
{
"GENESISFLOW_SealDisplay",
"GENESISFLOW_MeterSize",
@@ -818,7 +818,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var onlyIfDefaultl = new List<string>()
var onlyIfDefaultl = new List<String>()
{
"METROLOGYASST_PulseWeight",
"METROLOGYASST_PressureUnits",
@@ -847,7 +847,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("AddNewUser"), HttpGet]
public async Task<HttpResponseMessage> AddNewUser(string FullName, string LogInName, string Domain, string HardwareId = null, string PasswordHash = null)
public async Task<HttpResponseMessage> AddNewUser(String FullName, String LogInName, String Domain, String HardwareId = null, String PasswordHash = null)
{
return await Task.Run(() =>
@@ -1,5 +1,4 @@
using Logic.ProductionToProductMapper.Cordonel;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -9,6 +8,7 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Service.MeterProcessState.Controllers
{
@@ -19,14 +19,14 @@ namespace Service.MeterProcessState.Controllers
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
[Route("PostErrorMessage"), HttpPost]
public async Task<HttpResponseMessage> PostErrorMessage(string PcbId, string ErrorMessage)
public async Task<HttpResponseMessage> PostErrorMessage(String PcbId, String ErrorMessage)
{
try
{
@@ -44,7 +44,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("PostCalibrationResult"), HttpPost]
public async Task<HttpResponseMessage> PostCalibrationResult(string PcbId, [FromBody]CalibrationResult results)
public async Task<HttpResponseMessage> PostCalibrationResult(String PcbId, [FromBody]CalibrationResult results)
{
try
{
@@ -112,7 +112,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("GetCalibrationResults"), HttpGet]
public async Task<HttpResponseMessage> GetCalibrationResults(string PcbId)
public async Task<HttpResponseMessage> GetCalibrationResults(String PcbId)
{
try
{
@@ -152,22 +152,22 @@ namespace Service.MeterProcessState.Controllers
foreach (var item in dtCalibrationResults.Select())
{
var calibrationResult = new CalibrationResult();
calibrationResult.DbId = (int)item["ID"];
calibrationResult.CalFactor1 = (uint)(int)item["calFactor1"];
calibrationResult.CalFactor2 = (uint)(int)item["calFactor2"];
calibrationResult.CalFactor3 = (uint)(int)item["calFactor3"];
calibrationResult.ZeroOffset1 = (int)item["zeroOffset1"];
calibrationResult.ZeroOffset2 = (int)item["zeroOffset2"];
calibrationResult.ZeroOffset3 = (int)item["zeroOffset3"];
calibrationResult.FirstHitUpdatePeriod = (ushort)(int)item["firstHitUpdatePeriod"];
calibrationResult.FirstHitShift = (ushort)(int)item["firstHitShift"];
calibrationResult.FirstHitPercent1 = (ushort)(int)item["firstHitPercent1"];
calibrationResult.FirstHitPercent2 = (ushort)(int)item["firstHitPercent2"];
calibrationResult.FirstHitPercent3 = (ushort)(int)item["firstHitPercent3"];
calibrationResult.ToFTempOffset1 = (int)item["toFTempOffset1"];
calibrationResult.ToFTempOffset2 = (int)item["toFTempOffset2"];
calibrationResult.ToFTempOffset3 = (int)item["toFTempOffset3"];
calibrationResult.MeterSize = (ushort)(int)item["meterSize"];
calibrationResult.DbId = (Int32)item["ID"];
calibrationResult.CalFactor1 = (UInt32)(Int32)item["calFactor1"];
calibrationResult.CalFactor2 = (UInt32)(Int32)item["calFactor2"];
calibrationResult.CalFactor3 = (UInt32)(Int32)item["calFactor3"];
calibrationResult.ZeroOffset1 = (Int32)item["zeroOffset1"];
calibrationResult.ZeroOffset2 = (Int32)item["zeroOffset2"];
calibrationResult.ZeroOffset3 = (Int32)item["zeroOffset3"];
calibrationResult.FirstHitUpdatePeriod = (UInt16)(Int32)item["firstHitUpdatePeriod"];
calibrationResult.FirstHitShift = (UInt16)(Int32)item["firstHitShift"];
calibrationResult.FirstHitPercent1 = (UInt16)(Int32)item["firstHitPercent1"];
calibrationResult.FirstHitPercent2 = (UInt16)(Int32)item["firstHitPercent2"];
calibrationResult.FirstHitPercent3 = (UInt16)(Int32)item["firstHitPercent3"];
calibrationResult.ToFTempOffset1 = (Int32)item["toFTempOffset1"];
calibrationResult.ToFTempOffset2 = (Int32)item["toFTempOffset2"];
calibrationResult.ToFTempOffset3 = (Int32)item["toFTempOffset3"];
calibrationResult.MeterSize = (UInt16)(Int32)item["meterSize"];
calibrationResult.Date = (DateTime)item["date"];
ret.Add(calibrationResult);
}
@@ -183,7 +183,7 @@ namespace Service.MeterProcessState.Controllers
var dtCalibrationResultsLogInfo = dataacces.ExecuteQuery(sb.ToString());
foreach (var item in dtCalibrationResultsLogInfo.Select())
{
ret.First(f => f.DbId == (int)item["CalibrationResultsID"])?.AddAdditionalLog((string)item["LogKey"], (string)item["LogText"]);
ret.First(f => f.DbId == (Int32)item["CalibrationResultsID"])?.AddAdditionalLog((String)item["LogKey"], (String)item["LogText"]);
}
}
@@ -244,7 +244,7 @@ namespace Service.MeterProcessState.Controllers
sbRet.Append("ID;PcbId;Path;ZeroOffset;FirstHitPercent;ToFTempOffset1;MeterSize;date");
for (int i = 5; i <= 35; i++)
for (Int32 i = 5; i <= 35; i++)
{
sbRet.Append($";Amp_Mean_on_{i}%");
@@ -258,7 +258,7 @@ namespace Service.MeterProcessState.Controllers
{
if (item is DataRow dr)
{
for (int i = 1; i <= 3; i++)
for (Int32 i = 1; i <= 3; i++)
{
@@ -274,7 +274,7 @@ namespace Service.MeterProcessState.Controllers
var ampMenPercText = dr[$"Amp.Test Mean value PATH {i}"].ToString();
char[] delims = new[] { '\r', '\n' };
Char[] delims = new[] { '\r', '\n' };
var lines = ampMenPercText.Split(delims, StringSplitOptions.RemoveEmptyEntries);
var c = 5;
if (lines.Count() > 30 && lines.Count() < 41)
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -12,6 +11,7 @@ using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Xylem.Common.Cryptology.Security;
using Xylem.Common.Logic.ServiceCore;
using Xylem.ServiceFwUpdate.Common.FwUpdateDb;
using Xylem.ServiceFwUpdate.Common.FwUpdateSafe.MeterRecovery;
@@ -21,7 +21,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -48,16 +48,16 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (DataRow row in dbResult.Rows)
{
ret.Add(
new UserInformation((int)row["UserId"])
new UserInformation((Int32)row["UserId"])
{
FullName = row["FullName"] == DBNull.Value ? "" : (string)row["FullName"],
LogInName = (string)row["LogInName"],
Domain = (string)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (string)row["HardwareId"],
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (string)row["PasswordHash"],
FullName = row["FullName"] == DBNull.Value ? "" : (String)row["FullName"],
LogInName = (String)row["LogInName"],
Domain = (String)row["Domain"],
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (String)row["HardwareId"],
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (String)row["PasswordHash"],
RegisterDate = (DateTimeOffset)row["RegisterDate"],
ValidDate = (DateTimeOffset)row["ValidDate"],
AccountActive = (bool)row["AccountActive"],
AccountActive = (Boolean)row["AccountActive"],
});
}
@@ -1,5 +1,4 @@
using Logic.ProductionToProductMapper.Cordonel;
using Service.Core;
using System;
using System.Data;
using System.Net;
@@ -8,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
@@ -17,7 +17,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -31,16 +31,16 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="SerialNumber">can be Customer or internal serial number</param>
/// <returns></returns>
[Route("GetPcbId"), HttpGet]
public async Task<HttpResponseMessage> GetPcbID(string SerialNumber)
public async Task<HttpResponseMessage> GetPcbID(String SerialNumber)
{
try
{
return await Task.Run(() =>
{
int internalSerialNumber = 0;
Int32 internalSerialNumber = 0;
int.TryParse(SerialNumber, out internalSerialNumber);
int? fromOrderData = null;
Int32? fromOrderData = null;
if (internalSerialNumber == 0)
{
fromOrderData = getSerialNumberFromOrderData(SerialNumber);
@@ -80,7 +80,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="PcbID">PcbID from Meter</param>
/// <returns></returns>
[Route("GetSerialNumber"), HttpGet]
public async Task<HttpResponseMessage> GetSerialNumber(string PcbID)
public async Task<HttpResponseMessage> GetSerialNumber(String PcbID)
{
try
{
@@ -119,7 +119,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="PcbID">PcbID from Meter</param>
/// <returns></returns>
[Route("GetSerialNumberAndOrderNumber"), HttpGet]
public async Task<HttpResponseMessage> GetSerialNumberAndOrderNumber(string PcbID, bool withRadioAdress = false)
public async Task<HttpResponseMessage> GetSerialNumberAndOrderNumber(String PcbID, Boolean withRadioAdress = false)
{
try
{
@@ -172,7 +172,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
private int? getSerialNumberFromOrderData(string CustomerSerialNumber = null, int? SerialNumber = null, int? OrderNumber = null)
private Int32? getSerialNumberFromOrderData(String CustomerSerialNumber = null, Int32? SerialNumber = null, Int32? OrderNumber = null)
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
@@ -221,7 +221,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetSerialNumberFromOrderDataUnMapped"), HttpGet]
public async Task<HttpResponseMessage> GetSerialNumberFromOrderDataUnMapped(int OrderNumber)
public async Task<HttpResponseMessage> GetSerialNumberFromOrderDataUnMapped(Int32 OrderNumber)
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
@@ -265,7 +265,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetPreMarriageStateMSG"), HttpGet]
public async Task<HttpResponseMessage> GetPreMarriageState(string PcbId)
public async Task<HttpResponseMessage> GetPreMarriageState(String PcbId)
{
try
{
@@ -416,12 +416,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
ret = MarriagePossibleEnum.Possible;
}
return Request.CreateResponse(HttpStatusCode.OK, new object[] { ret , retOrder, retSerial, retFreeSrn });
return Request.CreateResponse(HttpStatusCode.OK, new Object[] { ret , retOrder, retSerial, retFreeSrn });
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.OK, new object[] { MarriagePossibleEnum.Error, null, null, null } );
return Request.CreateResponse(HttpStatusCode.OK, new Object[] { MarriagePossibleEnum.Error, null, null, null } );
}
});
}
@@ -433,7 +433,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetPreMarriageState"), HttpGet]
public async Task<HttpResponseMessage> GetPreMarriageState(string PcbId, string SerialNumber)
public async Task<HttpResponseMessage> GetPreMarriageState(String PcbId, String SerialNumber)
{
try
{
@@ -592,7 +592,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <returns></returns>
[Route("SetPcbToSerial"), HttpGet]
public async Task<HttpResponseMessage> SetPcbToSerial(string PcbId, string Scan = null, string CustomerSerialNumber = null, int? SerialNumber = null, int? OrderNumber = null, bool returnMetroData = false)
public async Task<HttpResponseMessage> SetPcbToSerial(String PcbId, String Scan = null, String CustomerSerialNumber = null, Int32? SerialNumber = null, Int32? OrderNumber = null, Boolean returnMetroData = false)
{
try
{
@@ -604,7 +604,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
var internalSerialNr = -1;
string cust = null;
String cust = null;
if (ScanToSerialNr.ConvertScanToSerialNr(Scan, out internalSerialNr, out cust))
{
if (internalSerialNr != -1)
@@ -1,6 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -11,6 +10,7 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
@@ -27,7 +27,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("SetPassword"), HttpGet]
public async Task<HttpResponseMessage> SetPassword(String PcbId, String password, bool keepOldPw = false)
public async Task<HttpResponseMessage> SetPassword(String PcbId, String password, Boolean keepOldPw = false)
{
try
{
@@ -73,7 +73,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (var item in dt.Select())
{
returnPw = item["password"].ToString();
if (!(bool)item["isLocked"])
if (!(Boolean)item["isLocked"])
{
return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return returnPw; }));
}
@@ -118,15 +118,15 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public Int64? orderNumber = null;
public Int64? radioAdress = null;
public string Skeleton = "";
public List<byte[]> listOfHashes = new List<byte[]>();
public List<byte[]> listOfPasswords = new List<byte[]>();
public String Skeleton = "";
public List<Byte[]> listOfHashes = new List<Byte[]>();
public List<Byte[]> listOfPasswords = new List<Byte[]>();
public string KeySetId { get; internal set; }
public String KeySetId { get; internal set; }
}
private MeterPw getKeys(string Token, string orderNumber, string radioAdress)
private MeterPw getKeys(String Token, String orderNumber, String radioAdress)
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
@@ -177,7 +177,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
try
{
var listOfHashes = new List<byte[]>();
var listOfHashes = new List<Byte[]>();
var sbOutPut = new StringBuilder();
var sbQuery = new StringBuilder();
@@ -221,10 +221,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
result.orderNumber = (Int32)item["FertigungsauftragNr"];
result.radioAdress = (Int64)item["Adresse"];
result.Skeleton = (string)item["Skeleton"];
result.Skeleton = (String)item["Skeleton"];
if (item["KeySetId"].GetType() != typeof(System.DBNull))
{
result.KeySetId = (string)item["KeySetId"];
result.KeySetId = (String)item["KeySetId"];
}
@@ -315,7 +315,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
private string MapKeySet(string KeySetID, Int64 orderNumber, Int64 radioAdress)
private String MapKeySet(String KeySetID, Int64 orderNumber, Int64 radioAdress)
{
@@ -333,9 +333,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
string postData = $"[{{\"setId\":\"{KeySetID}\", \"orderNumber\":\"{orderNumber}\", \"radioAdress\":\"{radioAdress}\"}}]";
String postData = $"[{{\"setId\":\"{KeySetID}\", \"orderNumber\":\"{orderNumber}\", \"radioAdress\":\"{radioAdress}\"}}]";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
Byte[] byte1 = encoding.GetBytes(postData);
// Set the content type of the data being posted.
http.ContentType = "application/json; charset=utf-8";
@@ -369,7 +369,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
private string CreateKeySet(int CountKeys)
private String CreateKeySet(Int32 CountKeys)
{
@@ -387,9 +387,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
string postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
String postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
Byte[] byte1 = encoding.GetBytes(postData);
// Set the content type of the data being posted.
http.ContentType = "application/json; charset=utf-8";
@@ -437,17 +437,17 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public partial class Key
{
[JsonProperty("Index")]
public long Index { get; set; }
public Int64 Index { get; set; }
[JsonProperty("Key")]
public string KeyKey { get; set; }
public String KeyKey { get; set; }
}
public partial class MeterPw
{
public static MeterPw Empty() => new MeterPw() { SetId = Guid.Empty, Keys = new List<Key>() };
public static MeterPw FromJson(string json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(string json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
public static MeterPw FromJson(String json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(String json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
}
@@ -1,6 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -10,6 +9,7 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
@@ -62,7 +62,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetCordonelMapping"), HttpGet]
public async Task<HttpResponseMessage> GetCordonelMapping(int PcbId)
public async Task<HttpResponseMessage> GetCordonelMapping(Int32 PcbId)
{
try
{
@@ -89,7 +89,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("DeleteCordonelMapping"), HttpPost]
public async Task<HttpResponseMessage> DeleteCordonelMapping(int PcbId)
public async Task<HttpResponseMessage> DeleteCordonelMapping(Int32 PcbId)
{
try
{
@@ -114,7 +114,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetCordonelOrderDetails"), HttpGet]
public async Task<HttpResponseMessage> GetCordonelOrderDetails(int OrderNr)
public async Task<HttpResponseMessage> GetCordonelOrderDetails(Int32 OrderNr)
{
try
{
@@ -162,7 +162,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetCordonelCustomers"), HttpGet]
public async Task<HttpResponseMessage> GetCordonelCustomers(string FilterName = null)
public async Task<HttpResponseMessage> GetCordonelCustomers(String FilterName = null)
{
try
{
@@ -197,7 +197,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetCustomersCordonelOrders"), HttpGet]
public async Task<HttpResponseMessage> GetCustomersCordonelOrders(int CustomerNumber)
public async Task<HttpResponseMessage> GetCustomersCordonelOrders(Int32 CustomerNumber)
{
try
{
@@ -226,7 +226,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetCordonelOrderList"), HttpGet]
public async Task<HttpResponseMessage> GetCordonelOrderList(int CustomerOrderNumber, int CustomerOrderPos)
public async Task<HttpResponseMessage> GetCordonelOrderList(Int32 CustomerOrderNumber, Int32 CustomerOrderPos)
{
try
{
@@ -258,15 +258,15 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public Int64? orderNumber = null;
public Int64? radioAdress = null;
public string Skeleton = "";
public List<byte[]> listOfHashes = new List<byte[]>();
public List<byte[]> listOfPasswords = new List<byte[]>();
public String Skeleton = "";
public List<Byte[]> listOfHashes = new List<Byte[]>();
public List<Byte[]> listOfPasswords = new List<Byte[]>();
public string KeySetId { get; internal set; }
public String KeySetId { get; internal set; }
}
private MeterPw getKeys(string Token, string orderNumber, string radioAdress)
private MeterPw getKeys(String Token, String orderNumber, String radioAdress)
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
@@ -317,7 +317,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
try
{
var listOfHashes = new List<byte[]>();
var listOfHashes = new List<Byte[]>();
var sbOutPut = new StringBuilder();
var sbQuery = new StringBuilder();
@@ -361,10 +361,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
result.orderNumber = (Int32)item["FertigungsauftragNr"];
result.radioAdress = (Int64)item["Adresse"];
result.Skeleton = (string)item["Skeleton"];
result.Skeleton = (String)item["Skeleton"];
if (item["KeySetId"].GetType() != typeof(System.DBNull))
{
result.KeySetId = (string)item["KeySetId"];
result.KeySetId = (String)item["KeySetId"];
}
@@ -455,7 +455,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
private string MapKeySet(string KeySetID, Int64 orderNumber, Int64 radioAdress)
private String MapKeySet(String KeySetID, Int64 orderNumber, Int64 radioAdress)
{
@@ -473,9 +473,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
string postData = $"[{{\"setId\":\"{KeySetID}\", \"orderNumber\":\"{orderNumber}\", \"radioAdress\":\"{radioAdress}\"}}]";
String postData = $"[{{\"setId\":\"{KeySetID}\", \"orderNumber\":\"{orderNumber}\", \"radioAdress\":\"{radioAdress}\"}}]";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
Byte[] byte1 = encoding.GetBytes(postData);
// Set the content type of the data being posted.
http.ContentType = "application/json; charset=utf-8";
@@ -509,7 +509,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
private string CreateKeySet(int CountKeys)
private String CreateKeySet(Int32 CountKeys)
{
@@ -527,9 +527,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
string postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
String postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
Byte[] byte1 = encoding.GetBytes(postData);
// Set the content type of the data being posted.
http.ContentType = "application/json; charset=utf-8";
@@ -577,17 +577,17 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public partial class Key
{
[JsonProperty("Index")]
public long Index { get; set; }
public Int64 Index { get; set; }
[JsonProperty("Key")]
public string KeyKey { get; set; }
public String KeyKey { get; set; }
}
public partial class MeterPw
{
public static MeterPw Empty() => new MeterPw() { SetId = Guid.Empty, Keys = new List<Key>() };
public static MeterPw FromJson(string json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(string json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
public static MeterPw FromJson(String json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(String json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
}
@@ -1,7 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -19,6 +18,7 @@ using Xylem.Common.CommonCore.Exceptions.WaterMeter;
using Xylem.Common.CommonCore.Exceptions.Web;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
using Xylem.Common.Logic.ServiceCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Service.MeterProcessState.Controllers
@@ -35,7 +35,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("SetPassword"), HttpGet]
public async Task<HttpResponseMessage> SetPassword(String PcbId, String password, bool keepOldPw = false)
public async Task<HttpResponseMessage> SetPassword(String PcbId, String password, Boolean keepOldPw = false)
{
try
{
@@ -68,7 +68,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
public class PwProcessorId
{
public PwProcessorId(string password, UInt64? processorId = null)
public PwProcessorId(String password, UInt64? processorId = null)
{
Password = password;
ProcessorId = processorId;
@@ -76,7 +76,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
public PwProcessorId(string password)
public PwProcessorId(String password)
{
Password = password;
}
@@ -86,7 +86,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
public UInt64? ProcessorId;
public string Password;
public String Password;
}
public String BuildSkeletonKey(UInt64 processorUid)
@@ -238,14 +238,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetPassword")]
public async Task<HttpResponseMessage> GetPassword(String PcbId, int Llv = 8)
public async Task<HttpResponseMessage> GetPassword(String PcbId, Int32 Llv = 8)
{
try
{
var returnPw = "Not assigned";
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
string selectQuery = $"select [password] , [isLocked],[KeySetId] ,[orderNumber],[radioAdress] from dbo.Genesis_PcbPassword where PcbId like '{PcbId}'";
String selectQuery = $"select [password] , [isLocked],[KeySetId] ,[orderNumber],[radioAdress] from dbo.Genesis_PcbPassword where PcbId like '{PcbId}'";
var dt = dataAccess.ExecuteQuery(selectQuery);
if (dt.Rows.Count == 0)
{
@@ -283,7 +283,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
foreach (var item in dt.Select())
{
returnPw = item["password"].ToString();
if (!(bool)item["isLocked"])
if (!(Boolean)item["isLocked"])
{
return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return returnPw; }));
}
@@ -329,15 +329,15 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public Int64? orderNumber = null;
public Int64? radioAdress = null;
public string Skeleton = "";
public List<byte[]> listOfHashes = new List<byte[]>();
public List<byte[]> listOfPasswords = new List<byte[]>();
public String Skeleton = "";
public List<Byte[]> listOfHashes = new List<Byte[]>();
public List<Byte[]> listOfPasswords = new List<Byte[]>();
public string KeySetId { get; internal set; }
public String KeySetId { get; internal set; }
}
private MeterPw getKeys(string Token, string orderNumber, string radioAdress)
private MeterPw getKeys(String Token, String orderNumber, String radioAdress)
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =>
@@ -349,14 +349,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var Url = $"https://nodes.sms-esaap.com:8081/api/v3/custom/keysetkeys?orderNumber={orderNumber}&radioAdress={radioAdress}";
//Url = $"https://nodes.sms-esaap.com:8081/api/v3/custom/keysetkeys?setId={orderNumber}&radioAdress={radioAdress}";//
var header = new Dictionary<string, string>();
var header = new Dictionary<String, String>();
header.Add("Cache-Control", "no-cache");
header.Add("X-Node-Token", Token);//"d5b8c0b2-81f6-4421-80d0-44eb2093e616");
try
{
var responseJson = LocalWebRequest.GetRequest(Url: Url, Header: header, TimeoutMS: 20000);
var responseJson = LocalWebRequest.GetRequest(url: Url, header: header, timeoutMs: 20000);
responseJson = responseJson.Trim('"');
return MeterPw.FromJson(responseJson);
@@ -374,7 +374,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
try
{
var listOfHashes = new List<byte[]>();
var listOfHashes = new List<Byte[]>();
var sbOutPut = new StringBuilder();
var sbQuery = new StringBuilder();
@@ -415,10 +415,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
result.orderNumber = (Int32)item["FertigungsauftragNr"];
result.radioAdress = (Int64)item["Adresse"];
result.Skeleton = (string)item["Skeleton"];
result.Skeleton = (String)item["Skeleton"];
if (item["KeySetId"].GetType() != typeof(System.DBNull))
{
result.KeySetId = (string)item["KeySetId"];
result.KeySetId = (String)item["KeySetId"];
}
@@ -490,7 +490,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
private string MapKeySet(string Token, string KeySetID, Int64 MeterOrderNumber, Int64 MeterRadioAdress)
private String MapKeySet(String Token, String KeySetID, Int64 MeterOrderNumber, Int64 MeterRadioAdress)
{
try
@@ -499,7 +499,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
//keysets
var Url = $"{ServiceUrls.KeyServerCustom()}keysetkeys/";
Url = "https://nodes.sms-esaap.com/keygenproxy/api/v3/custom/keysets/devices";
var header = new Dictionary<string, string>();
var header = new Dictionary<String, String>();
header.Add("Cache-Control", "no-cache");
header.Add("X-Node-Token", Token);//"d5b8c0b2-81f6-4421-80d0-44eb2093e616");
@@ -512,7 +512,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var helpArray = new List<MapKeySetItem>() { postData };
return LocalWebRequest.PostRequestAsyncAndGetContent(Url: Url, Header: header, json: helpArray.ToArray(), TimeoutMS: 20000);
return LocalWebRequest.PostRequestAsyncAndGetContent(url: Url, header: header, json: helpArray.ToArray(), timeoutMs: 20000);
}
catch (Exception)
{
@@ -525,14 +525,14 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class MapKeySetItem
{
public string setId { get; set; }
public string orderNumber { get; set; }
public string radioAdress { get; set; }
public String setId { get; set; }
public String orderNumber { get; set; }
public String radioAdress { get; set; }
}
private string CreateKeySet(string Token, int CountKeys)
private String CreateKeySet(String Token, Int32 CountKeys)
{
@@ -550,9 +550,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
string postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
String postData = $"{{\"setCount\": 1,\"keysPerSet\": {CountKeys} }}";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
Byte[] byte1 = encoding.GetBytes(postData);
// Set the content type of the data being posted.
http.ContentType = "application/json; charset=utf-8";
@@ -600,17 +600,17 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public partial class Key
{
[JsonProperty("Index")]
public long Index { get; set; }
public Int64 Index { get; set; }
[JsonProperty("Key")]
public string KeyKey { get; set; }
public String KeyKey { get; set; }
}
public partial class MeterPw
{
public static MeterPw Empty() => new MeterPw() { SetId = Guid.Empty, Keys = new List<Key>() };
public static MeterPw FromJson(string json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(string json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
public static MeterPw FromJson(String json) => JsonConvert.DeserializeObject<MeterPw>(json, Converter.Settings);
public static MeterPw[] ArrayFromJson(String json) => JsonConvert.DeserializeObject<MeterPw[]>(json, Converter.Settings);
}
@@ -1,5 +1,4 @@
using Logic.ProductionToProductMapper.Cordonel;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -12,6 +11,7 @@ using System.Web.Http;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.ProcessState;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Logic.ServiceCore;
namespace Service.MeterProcessState.Controllers
{
@@ -22,7 +22,7 @@ namespace Service.MeterProcessState.Controllers
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -146,7 +146,7 @@ namespace Service.MeterProcessState.Controllers
[Route("GetPressureStateDetailed"), HttpGet]
public async Task<HttpResponseMessage> GetPressureStateDetailed(int PcbId, int? TopCount = null)
public async Task<HttpResponseMessage> GetPressureStateDetailed(Int32 PcbId, Int32? TopCount = null)
{
try
{
@@ -228,7 +228,7 @@ namespace Service.MeterProcessState.Controllers
{
var add = new PressureResultData();
add.LeakRate = drMain["CordonelPressureTestHe_LeakRate"].ToString();
add.Passed = (bool)drMain["CordonelPressureTest_Valid"];
add.Passed = (Boolean)drMain["CordonelPressureTest_Valid"];
add.PcbId = drMain["CordonelPressureTest_PcbId"].ToString();
add.Remark = drMain["CordonelPressureTest_Text"].ToString();
add.Rev = 1;
@@ -236,7 +236,7 @@ namespace Service.MeterProcessState.Controllers
add.TestPressure = drMain["CordonelPressureTestHe_TestPressure"].ToString();
var testID = (int)drMain["CordonelPressureTest_Id"];
var testID = (Int32)drMain["CordonelPressureTest_Id"];
add.TestPoints = new List<PressureTestPoints>();
foreach (var drTestPoints in dtTestPoints.Select($"CordonelPressureTest_Id = {testID}"))
{
@@ -245,7 +245,7 @@ namespace Service.MeterProcessState.Controllers
add.TestPoints.Add(
new PressureTestPoints()
{
Ident = (int)drTestPoints["CordonelPressureTest_TestPointNr"],
Ident = (Int32)drTestPoints["CordonelPressureTest_TestPointNr"],
Input = drTestPoints["CordonelPressureTest_TestPointResult"].ToString()
});
}
@@ -271,14 +271,14 @@ namespace Service.MeterProcessState.Controllers
[Route("SetPressureState"), HttpPost]
public async Task<HttpResponseMessage> SetPressureState(string PcbId, int FertigungsauftragsNr, [FromBody]PressureTestResult testResult)
public async Task<HttpResponseMessage> SetPressureState(String PcbId, Int32 FertigungsauftragsNr, [FromBody]PressureTestResult testResult)
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var query = new StringBuilder();
string ResultText = testResult.Passed ? "1" : "0";
String ResultText = testResult.Passed ? "1" : "0";
query.AppendLine("INSERT INTO [dbo].[Cordonel_PressureTest]");
query.AppendLine(" ( ");
query.AppendLine(" [CordonelPressureTest_PcbId] ");
@@ -325,7 +325,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("SetPickingState"), HttpPost]
public async Task<HttpResponseMessage> SetPickingState(string PcbId, int FertigungsauftragsNr)
public async Task<HttpResponseMessage> SetPickingState(String PcbId, Int32 FertigungsauftragsNr)
{
try
{
@@ -382,7 +382,7 @@ namespace Service.MeterProcessState.Controllers
[Route("setState"), HttpPost]
public async Task<HttpResponseMessage> setState(string PcbId, int code, string version)
public async Task<HttpResponseMessage> setState(String PcbId, Int32 code, String version)
{
try
{
@@ -458,7 +458,7 @@ namespace Service.MeterProcessState.Controllers
[Route("GetLastState")]
public async Task<HttpResponseMessage> GetState(string PcbId)
public async Task<HttpResponseMessage> GetState(String PcbId)
{
try
{
@@ -480,7 +480,7 @@ namespace Service.MeterProcessState.Controllers
}
}
private System.Data.DataTable GetStateDt(string PcbId, int? top = 1)
private System.Data.DataTable GetStateDt(String PcbId, Int32? top = 1)
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
@@ -493,7 +493,7 @@ namespace Service.MeterProcessState.Controllers
[Route("GetState")]
public async Task<HttpResponseMessage> GetState(string PcbId, int? top = 1)
public async Task<HttpResponseMessage> GetState(String PcbId, Int32? top = 1)
{
try
{
@@ -513,7 +513,7 @@ namespace Service.MeterProcessState.Controllers
[Route("setSapState"), HttpPost]
public async Task<HttpResponseMessage> setSapState(string PcbId, int code, string version = "-")
public async Task<HttpResponseMessage> setSapState(String PcbId, Int32 code, String version = "-")
{
try
{
@@ -533,7 +533,7 @@ namespace Service.MeterProcessState.Controllers
/// <param name="code"></param>
/// <param name="version"></param>
/// <returns>true for new ones fals for exstinsting</returns>
private static bool SaveSapState(string PcbId, int code, string version)
private static Boolean SaveSapState(String PcbId, Int32 code, String version)
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
@@ -572,7 +572,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("GetCordonelAppVersion")]
public async Task<HttpResponseMessage> GetCordonelAppVersion(string PcbId, bool returnRadioFRQ = false)
public async Task<HttpResponseMessage> GetCordonelAppVersion(String PcbId, Boolean returnRadioFRQ = false)
{
try
{
@@ -595,10 +595,10 @@ namespace Service.MeterProcessState.Controllers
var dt = dataacces.ExecuteQuery(sb.ToString());
foreach (var item in dt.Select())
{
bool a = false;
Boolean a = false;
try
{
a = (bool)item["IsUpdatable"];
a = (Boolean)item["IsUpdatable"];
}
catch (Exception)
{
@@ -606,7 +606,7 @@ namespace Service.MeterProcessState.Controllers
}
AppVersionDic.Add(new CordonelAppVersion((int)item["AppId"], item["Version"].ToString(), a));
AppVersionDic.Add(new CordonelAppVersion((Int32)item["AppId"], item["Version"].ToString(), a));
}
}
@@ -620,7 +620,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("SetCordonelProgress"), HttpPost]
public async Task<HttpResponseMessage> SetCordonelProgress(int PcbId, string ProgressName, string version, [FromBody] List<CordonelAppVersion> AppVersionDic)
public async Task<HttpResponseMessage> SetCordonelProgress(Int32 PcbId, String ProgressName, String version, [FromBody] List<CordonelAppVersion> AppVersionDic)
{
try
@@ -665,7 +665,7 @@ namespace Service.MeterProcessState.Controllers
[Route("TaskKillByTime")]
public async Task<HttpResponseMessage> TaskKillByTime(int seconds = 300)
public async Task<HttpResponseMessage> TaskKillByTime(Int32 seconds = 300)
{
try
{
@@ -691,7 +691,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("GetCordonelSkipProcessStates")]
public async Task<HttpResponseMessage> GetCordonelSkipProcessStates(int PcbId, int OrderNumber)
public async Task<HttpResponseMessage> GetCordonelSkipProcessStates(Int32 PcbId, Int32 OrderNumber)
{
try
{
@@ -732,10 +732,10 @@ namespace Service.MeterProcessState.Controllers
{
ret.OrderNumber = OrderNumber;
ret.PcbId = PcbId;
ret.SkipRadioParameters = (bool)item["SkipRadioParameters"];
ret.SkipFWCheck = (bool)item["SkipFWCheck"];
ret.SkipBatteyCheck = (bool)item["SkipBatteyCheck"];
ret.SkipLUT = (bool)item["SkipLUT"];
ret.SkipRadioParameters = (Boolean)item["SkipRadioParameters"];
ret.SkipFWCheck = (Boolean)item["SkipFWCheck"];
ret.SkipBatteyCheck = (Boolean)item["SkipBatteyCheck"];
ret.SkipLUT = (Boolean)item["SkipLUT"];
ret.Date = (DateTime)item["Date"];
ret.Name = item["Name"].ToString();
}
@@ -1,6 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -24,7 +23,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -46,11 +45,11 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// </summary>
/// <param name="VakoCode"></param>
/// <returns>Dictinary with key-value pairs</returns>
private Dictionary<string, string> GetVakoMerkmale(string VakoCode)
private Dictionary<String, String> GetVakoMerkmale(String VakoCode)
{
string sql = string.Format("SELECT distinct * FROM Vako_Merkmale WHERE Basis = SUBSTRING('{0}',1,len(Basis)) AND (Charcode = SUBSTRING('{0}', Stelle, Laenge))", VakoCode);
String sql = string.Format("SELECT distinct * FROM Vako_Merkmale WHERE Basis = SUBSTRING('{0}',1,len(Basis)) AND (Charcode = SUBSTRING('{0}', Stelle, Laenge))", VakoCode);
Dictionary<string, string> VakoMerkmale = new Dictionary<string, string>();
Dictionary<String, String> VakoMerkmale = new Dictionary<String, String>();
using (SqlCommand sqlcommand = new SqlCommand(sql, connection))
{
@@ -95,9 +94,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="RSSI_SEMI_Min"></param>
/// <param name="RSSI_SEMI_Max"></param>
/// <returns></returns>
private bool GetLimitsFromDB(Int16 Frequenz, Int16 Nennweite, Int16 Baulaenge, Int16 BoxHead, int Variant_o, int Variant_p, out byte RSSI_Pam_Min, out byte RSSI_Pam_Max, out byte RSSI_SEMI_Min, out byte RSSI_SEMI_Max, out UInt32 LimitId)
private Boolean GetLimitsFromDB(Int16 Frequenz, Int16 Nennweite, Int16 Baulaenge, Int16 BoxHead, Int32 Variant_o, Int32 Variant_p, out Byte RSSI_Pam_Min, out Byte RSSI_Pam_Max, out Byte RSSI_SEMI_Min, out Byte RSSI_SEMI_Max, out UInt32 LimitId)
{
string sql = $"SELECT top 1 * FROM [Cordonel_Radio_RSSI_Limits] WHERE [Box_Head]={BoxHead} and [Frequency] = {Frequenz} and [Nennweite] = {Nennweite} and ([Baulaenge] = {Baulaenge} or [Baulaenge] = 0) order by id desc "; //and [Variant_o] = {Variant_o} and [Variant_p] = {Variant_p} ";
String sql = $"SELECT top 1 * FROM [Cordonel_Radio_RSSI_Limits] WHERE [Box_Head]={BoxHead} and [Frequency] = {Frequenz} and [Nennweite] = {Nennweite} and ([Baulaenge] = {Baulaenge} or [Baulaenge] = 0) order by id desc "; //and [Variant_o] = {Variant_o} and [Variant_p] = {Variant_p} ";
using (SqlCommand sqlcommand = new SqlCommand(sql, connection))
{
@@ -132,13 +131,13 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="OrderNr">FertigungausftragNr</param>
/// <returns></returns>
[Route("GetLimits/{BoxHead}/{OrderNr}")]
public JsonResult<JObject> GetLimits(Int16 BoxHead, int OrderNr)
public JsonResult<JObject> GetLimits(Int16 BoxHead, Int32 OrderNr)
{
JObject jsonData = new JObject();
//try
//{
string sql = $"SELECT * from AlleAuftragPositionen INNER JOIN IdentNr on AlleAuftragPositionen.IdentNr = IdentNr.IdentNr " +
String sql = $"SELECT * from AlleAuftragPositionen INNER JOIN IdentNr on AlleAuftragPositionen.IdentNr = IdentNr.IdentNr " +
$"WHERE FertigungsauftragNr = {OrderNr.ToString()}";
using (SqlCommand sqlcommand = new SqlCommand(sql, connection))
@@ -156,26 +155,26 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
// Get the first row
DataRow row = dataTable.Rows[0];
string VakoCode = row["VakoCode"].ToString();
String VakoCode = row["VakoCode"].ToString();
Dictionary<string, string> VakoMerkmale = GetVakoMerkmale(VakoCode);
Dictionary<String, String> VakoMerkmale = GetVakoMerkmale(VakoCode);
string mf;
String mf;
mf = row["IdentNr"].ToString();
Int16 Baulaenge = Convert.ToInt16(VakoMerkmale["Baulaenge"]);
Int16 Nennweite = Convert.ToInt16(VakoMerkmale["Nennweite"]);
Int16 Frequenz = Convert.ToInt16(VakoMerkmale["RADIO"]);
string RadiokeyArt;
String RadiokeyArt;
RadiokeyArt = VakoMerkmale["RADIO"];
jsonData.Add("Vako", JsonConvert.SerializeObject(VakoMerkmale, Formatting.None));
byte RSSI_Pam_Min;
byte RSSI_Pam_Max;
byte RSSI_SEMI_Min;
byte RSSI_SEMI_Max;
Byte RSSI_Pam_Min;
Byte RSSI_Pam_Max;
Byte RSSI_SEMI_Min;
Byte RSSI_SEMI_Max;
UInt32 LimitId;
if (GetLimitsFromDB(Convert.ToInt16(Frequenz), Nennweite, Baulaenge, BoxHead, true ? 1 : 0, false ? 1 : 0, out RSSI_Pam_Min, out RSSI_Pam_Max, out RSSI_SEMI_Min, out RSSI_SEMI_Max, out LimitId))
{
@@ -196,10 +195,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public class SaveDataClass
{
public UInt32 RadioAdress { get; set; }
public byte RSSI_PAM { get; set; }
public byte RSSI_SEMI { get; set; }
public int LimitId { get; set; }
public byte Result { get; set; }
public Byte RSSI_PAM { get; set; }
public Byte RSSI_SEMI { get; set; }
public Int32 LimitId { get; set; }
public Byte Result { get; set; }
}
@@ -1,6 +1,5 @@
using ByteArrayStyle;
using Logic.ProductionToProductMapper.Cordonel;
using Service.Core;
using System;
using System.Collections.Generic;
using System.Data;
@@ -11,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
using Xylem.Common.Logic.ServiceCore;
namespace Service.MeterProcessState.Controllers
{
@@ -21,7 +21,7 @@ namespace Service.MeterProcessState.Controllers
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -30,7 +30,7 @@ namespace Service.MeterProcessState.Controllers
[Route("GetRegisterHistory"), HttpGet]
public async Task<HttpResponseMessage> GetRegisterHistory(string PcbID, string Address)
public async Task<HttpResponseMessage> GetRegisterHistory(String PcbID, String Address)
{
try
{
@@ -65,7 +65,7 @@ namespace Service.MeterProcessState.Controllers
foreach (DataRow row in dt.Rows)
{
var adressP =ByteStyler.Parse(row["Address"].ToString(), false);
var value = new byte[] { };
var value = new Byte[] { };
if (row["Value"].ToString() != "NULL")
{
@@ -82,7 +82,7 @@ namespace Service.MeterProcessState.Controllers
{
value = null;
}
ret.Add(new RegisterHistory((string)row["PcbId"], adressP, value, (DateTime)row["date"]));
ret.Add(new RegisterHistory((String)row["PcbId"], adressP, value, (DateTime)row["date"]));
}
}
return ret;
@@ -97,7 +97,7 @@ namespace Service.MeterProcessState.Controllers
[Route("RegisterWrite"), HttpPost]
public async Task<HttpResponseMessage> RegisterWrite(string PcbID, string Address, string value)
public async Task<HttpResponseMessage> RegisterWrite(String PcbID, String Address, String value)
{
try
{
@@ -116,7 +116,7 @@ namespace Service.MeterProcessState.Controllers
[Route("FullRegisters"), HttpPost]
public async Task<HttpResponseMessage> FullRegisters(string PcbID, [FromBody] List<RegisterToDb> MeterRegisterDic)
public async Task<HttpResponseMessage> FullRegisters(String PcbID, [FromBody] List<RegisterToDb> MeterRegisterDic)
{
try
{
@@ -1,10 +1,11 @@
using Service.Core;
using System;
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Service.MeterProcessState.Controllers
{
[RoutePrefix("api/SoftwareAccess")]
@@ -13,18 +14,18 @@ namespace Service.MeterProcessState.Controllers
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
}
[Route("GetVersionIsValid"), HttpGet]
public async Task<HttpResponseMessage> GetVersionIsValid(string Program, int Major, int Minor, int Build)
public async Task<HttpResponseMessage> GetVersionIsValid(String Program, Int32 Major, Int32 Minor, Int32 Build)
{
try
{
bool grant = false;
Boolean grant = false;
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var query = new StringBuilder();
@@ -56,11 +57,11 @@ namespace Service.MeterProcessState.Controllers
}
[Route("GetCurrentVersion"), HttpGet]
public async Task<HttpResponseMessage> GetCurrentVersion(string Program)
public async Task<HttpResponseMessage> GetCurrentVersion(String Program)
{
try
{
bool grant = false;
Boolean grant = false;
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var query = new StringBuilder();
@@ -99,11 +100,11 @@ namespace Service.MeterProcessState.Controllers
//
[Route("SetVersionIsValid"), HttpPost]
public async Task<HttpResponseMessage> SetVersionIsValid(string Program, int Major, int Minor, int Build, DateTime ValidTo, string Description, bool ProgramNameIsUnique = true)
public async Task<HttpResponseMessage> SetVersionIsValid(String Program, Int32 Major, Int32 Minor, Int32 Build, DateTime ValidTo, String Description, Boolean ProgramNameIsUnique = true)
{
try
{
bool grant = false;
Boolean grant = false;
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var query = new StringBuilder();
@@ -17,7 +17,7 @@ namespace Service.MeterProcessState.Controllers
public class TempFlangeController : ApiController
{
[Route("GetLut"),HttpGet]
public async Task<List<CordonelTempLut>> GetLut(int PcbId)
public async Task<List<CordonelTempLut>> GetLut(Int32 PcbId)
{
try
{
@@ -47,7 +47,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("AddLut"), HttpPost]
public async Task<bool> AddLut(int PcbId, double RefTempC, double AvgTof)
public async Task<Boolean> AddLut(Int32 PcbId, Double RefTempC, Double AvgTof)
{
try
{
@@ -654,15 +654,15 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class OrderDetailsData
{
public int AuftragNr { get; set; }
public int PositionNr { get; set; }
public int FertigungsauftragNr { get; set; }
public int SerienNr { get; set; }
public int Frequenz { get; set; }
public Int32 AuftragNr { get; set; }
public Int32 PositionNr { get; set; }
public Int32 FertigungsauftragNr { get; set; }
public Int32 SerienNr { get; set; }
public Int32 Frequenz { get; set; }
public Int64 Adresse { get; set; }
public int? CordonelAssignedPicking_PcbId { get; set; }
public Int32? CordonelAssignedPicking_PcbId { get; set; }
public DateTimeOffset? CordonelAssignedPicking_Date { get; set; }
public int? MapPcbIdToSerialNumber_SerialNumber { get; set; }
public Int32? MapPcbIdToSerialNumber_SerialNumber { get; set; }
public DateTimeOffset? MapPcbIdToSerialNumber_DateUtc { get; set; }
}
@@ -675,20 +675,20 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class Dataset
{
public int[] borderDash;
public Int32[] borderDash;
public string label { get; set; }
public string borderColor { get; set; }
public string backgroundColor { get; set; }
public bool fill { get; set; }
public List<double?> data { get; set; }
public string yAxisID { get; set; }
public bool spanGaps { get; set; }
public String label { get; set; }
public String borderColor { get; set; }
public String backgroundColor { get; set; }
public Boolean fill { get; set; }
public List<Double?> data { get; set; }
public String yAxisID { get; set; }
public Boolean spanGaps { get; set; }
}
public class Root
{
public List<float> labels { get; set; }
public List<Single> labels { get; set; }
public List<Dataset> datasets { get; set; }
}
@@ -696,28 +696,28 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class GridLines
{
public bool drawOnChartArea { get; set; }
public Boolean drawOnChartArea { get; set; }
}
public class MyArray
{
public string type { get; set; }
public bool display { get; set; }
public string position { get; set; }
public string id { get; set; }
public String type { get; set; }
public Boolean display { get; set; }
public String position { get; set; }
public String id { get; set; }
public GridLines gridLines { get; set; }
}
private string getSingleMeterColor(int Path = 0, int? Repnullbale = 0)
private String getSingleMeterColor(Int32 Path = 0, Int32? Repnullbale = 0)
{
int Rep = Repnullbale.HasValue ? Repnullbale.Value : 0;
Int32 Rep = Repnullbale.HasValue ? Repnullbale.Value : 0;
var index = ((Path * 10) + Rep);
return new string[] {
return new String[] {
//Display offset 0
"#BFD200",
"#007F5F",
@@ -766,12 +766,12 @@ namespace Service.MeterProcessState.Controllers
}
private string getMeterColor(int Meter, int metercount, int Rep)
private String getMeterColor(Int32 Meter, Int32 metercount, Int32 Rep)
{
var maxRep = 400 / metercount;
var index = ((Meter - 1) * maxRep) + Rep;
return new string[] {
return new String[] {
"#B0171F",
"#FFAEB9",
"#8B8386",
@@ -1,10 +1,10 @@
using Service.Core;
using System;
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xylem.Common.Logic.ServiceCore;
namespace Xylem.Common.Service.MeterProcessState.Controllers
{
@@ -14,7 +14,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
public static class GlobalConfig
{
public static Lazy<string> connectionString = new Lazy<string>(()
public static Lazy<String> connectionString = new Lazy<String>(()
=>
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
);
@@ -27,7 +27,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
///
/// <returns></returns>
[Route("SetMeterLogPathInfo"), HttpGet]
public async Task<HttpResponseMessage> SetMeterLogPathInfo(int SerialNumber, int? TestRunId =null, int? CalibrationRunId = null, string BasePath = "", string MainLogName = "", string LEDName = "" )
public async Task<HttpResponseMessage> SetMeterLogPathInfo(Int32 SerialNumber, Int32? TestRunId =null, Int32? CalibrationRunId = null, String BasePath = "", String MainLogName = "", String LEDName = "" )
{
try
@@ -75,7 +75,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
/// <param name="PcbID">PcbID from Meter</param>
/// <returns></returns>
[Route("GetMeterInfoForTestBench"), HttpGet]
public async Task<HttpResponseMessage> GetMeterInfoForTestBench(string PcbID)
public async Task<HttpResponseMessage> GetMeterInfoForTestBench(String PcbID)
{
try
@@ -1,5 +1,4 @@
using Service.Core;
using Service.MeterProcessState.Data;
using Service.MeterProcessState.Data;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -20,7 +19,7 @@ namespace Service.MeterProcessState.Controllers
{
[Route("GetCalibrationResult")]
[System.Web.Http.HttpGet]
public async Task<string> GetCalibrationResult(int SerialNumber)
public async Task<String> GetCalibrationResult(Int32 SerialNumber)
{
using (AuftragContext ctx = new AuftragContext())
@@ -734,15 +733,15 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class OrderDetailsData
{
public int AuftragNr { get; set; }
public int PositionNr { get; set; }
public int FertigungsauftragNr { get; set; }
public int SerienNr { get; set; }
public int Frequenz { get; set; }
public Int32 AuftragNr { get; set; }
public Int32 PositionNr { get; set; }
public Int32 FertigungsauftragNr { get; set; }
public Int32 SerienNr { get; set; }
public Int32 Frequenz { get; set; }
public Int64 Adresse { get; set; }
public int? CordonelAssignedPicking_PcbId { get; set; }
public Int32? CordonelAssignedPicking_PcbId { get; set; }
public DateTimeOffset? CordonelAssignedPicking_Date { get; set; }
public int? MapPcbIdToSerialNumber_SerialNumber { get; set; }
public Int32? MapPcbIdToSerialNumber_SerialNumber { get; set; }
public DateTimeOffset? MapPcbIdToSerialNumber_DateUtc { get; set; }
}
@@ -755,20 +754,20 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class Dataset
{
public int[] borderDash;
public Int32[] borderDash;
public string label { get; set; }
public string borderColor { get; set; }
public string backgroundColor { get; set; }
public bool fill { get; set; }
public List<double?> data { get; set; }
public string yAxisID { get; set; }
public bool spanGaps { get; set; }
public String label { get; set; }
public String borderColor { get; set; }
public String backgroundColor { get; set; }
public Boolean fill { get; set; }
public List<Double?> data { get; set; }
public String yAxisID { get; set; }
public Boolean spanGaps { get; set; }
}
public class Root
{
public List<float> labels { get; set; }
public List<Single> labels { get; set; }
public List<Dataset> datasets { get; set; }
}
@@ -776,28 +775,28 @@ namespace Service.MeterProcessState.Controllers
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class GridLines
{
public bool drawOnChartArea { get; set; }
public Boolean drawOnChartArea { get; set; }
}
public class MyArray
{
public string type { get; set; }
public bool display { get; set; }
public string position { get; set; }
public string id { get; set; }
public String type { get; set; }
public Boolean display { get; set; }
public String position { get; set; }
public String id { get; set; }
public GridLines gridLines { get; set; }
}
private string getSingleMeterColor(int Path = 0, int? Repnullbale = 0)
private String getSingleMeterColor(Int32 Path = 0, Int32? Repnullbale = 0)
{
int Rep = Repnullbale.HasValue ? Repnullbale.Value : 0;
Int32 Rep = Repnullbale.HasValue ? Repnullbale.Value : 0;
var index = ((Path * 10) + Rep);
return new string[] {
return new String[] {
//Display offset 0
"#BFD200",
"#007F5F",
@@ -846,12 +845,12 @@ namespace Service.MeterProcessState.Controllers
}
private string getMeterColor(int Meter,int metercount, int Rep)
private String getMeterColor(Int32 Meter,Int32 metercount, Int32 Rep)
{
var maxRep = 400 / metercount ;
var index = ((Meter -1) * maxRep) + Rep;
return new string[] {
return new String[] {
"#B0171F",
"#FFAEB9",
"#8B8386",
@@ -6,14 +6,14 @@ namespace Service.MeterProcessState.Data
{
public partial class Auftrag : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int AuftragNr { get; set; }
public int KundenNr { get; set; }
public short MitarbeiterNr { get; set; }
public Int32 AuftragNr { get; set; }
public Int32 KundenNr { get; set; }
public Int16 MitarbeiterNr { get; set; }
public DateTime? BarcodeDruckDatum { get; set; }
public DateTime? AnlageDatum { get; set; }
public short AnlageMitarbeiterNr { get; set; }
public Int16 AnlageMitarbeiterNr { get; set; }
public DateTime? AenderungDatum { get; set; }
public short? AenderungMitarbeiterNr { get; set; }
public Int16? AenderungMitarbeiterNr { get; set; }
public DateTime? AuftragAbgeschlossen { get; set; }
}
}
@@ -5,40 +5,40 @@ namespace Service.MeterProcessState.Data
{
public partial class AuftragPosition : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int AuftragNr { get; set; }
public short PositionNr { get; set; }
public int? Menge { get; set; }
public short? Tlmenge { get; set; }
public int? VerfuegbareMenge { get; set; }
public string Kennzeichen { get; set; }
public int? IdentNr { get; set; }
public string Kennzeichen2 { get; set; }
public int? Wert { get; set; }
public Int32 AuftragNr { get; set; }
public Int16 PositionNr { get; set; }
public Int32? Menge { get; set; }
public Int16? Tlmenge { get; set; }
public Int32? VerfuegbareMenge { get; set; }
public String Kennzeichen { get; set; }
public Int32? IdentNr { get; set; }
public String Kennzeichen2 { get; set; }
public Int32? Wert { get; set; }
public DateTime? VersandDatum { get; set; }
public string Kw { get; set; }
public String Kw { get; set; }
public DateTime? BestaetigterLt { get; set; }
public string Bezeichnung { get; set; }
public string ZusatzText { get; set; }
public string Bohrung { get; set; }
public short? Impulswert1 { get; set; }
public short? Impulswert2 { get; set; }
public string Anzeige { get; set; }
public string Farbe { get; set; }
public string Deckel { get; set; }
public int? Kzp { get; set; }
public short? Kzpversion { get; set; }
public short? Kzpoption { get; set; }
public string Metrolog { get; set; }
public bool SerienNr { get; set; }
public int? SerienNrVon { get; set; }
public int? SerienNrBis { get; set; }
public short? MitarbeiterNr { get; set; }
public String Bezeichnung { get; set; }
public String ZusatzText { get; set; }
public String Bohrung { get; set; }
public Int16? Impulswert1 { get; set; }
public Int16? Impulswert2 { get; set; }
public String Anzeige { get; set; }
public String Farbe { get; set; }
public String Deckel { get; set; }
public Int32? Kzp { get; set; }
public Int16? Kzpversion { get; set; }
public Int16? Kzpoption { get; set; }
public String Metrolog { get; set; }
public Boolean SerienNr { get; set; }
public Int32? SerienNrVon { get; set; }
public Int32? SerienNrBis { get; set; }
public Int16? MitarbeiterNr { get; set; }
public DateTime? AnlageDatum { get; set; }
public short? AnlageMitarbeiterNr { get; set; }
public Int16? AnlageMitarbeiterNr { get; set; }
public DateTime? AenderungDatum { get; set; }
public short? AenderungMitarbeiterNr { get; set; }
public Int16? AenderungMitarbeiterNr { get; set; }
public DateTime? MavExport { get; set; }
public bool UnReguliert { get; set; }
public Boolean UnReguliert { get; set; }
public DateTime? AIstTermin { get; set; }
public DateTime? LSollTermin { get; set; }
public DateTime? LIstTermin { get; set; }
@@ -52,72 +52,72 @@ namespace Service.MeterProcessState.Data
public DateTime? RIstTermin { get; set; }
public DateTime? DIstTermin { get; set; }
public DateTime? DRfvIstTermin { get; set; }
public short? FertMeldAtermMa { get; set; }
public Int16? FertMeldAtermMa { get; set; }
public DateTime? FertMeldAtermDat { get; set; }
public short? FertMeldLtermMa { get; set; }
public Int16? FertMeldLtermMa { get; set; }
public DateTime? FertMeldLtermDat { get; set; }
public short? FertMeldVtermMa { get; set; }
public Int16? FertMeldVtermMa { get; set; }
public DateTime? FertMeldVtermDat { get; set; }
public short? FertMeldEtermMa { get; set; }
public Int16? FertMeldEtermMa { get; set; }
public DateTime? FertMeldEtermDat { get; set; }
public short? FertMeldMtermMa { get; set; }
public Int16? FertMeldMtermMa { get; set; }
public DateTime? FertMeldMtermDat { get; set; }
public short? FertMeldPtermMa { get; set; }
public Int16? FertMeldPtermMa { get; set; }
public DateTime? FertMeldPtermDat { get; set; }
public short? FertMeldRtermMa { get; set; }
public Int16? FertMeldRtermMa { get; set; }
public DateTime? FertMeldRtermDat { get; set; }
public short? FertMeldDtermMa { get; set; }
public Int16? FertMeldDtermMa { get; set; }
public DateTime? FertMeldDtermDat { get; set; }
public short? FertMeldDRfvtermMa { get; set; }
public Int16? FertMeldDRfvtermMa { get; set; }
public DateTime? FertMeldDRfvtermDat { get; set; }
public short? FertMeldGtermMa { get; set; }
public Int16? FertMeldGtermMa { get; set; }
public DateTime? FertMeldGtermDat { get; set; }
public string BemFertigung { get; set; }
public string Ort { get; set; }
public short? Gruppe { get; set; }
public int? FertigungsauftragNr { get; set; }
public bool Barcode { get; set; }
public String BemFertigung { get; set; }
public String Ort { get; set; }
public Int16? Gruppe { get; set; }
public Int32? FertigungsauftragNr { get; set; }
public Boolean Barcode { get; set; }
public DateTime? RechnungDatum { get; set; }
public string SnrUpdateKz { get; set; }
public byte? Protokoll { get; set; }
public short? Pruefung { get; set; }
public int? KundenNr { get; set; }
public String SnrUpdateKz { get; set; }
public Byte? Protokoll { get; set; }
public Int16? Pruefung { get; set; }
public Int32? KundenNr { get; set; }
public DateTime? VersandIstDatum { get; set; }
public DateTime? VersandPlanDatum { get; set; }
public short? Versandmonat { get; set; }
public float? Kwdifferenz { get; set; }
public float? LaufzeitAuftrag { get; set; }
public Int16? Versandmonat { get; set; }
public Single? Kwdifferenz { get; set; }
public Single? LaufzeitAuftrag { get; set; }
public DateTime? Eintrag { get; set; }
public bool Lagerauftrag { get; set; }
public double? AblesegenauigkeitK { get; set; }
public string Bestellcode { get; set; }
public bool PrfNachMid { get; set; }
public int? Doppelimpulssperre { get; set; }
public string Lagerort { get; set; }
public int? TlmengeA { get; set; }
public int? TlmengeV { get; set; }
public int? TlmengeE { get; set; }
public int? TlmengeM { get; set; }
public int? TlmengeP { get; set; }
public int? TlmengeR { get; set; }
public int? TlmengeD { get; set; }
public int? TlmengeDRfv { get; set; }
public int? TlmengeL { get; set; }
public int? TlmengeG { get; set; }
public int? VorgangsnrA { get; set; }
public int? VorgangsnrV { get; set; }
public int? VorgangsnrE { get; set; }
public int? VorgangsnrM { get; set; }
public int? VorgangsnrP { get; set; }
public int? VorgangsnrR { get; set; }
public bool MetrologGesperrt { get; set; }
public bool VersanddatumGesperrt { get; set; }
public bool BestellcodeGesperrt { get; set; }
public int? LeadAufNr { get; set; }
public int? VersandIstMa { get; set; }
public bool? Befundpruefung { get; set; }
public string Kundenmaterialnummer { get; set; }
public bool Eichung { get; set; }
public bool? AnzeigeGesperrt { get; set; }
public Boolean Lagerauftrag { get; set; }
public Double? AblesegenauigkeitK { get; set; }
public String Bestellcode { get; set; }
public Boolean PrfNachMid { get; set; }
public Int32? Doppelimpulssperre { get; set; }
public String Lagerort { get; set; }
public Int32? TlmengeA { get; set; }
public Int32? TlmengeV { get; set; }
public Int32? TlmengeE { get; set; }
public Int32? TlmengeM { get; set; }
public Int32? TlmengeP { get; set; }
public Int32? TlmengeR { get; set; }
public Int32? TlmengeD { get; set; }
public Int32? TlmengeDRfv { get; set; }
public Int32? TlmengeL { get; set; }
public Int32? TlmengeG { get; set; }
public Int32? VorgangsnrA { get; set; }
public Int32? VorgangsnrV { get; set; }
public Int32? VorgangsnrE { get; set; }
public Int32? VorgangsnrM { get; set; }
public Int32? VorgangsnrP { get; set; }
public Int32? VorgangsnrR { get; set; }
public Boolean MetrologGesperrt { get; set; }
public Boolean VersanddatumGesperrt { get; set; }
public Boolean BestellcodeGesperrt { get; set; }
public Int32? LeadAufNr { get; set; }
public Int32? VersandIstMa { get; set; }
public Boolean? Befundpruefung { get; set; }
public String Kundenmaterialnummer { get; set; }
public Boolean Eichung { get; set; }
public Boolean? AnzeigeGesperrt { get; set; }
}
}
@@ -5,26 +5,26 @@ namespace Service.MeterProcessState.Data
{
public partial class AuftragPositionSerienNr : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int SerienNr { get; set; }
public int Pruefgangnr { get; set; }
public int AuftragNr { get; set; }
public short PositionNr { get; set; }
public Int32 SerienNr { get; set; }
public Int32 Pruefgangnr { get; set; }
public Int32 AuftragNr { get; set; }
public Int16 PositionNr { get; set; }
public DateTime? PruefgangDatum { get; set; }
public int? Wiederholungen { get; set; }
public int? Einbauplatz { get; set; }
public string Bemerkung { get; set; }
public Int32? Wiederholungen { get; set; }
public Int32? Einbauplatz { get; set; }
public String Bemerkung { get; set; }
public DateTime? GesichertDatum { get; set; }
public DateTime AnlageDatum { get; set; }
public short AnlageMitarbeiterNr { get; set; }
public Int16 AnlageMitarbeiterNr { get; set; }
public DateTime? AenderungDatum { get; set; }
public short? AenderungMitarbeiterNr { get; set; }
public byte? StatusFertigung { get; set; }
public string Metrolog { get; set; }
public int? FabNr { get; set; }
public byte StatusFlag { get; set; }
public string KundeneigeneSerienNr { get; set; }
public string Einbaulage { get; set; }
public bool NichtFuerTrefferquote { get; set; }
public bool Garantieschein { get; set; }
public Int16? AenderungMitarbeiterNr { get; set; }
public Byte? StatusFertigung { get; set; }
public String Metrolog { get; set; }
public Int32? FabNr { get; set; }
public Byte StatusFlag { get; set; }
public String KundeneigeneSerienNr { get; set; }
public String Einbaulage { get; set; }
public Boolean NichtFuerTrefferquote { get; set; }
public Boolean Garantieschein { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelAssignedPicking : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelAssignedPickingId { get; set; }
public int CordonelAssignedPickingPcbId { get; set; }
public int CordonelAssignedPickingFertigungsAuftragsNr { get; set; }
public Int32 CordonelAssignedPickingId { get; set; }
public Int32 CordonelAssignedPickingPcbId { get; set; }
public Int32 CordonelAssignedPickingFertigungsAuftragsNr { get; set; }
public DateTimeOffset CordonelAssignedPickingDate { get; set; }
public bool CordonelAssignedPickingIsDeleted { get; set; }
public Boolean CordonelAssignedPickingIsDeleted { get; set; }
}
}
@@ -5,11 +5,11 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelCurrentFw : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelCurrentFwId { get; set; }
public int CordonelCurrentFwFrequency { get; set; }
public int CordonelCurrentFwAppId { get; set; }
public int? CordonelCurrentFwVersion { get; set; }
public string CordonelCurrentFwName { get; set; }
public Int32 CordonelCurrentFwId { get; set; }
public Int32 CordonelCurrentFwFrequency { get; set; }
public Int32 CordonelCurrentFwAppId { get; set; }
public Int32? CordonelCurrentFwVersion { get; set; }
public String CordonelCurrentFwName { get; set; }
public DateTime? CordonelCurrentFwDeleted { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelFwFile : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelFwFileId { get; set; }
public int CordonelFwFileFileClusterStoreId { get; set; }
public int CordonelFwFileDn { get; set; }
public int CordonelFwFileType { get; set; }
public Int32 CordonelFwFileId { get; set; }
public Int32 CordonelFwFileFileClusterStoreId { get; set; }
public Int32 CordonelFwFileDn { get; set; }
public Int32 CordonelFwFileType { get; set; }
public virtual FileClusterStore CordonelFwFileFileClusterStore { get; set; }
}
@@ -1,10 +1,12 @@
namespace Service.MeterProcessState.Data
using System;
namespace Service.MeterProcessState.Data
{
public partial class CordonelMeterCalibrationLog : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int PcbId { get; set; }
public int CalibrationResultsID { get; set; }
public string LogKey { get; set; }
public string LogText { get; set; }
public Int32 PcbId { get; set; }
public Int32 CalibrationResultsID { get; set; }
public String LogKey { get; set; }
public String LogText { get; set; }
}
}
@@ -7,23 +7,23 @@ namespace Service.MeterProcessState.Data
public partial class CordonelMeterCalibrationResults
{
[Key]
public int Id { get; set; }
public string PcbId { get; set; }
public int? CalFactor1 { get; set; }
public int? CalFactor2 { get; set; }
public int? CalFactor3 { get; set; }
public int? ZeroOffset1 { get; set; }
public int? ZeroOffset2 { get; set; }
public int? ZeroOffset3 { get; set; }
public int? FirstHitUpdatePeriod { get; set; }
public int? FirstHitShift { get; set; }
public int? FirstHitPercent1 { get; set; }
public int? FirstHitPercent2 { get; set; }
public int? FirstHitPercent3 { get; set; }
public int? ToFtempOffset1 { get; set; }
public int? ToFtempOffset2 { get; set; }
public int? ToFtempOffset3 { get; set; }
public int? MeterSize { get; set; }
public Int32 Id { get; set; }
public String PcbId { get; set; }
public Int32? CalFactor1 { get; set; }
public Int32? CalFactor2 { get; set; }
public Int32? CalFactor3 { get; set; }
public Int32? ZeroOffset1 { get; set; }
public Int32? ZeroOffset2 { get; set; }
public Int32? ZeroOffset3 { get; set; }
public Int32? FirstHitUpdatePeriod { get; set; }
public Int32? FirstHitShift { get; set; }
public Int32? FirstHitPercent1 { get; set; }
public Int32? FirstHitPercent2 { get; set; }
public Int32? FirstHitPercent3 { get; set; }
public Int32? ToFtempOffset1 { get; set; }
public Int32? ToFtempOffset2 { get; set; }
public Int32? ToFtempOffset3 { get; set; }
public Int32? MeterSize { get; set; }
public DateTime? Date { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelMeterSizes : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int DnId { get; set; }
public string DnName { get; set; }
public int DnInternalId { get; set; }
public double? DnRealSize { get; set; }
public string DnVakoId { get; set; }
public Int32 DnId { get; set; }
public String DnName { get; set; }
public Int32 DnInternalId { get; set; }
public Double? DnRealSize { get; set; }
public String DnVakoId { get; set; }
}
}
@@ -5,13 +5,13 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelPressureTest : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelPressureTestId { get; set; }
public int CordonelPressureTestPcbId { get; set; }
public int CordonelPressureTestFertigungsAuftragsNr { get; set; }
public Int32 CordonelPressureTestId { get; set; }
public Int32 CordonelPressureTestPcbId { get; set; }
public Int32 CordonelPressureTestFertigungsAuftragsNr { get; set; }
public DateTimeOffset CordonelPressureTestDate { get; set; }
public bool CordonelPressureTestValid { get; set; }
public bool CordonelPressureTestIsDeleted { get; set; }
public string CordonelPressureTestText { get; set; }
public int? CordonelPressureTestStationId { get; set; }
public Boolean CordonelPressureTestValid { get; set; }
public Boolean CordonelPressureTestIsDeleted { get; set; }
public String CordonelPressureTestText { get; set; }
public Int32? CordonelPressureTestStationId { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelPressureTestHe : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelPressureTestHeId { get; set; }
public int CordonelPressureTestHeTestId { get; set; }
public string CordonelPressureTestHeLeakRate { get; set; }
public string CordonelPressureTestHeTestPressure { get; set; }
public string CordonelPressureTestHeTesterName { get; set; }
public Int32 CordonelPressureTestHeId { get; set; }
public Int32 CordonelPressureTestHeTestId { get; set; }
public String CordonelPressureTestHeLeakRate { get; set; }
public String CordonelPressureTestHeTestPressure { get; set; }
public String CordonelPressureTestHeTesterName { get; set; }
}
}
@@ -5,9 +5,9 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelPressureTestTestPoints : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int CordonelPressureTestTestPointsId { get; set; }
public int CordonelPressureTestId { get; set; }
public int CordonelPressureTestTestPointNr { get; set; }
public double CordonelPressureTestTestPointResult { get; set; }
public Int32 CordonelPressureTestTestPointsId { get; set; }
public Int32 CordonelPressureTestId { get; set; }
public Int32 CordonelPressureTestTestPointNr { get; set; }
public Double CordonelPressureTestTestPointResult { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class CordonelProgrammingMapper : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int Id { get; set; }
public string KeyName { get; set; }
public string KeyValue { get; set; }
public string RegisterName { get; set; }
public byte[] RegisterValue { get; set; }
public Int32 Id { get; set; }
public String KeyName { get; set; }
public String KeyValue { get; set; }
public String RegisterName { get; set; }
public Byte[] RegisterValue { get; set; }
}
}
@@ -9,12 +9,12 @@ namespace Xylem.Common.Service.MeterProcessState.Data
public class CordonelTempLut
{
[Key]
public int Id { get; set; }
public int PcbId { get; set; }
public double RefTempC { get; set; }
public double AvgTof { get; set; }
public Int32 Id { get; set; }
public Int32 PcbId { get; set; }
public Double RefTempC { get; set; }
public Double AvgTof { get; set; }
public bool Active { get; set; }
public Boolean Active { get; set; }
}
@@ -10,9 +10,9 @@ namespace Service.MeterProcessState.Data
FileMapToCluster = new HashSet<FileMapToCluster>();
}
public int FileId { get; set; }
public byte[] FileContent { get; set; }
public string FileName { get; set; }
public Int32 FileId { get; set; }
public Byte[] FileContent { get; set; }
public String FileName { get; set; }
public virtual ICollection<FileMapToCluster> FileMapToCluster { get; set; }
}
@@ -10,8 +10,8 @@ namespace Service.MeterProcessState.Data
FileClusterStore = new HashSet<FileClusterStore>();
}
public int FileCategoryId { get; set; }
public string FileCategoryName { get; set; }
public Int32 FileCategoryId { get; set; }
public String FileCategoryName { get; set; }
public virtual ICollection<FileClusterStore> FileClusterStore { get; set; }
}
@@ -11,13 +11,13 @@ namespace Service.MeterProcessState.Data
FileMapToCluster = new HashSet<FileMapToCluster>();
}
public int FileId { get; set; }
public string FileName { get; set; }
public bool FileIsLatest { get; set; }
public Int32 FileId { get; set; }
public String FileName { get; set; }
public Boolean FileIsLatest { get; set; }
public DateTime FileDate { get; set; }
public bool FileIsForDeveloperOnly { get; set; }
public int FileCategoryId { get; set; }
public bool FileIsDeleted { get; set; }
public Boolean FileIsForDeveloperOnly { get; set; }
public Int32 FileCategoryId { get; set; }
public Boolean FileIsDeleted { get; set; }
public virtual FileClusterCategory FileCategory { get; set; }
public virtual ICollection<CordonelFwFile> CordonelFwFile { get; set; }
@@ -5,9 +5,9 @@ namespace Service.MeterProcessState.Data
{
public partial class FileMapToCluster : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int FileMapToClusterId { get; set; }
public int FileMapToClusterFileId { get; set; }
public int FileMapToClusterFileClusterId { get; set; }
public Int32 FileMapToClusterId { get; set; }
public Int32 FileMapToClusterFileId { get; set; }
public Int32 FileMapToClusterFileClusterId { get; set; }
public virtual File FileMapToClusterFile { get; set; }
public virtual FileClusterStore FileMapToClusterFileCluster { get; set; }
@@ -5,8 +5,8 @@ namespace Service.MeterProcessState.Data
{
public partial class GeleseneMitteilungen : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int NachrichtId { get; set; }
public int MitarbeiterNr { get; set; }
public Int32 NachrichtId { get; set; }
public Int32 MitarbeiterNr { get; set; }
public DateTime GelesenDatum { get; set; }
}
}
@@ -5,17 +5,17 @@ namespace Service.MeterProcessState.Data
{
public partial class GenesisMeter : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int Id { get; set; }
public int Frequenz { get; set; }
public long Adresse { get; set; }
public Int32 Id { get; set; }
public Int32 Frequenz { get; set; }
public Int64 Adresse { get; set; }
public DateTime VergabeAm { get; set; }
public long? Seriennummer { get; set; }
public long? Fabrikationsnummer { get; set; }
public string Bemerkung { get; set; }
public Int64? Seriennummer { get; set; }
public Int64? Fabrikationsnummer { get; set; }
public String Bemerkung { get; set; }
public DateTimeOffset? VerheiratetDatum { get; set; }
public DateTime? GeschlossenDatum { get; set; }
public DateTime? FunkadresseDatum { get; set; }
public string FunkschluesselIndex { get; set; }
public String FunkschluesselIndex { get; set; }
public DateTime? UeberpruefungDatum { get; set; }
public DateTime? GelasertDatum { get; set; }
}
@@ -5,9 +5,9 @@ namespace Service.MeterProcessState.Data
{
public partial class GenesisMeterErrorMessages : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int Id { get; set; }
public string PcbId { get; set; }
public string Message { get; set; }
public Int32 Id { get; set; }
public String PcbId { get; set; }
public String Message { get; set; }
public DateTime? Date { get; set; }
}
}
@@ -5,10 +5,10 @@ namespace Service.MeterProcessState.Data
{
public partial class GenesisMeterRegisterHistory : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int Id { get; set; }
public string PcbId { get; set; }
public string Address { get; set; }
public string Value { get; set; }
public Int32 Id { get; set; }
public String PcbId { get; set; }
public String Address { get; set; }
public String Value { get; set; }
public DateTime? Date { get; set; }
}
}
@@ -7,10 +7,10 @@ namespace Service.MeterProcessState.Data
{
public partial class MapPcbIdToSerialNumber : Ui.Web.IMeterDataCenter.Data.BaseEntity
{
public int MapPcbIdToSerialNumber_Id { get; set; }
public string MapPcbIdToSerialNumber_PcbId { get; set; }
public int MapPcbIdToSerialNumber_SerialNumber { get; set; }
public Int32 MapPcbIdToSerialNumber_Id { get; set; }
public String MapPcbIdToSerialNumber_PcbId { get; set; }
public Int32 MapPcbIdToSerialNumber_SerialNumber { get; set; }
public DateTime? MapPcbIdToSerialNumber_DateUtc { get; set; }
public bool MapPcbIdToSerialNumber_Deleted { get; set; }
public Boolean MapPcbIdToSerialNumber_Deleted { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More