diff --git a/AIS/AISAdmin/EditAssignmentDialog.Designer.cs b/AIS/AISAdmin/EditAssignmentDialog.Designer.cs index f9dd8376..1cc0ba0f 100644 --- a/AIS/AISAdmin/EditAssignmentDialog.Designer.cs +++ b/AIS/AISAdmin/EditAssignmentDialog.Designer.cs @@ -57,6 +57,7 @@ this.buttonCancel.TabIndex = 1; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // // label1 // @@ -70,6 +71,11 @@ // numericUpDownMMSI // this.numericUpDownMMSI.Location = new System.Drawing.Point(56, 7); + this.numericUpDownMMSI.Maximum = new decimal(new int[] { + 100000000, + 0, + 0, + 0}); this.numericUpDownMMSI.Name = "numericUpDownMMSI"; this.numericUpDownMMSI.Size = new System.Drawing.Size(156, 23); this.numericUpDownMMSI.TabIndex = 3; @@ -105,6 +111,7 @@ this.Controls.Add(this.label1); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Name = "EditAssignmentDialog"; this.Text = "Edit assignment"; this.Load += new System.EventHandler(this.EditAssignmentDialog_Load); diff --git a/AIS/AISAdmin/EditAssignmentDialog.cs b/AIS/AISAdmin/EditAssignmentDialog.cs index a07771b9..a6ccda86 100644 --- a/AIS/AISAdmin/EditAssignmentDialog.cs +++ b/AIS/AISAdmin/EditAssignmentDialog.cs @@ -31,9 +31,16 @@ namespace AISAdmin private void buttonOK_Click(object sender, EventArgs e) { this.Assignment.MMSI = (int) this.numericUpDownMMSI.Value; - MonitorAssignment.ZoneMonitorType mType; - Enum.TryParse(this.comboBoxType.SelectedValue.ToString(), out mType); - this.Assignment.MonitorType = mType; + if (Enum.TryParse(this.comboBoxType.SelectedValue.ToString(), out MonitorAssignment.ZoneMonitorType mType)) + this.Assignment.MonitorType = mType; + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); } } } diff --git a/AIS/AISAdmin/Main.cs b/AIS/AISAdmin/Main.cs index 4978fb6b..aa3dfaa4 100644 --- a/AIS/AISAdmin/Main.cs +++ b/AIS/AISAdmin/Main.cs @@ -7,10 +7,10 @@ namespace AISAdmin public partial class Main : Form { private AIS_SQLiteStorage? _storage; - private BindingList? _monitorGroups = new(); + private BindingList _monitorGroups = new(); private MonitorGroup? _currentGroup; - private Dictionary> _zoneAssignmentDict = new(); - private List _allTargets = new(); + private readonly Dictionary> _zoneAssignmentDict = new(); + private readonly List _allTargets = new(); public Main() { @@ -176,7 +176,10 @@ namespace AISAdmin { this.checkBoxZoneActive.Checked = mz.Active; this.textBoxZone.Text = mz.Name; - this.listBoxAssignment.DataSource = new BindingList(this._zoneAssignmentDict[mz]); + if (this._zoneAssignmentDict.ContainsKey(mz)) + this.listBoxAssignment.DataSource = new BindingList(this._zoneAssignmentDict[mz]); + else + this.listBoxAssignment.DataSource = null; } } @@ -187,7 +190,28 @@ namespace AISAdmin ead.Assignment = ma; if(ead.ShowDialog() == DialogResult.OK) { + this.AddOrUpdateAssignmentForAllGroupZones(ma.MMSI, ma.MonitorType); + } + } + private void AddOrUpdateAssignmentForAllGroupZones(int mMSI, MonitorAssignment.ZoneMonitorType monitorType) + { + if (this._currentGroup == null) return; + foreach (MonitorZone mz in this._currentGroup.Zones) + { + if (!this._zoneAssignmentDict.ContainsKey(mz)) + this._zoneAssignmentDict[mz] = new(); + + MonitorAssignment? ma = this._zoneAssignmentDict[mz].FirstOrDefault((z) => z.MMSI == mMSI); + if (ma == null) + { + ma = new MonitorAssignment(-1); + ma.MonitorZoneId = mz.Id; + this._zoneAssignmentDict[mz].Add(ma); + } + ma.MMSI = mMSI; + ma.MonitorType = monitorType; + _storage?.Save(ma); } } } diff --git a/AIS/AIS_Zonen_Weser.kml b/AIS/AIS_Zonen_Weser.kml new file mode 100644 index 00000000..6c5a5356 --- /dev/null +++ b/AIS/AIS_Zonen_Weser.kml @@ -0,0 +1,666 @@ + + + + AIS_Zonen_Weser_22122022.kml + + + normal + #s_ylw-pushpin2 + + + highlight + #s_ylw-pushpin_hl1 + + + + + normal + #sn_ylw-pushpin3 + + + highlight + #sh_ylw-pushpin10 + + + + + normal + #sn_ylw-pushpin0 + + + highlight + #sh_ylw-pushpin1 + + + + + normal + #sn_ylw-pushpin + + + highlight + #sh_ylw-pushpin + + + + + normal + #sn_ylw-pushpin00 + + + highlight + #sh_ylw-pushpin00 + + + + + normal + #sn_ylw-pushpin2 + + + highlight + #sh_ylw-pushpin0 + + + + + normal + #sn_ylw-pushpin1 + + + highlight + #sh_ylw-pushpin2 + + + + + + + + + + + + + + + + + + AIS_Zonen_Weser + 1 + + Außenweser + + Strecke Schlüsseltonne bis 4a + #msn_ylw-pushpin00 + + 1 + + + + 8.084905564445293,53.93755004532834,0 8.065085308769866,53.96002290535108,0 8.001487333466779,53.9548465781452,0 7.935044377014828,53.93628986634031,0 7.823516339850427,53.89717922906978,0 7.8797652595839,53.86689444307854,0 7.895565093022898,53.87419866178809,0 8.084905564445293,53.93755004532834,0 + + + + + + + Strecke 4a bis 15 + #msn_ylw-pushpin0 + + 1 + + + + 8.097741220460318,53.81578148430968,0 8.126817884922886,53.82297795613471,0 8.085087393428903,53.93603787274849,0 7.985329591212915,53.90302147091614,0 7.918375201506958,53.88159370092865,0 7.910085948232332,53.87881633755389,0 7.900171228572058,53.87549442064969,0 7.895659273548576,53.87397415330074,0 7.891958300292037,53.872295675496,0 7.88000560693574,53.8668133962329,0 8.097741220460318,53.81578148430968,0 + + + + + + + Strecke 15 bis 27 + #msn_ylw-pushpin0 + + 1 + + + + 8.127132996654334,53.82173807426863,0 8.09853413634357,53.81430618048739,0 8.121209995707787,53.79903485002912,0 8.158859785066809,53.77498599237667,0 8.177331449398599,53.76269405958807,0 8.196284909449091,53.75098083904636,0 8.244646529259001,53.72840513561054,0 8.252583188987625,53.73525442290977,0 8.206996602277286,53.75704984933264,0 8.18984313408386,53.76779861275627,0 8.153339253955762,53.79262477551003,0 8.127132996654334,53.82173807426863,0 + + + + + + + Strecke 27 bis 35 + #msn_ylw-pushpin0 + + 1 + + + + 8.305930441969922,53.70592583723291,0 8.333764667285227,53.69575763449779,0 8.348056485031826,53.68609432641604,0 8.353563421083955,53.68925351704371,0 8.333142451845674,53.70359700424764,0 8.308441795669939,53.71480206778293,0 8.254222837156863,53.73399861871317,0 8.246010879329562,53.727901634782,0 8.305930441969922,53.70592583723291,0 + + + + + + + Strecke 35 bis 47 + #msn_ylw-pushpin0 + + 1 + + + + 8.401730787388145,53.64917654813266,0 8.464663948698274,53.6228929555935,0 8.468125854395506,53.62673559465739,0 8.406134284258865,53.6523019788324,0 8.388816901128038,53.66470332631364,0 8.35398882033186,53.68874845585909,0 8.348870724751574,53.68575311736914,0 8.401730787388145,53.64917654813266,0 + + + + + + + Tonne 47 bis Tonne 51 + #m_ylw-pushpin2 + + 1 + + + + 8.465068396636395,53.62276102057692,0 8.482280987004835,53.61434214536614,0 8.498659915998264,53.60289956417912,0 8.50339944869611,53.60638976796616,0 8.487872478506446,53.61759937212647,0 8.468711393195431,53.62654662791962,0 8.465068396636395,53.62276102057692,0 + + + + + + + + Bremerhaven + + Strecke Stromkaje + #msn_ylw-pushpin0 + + 1 + + + + 8.499046132128621,53.6027575037552,0 8.511337503466736,53.59333952669742,0 8.532662291168426,53.57140712306455,0 8.540966717740391,53.57274882487234,0 8.535539305750117,53.57848416803495,0 8.530694556292646,53.58361691065851,0 8.525351808177904,53.58927703616301,0 8.519396119447318,53.59530263128682,0 8.510180648348776,53.60205006216026,0 8.503744447858368,53.60627877199573,0 8.499046132128621,53.6027575037552,0 + + + + + + + Strecke Nordhafen + #msn_ylw-pushpin1 + + 1 + + + + 8.547767148842428,53.56550087538792,0 8.549767758489995,53.5633588992402,0 8.550563812915971,53.57161744433213,0 8.552548209570869,53.57167068227085,0 8.557820231722266,53.5738469756967,0 8.561292274181806,53.57543047137022,0 8.560561463768481,53.57765473040242,0 8.56033249185753,53.57764048204798,0 8.556063495545958,53.57741436401841,0 8.552931205708534,53.57956880600961,0 8.549179886146529,53.57956725942728,0 8.54663251454809,53.57883250244008,0 8.546492630872267,53.57381992841712,0 8.548461956399118,53.57164812995351,0 8.547767148842428,53.56550087538792,0 + + + + + + + Strecke Kaiserhafen + #msn_ylw-pushpin1 + + 1 + + + + 8.552221194755683,53.57119738165731,0 8.552922576690275,53.56378878844035,0 8.554011373212155,53.56192008972447,0 8.555950832926683,53.55983771612524,0 8.557343124074077,53.55935712219084,0 8.558825046963099,53.55896528791336,0 8.558451203711044,53.55647893955929,0 8.560311585319848,53.55619856692713,0 8.56593154949358,53.55084165697568,0 8.568343247922861,53.55161717050167,0 8.563539308310093,53.55836452762642,0 8.564667860739801,53.56148697578064,0 8.568087434136206,53.5655009594728,0 8.566206190317642,53.56705575484987,0 8.563541486042688,53.56860062669746,0 8.554329304763302,53.57208249784071,0 8.552221194755683,53.57119738165731,0 + + + + + + + Stecke Signalturm + #msn_ylw-pushpin0 + + 1 + + + + 8.542163424487407,53.56031137288569,0 8.55062016957789,53.56227167782592,0 8.54114708672288,53.5725024696613,0 8.532884737779218,53.57111429798305,0 8.542163424487407,53.56031137288569,0 + + + + + + + Strecke CCC bis Zoo + #msn_ylw-pushpin0 + + 1 + + + + 8.550797523768663,53.56211414911455,0 8.54241548256384,53.5601026134523,0 8.558277719666933,53.54182389986856,0 8.569115371936427,53.54410764960185,0 8.550797523768663,53.56211414911455,0 + + + + + + + Strecke Fischereihafen + #msn_ylw-pushpin1 + + 1 + + + + 8.575022413237727,53.53495347934783,0 8.573357860927199,53.52291972391714,0 8.574258954911908,53.51102752044446,0 8.574386870259383,53.5108336862111,0 8.578612807530462,53.49883517642006,0 8.581640783599143,53.49726878000082,0 8.585450779856149,53.49529782317002,0 8.588890612216362,53.49574612637486,0 8.587526675951832,53.50169750559364,0 8.584496395393231,53.5093717507793,0 8.58306010611382,53.51437166656088,0 8.584497908150091,53.5193390297562,0 8.587109920687293,53.52225352651917,0 8.586717960457399,53.52525941782564,0 8.586375335021238,53.52669306362191,0 8.584132589750839,53.53142548397042,0 8.583088771552102,53.53449258968898,0 8.580896402936094,53.53778093468679,0 8.575749638623158,53.53622921551812,0 8.575022413237727,53.53495347934783,0 + + + + + + + + Unterweser + + Strecke Geeste + #msn_ylw-pushpin0 + + 1 + + + + 8.558296235459633,53.54177599861251,0 8.558612652583776,53.52807985093649,0 8.570033944218725,53.5278612776761,0 8.575621939168187,53.53622761368555,0 8.569270767423905,53.54385661496937,0 8.558296235459633,53.54177599861251,0 + + + + + + + Reede Blexen-Reede + #msn_ylw-pushpin3 + + 1 + + + + 8.570009454326151,53.52759043890575,0 8.538793419431894,53.51433861281037,0 8.539510108375705,53.51196741586395,0 8.551197312477502,53.51469346748299,0 8.562109562805604,53.51870163453608,0 8.570009454326151,53.52759043890575,0 + + + + + + + Strecke Nordenham + #msn_ylw-pushpin0 + + 1 + + + + 8.536072793288682,53.51786240274473,0 8.518348597693359,53.51024672496234,0 8.516634130223625,53.50976044057943,0 8.513808600117779,53.50833001138821,0 8.5032511348547,53.49993268720895,0 8.487018230098055,53.48228863098128,0 8.484216140753759,53.47472193708488,0 8.484056558879864,53.46768949913746,0 8.497251323286573,53.4669254096619,0 8.498269169546829,53.47084549287469,0 8.500705682790013,53.48090516005476,0 8.504984519778638,53.48974150084132,0 8.519927730536768,53.50028688334999,0 8.53905612320361,53.51184047230047,0 8.538539822667905,53.51446276222833,0 8.569529323520896,53.5276174094776,0 8.558832216538612,53.5277648487043,0 8.536072793288682,53.51786240274473,0 + + + + + + + Strecke Nordenham bis Kernkraftwerk + #msn_ylw-pushpin1 + + 1 + + + + 8.488326060740539,53.41258917695457,0 8.501488904842827,53.41486620640485,0 8.497349154758796,53.46647350995347,0 8.484120031091491,53.4671541294467,0 8.488326060740539,53.41258917695457,0 + + + + + + + Strecke Kernkraftwerk bis Brake + #msn_ylw-pushpin0 + + 1 + + + + 8.501423989971787,53.4145875385325,0 8.488462147866327,53.41231214405772,0 8.48962382353027,53.38608035490516,0 8.495740874539395,53.36495029725695,0 8.505806059414457,53.36621548066071,0 8.501423989971787,53.4145875385325,0 + + + + + + + Strecke Brake + #msn_ylw-pushpin0 + + 1 + + + + 8.493527785841234,53.34117661009313,0 8.485629529623942,53.32642087179367,0 8.485295776831659,53.31837970876464,0 8.486494083184663,53.31078816768894,0 8.488340946183197,53.30661814225925,0 8.49707822327275,53.30605311163575,0 8.496559434344773,53.31040924911524,0 8.494092702694932,53.31824887962618,0 8.494112248121768,53.32477646126333,0 8.496791239248784,53.33183724949446,0 8.502544169044368,53.34002304821087,0 8.50602570378391,53.35006216860676,0 8.507353506276607,53.35792546624972,0 8.5058230620707,53.36540354406169,0 8.496461649256727,53.36436313954865,0 8.493527785841234,53.34117661009313,0 + + + + + + + Strecke Käseburg + #msn_ylw-pushpin0 + + 1 + + + + 8.483377991943645,53.28062522912958,0 8.492198378797047,53.27990867792629,0 8.497061185725956,53.30575669548958,0 8.487982279759716,53.30638788607034,0 8.483377991943645,53.28062522912958,0 + + + + + + + Strecke Käseburg bis Huntemündung + #msn_ylw-pushpin + + 1 + + + + 8.478448533016413,53.25936142562814,0 8.478015440025125,53.24729966617013,0 8.484180927740274,53.24718871718691,0 8.492022802596928,53.27952404486878,0 8.483643667480713,53.28035519230502,0 8.478448533016413,53.25936142562814,0 + + + + + + + Strecke Huntemündung bis Farge + #msn_ylw-pushpin + + 1 + + + + 8.498519426930244,53.20966257375415,0 8.503975884297502,53.21129880573458,0 8.497709872333466,53.21627458203903,0 8.499527822282744,53.21741326630792,0 8.494949405231063,53.21943602900369,0 8.486401935108155,53.22981131553212,0 8.484247434850634,53.24112643375488,0 8.484059392268568,53.24697420382069,0 8.478337738257267,53.24711713092849,0 8.478341739070148,53.23991482461269,0 8.479276976729743,53.23359955763562,0 8.48153717688338,53.22936802173506,0 8.483119100182675,53.22555223691612,0 8.486106603609517,53.22162507249265,0 8.490139854505681,53.21722148047734,0 8.498519426930244,53.20966257375415,0 + + + + + + + Strecke Farge + #msn_ylw-pushpin + + 1 + + + + 8.504300680123436,53.20381675319847,0 8.508836437903422,53.20053474241491,0 8.514813354097475,53.19665333274668,0 8.521686180394113,53.19272320424984,0 8.531023456222117,53.1887261999968,0 8.534109254986671,53.1908746549283,0 8.521272098938688,53.19619003411054,0 8.516203192177837,53.19959594413179,0 8.504018093003731,53.21117934385065,0 8.498703423996687,53.20953257418626,0 8.504300680123436,53.20381675319847,0 + + + + + + + Strecke Blumenthal + #msn_ylw-pushpin + + 1 + + + + 8.534287107881202,53.19083235604168,0 8.531299261161525,53.18881701835699,0 8.537130787360754,53.18656055612369,0 8.545733049604802,53.18374614864499,0 8.55515611599774,53.18093073955794,0 8.576125643213381,53.17319971163915,0 8.580394525345167,53.17521224965015,0 8.534652491247826,53.190682046916,0 8.534287107881202,53.19083235604168,0 + + + + + + + Strecke Vegesack + #msn_ylw-pushpin + + 1 + + + + 8.580367877911787,53.17126961789393,0 8.590394367508988,53.17058044614173,0 8.605475234601169,53.1697068915007,0 8.615636703565555,53.1675883571649,0 8.620571275721446,53.16456024083795,0 8.623238663218245,53.16114177711068,0 8.631090531264613,53.16394093055353,0 8.626164587971527,53.16676701775395,0 8.62108220661316,53.1688780466177,0 8.615194528554388,53.17093362254765,0 8.608054510993837,53.17219095266343,0 8.598755361973762,53.17284940940393,0 8.589184554705511,53.17364088781247,0 8.584642679426079,53.1742932976417,0 8.585168199369699,53.17459365987417,0 8.58519109970195,53.17456343555465,0 8.585365511057647,53.17484319404364,0 8.584463754533456,53.17538017818616,0 8.583517370084008,53.1754080974397,0 8.581549034194589,53.17561425070868,0 8.58046417678808,53.17513317240381,0 8.57623691135576,53.17316174043556,0 8.580367877911787,53.17126961789393,0 + + + + + + + Strecke Lemwerder bis Ochtummündung + #msn_ylw-pushpin + + 1 + + + + 8.642914950454042,53.12849443523309,0 8.645906028079981,53.13031147481564,0 8.636703104660715,53.1364686555152,0 8.631589499995847,53.14334661532629,0 8.631514158696067,53.14373145138625,0 8.631460069100285,53.14400808272282,0 8.629447443976625,53.15191400201456,0 8.628059552684572,53.16253572892267,0 8.623340860619946,53.16089113296039,0 8.624540962755493,53.15391348530378,0 8.625565875255383,53.14766389911442,0 8.627636998959783,53.14198895482713,0 8.631900447260563,53.13603842835062,0 8.63612961506808,53.13253998160643,0 8.642914950454042,53.12849443523309,0 + + + + + + + Strecke Moorlosenkirchen + #msn_ylw-pushpin + + 1 + + + + 8.648329245987794,53.12630787698939,0 8.655642849867604,53.12536885124157,0 8.674266973091285,53.12264616413172,0 8.678117004111296,53.12530683791541,0 8.671908178824495,53.12703646835147,0 8.669408994311116,53.12747470225749,0 8.667421525606265,53.12691793552919,0 8.662936929896759,53.12732372797833,0 8.657090158954961,53.12781614617569,0 8.649668111005786,53.12884872914088,0 8.645905280631698,53.13015098060554,0 8.643167823282319,53.12846246649955,0 8.648329245987794,53.12630787698939,0 + + + + + + + + Bremen + + Strecke Bremen außen + #msn_ylw-pushpin2 + + 1 + + + + 8.674595444119902,53.12252968341381,0 8.683755533780648,53.12034800125078,0 8.690282226918711,53.11876886789342,0 8.698453250125599,53.11769940752387,0 8.706890863956364,53.11733285081081,0 8.711445660961068,53.11717976145616,0 8.714832294293078,53.11649813439029,0 8.718722821944079,53.11539499000421,0 8.723761817922977,53.11376860040655,0 8.726422001265284,53.1126382058352,0 8.727692733508853,53.11086188983688,0 8.728224531191005,53.10989966628085,0 8.73221458366265,53.10784546600996,0 8.734595045493762,53.10428665053761,0 8.736918129570409,53.10145061306935,0 8.738225859174413,53.09915821297734,0 8.740032940211043,53.09597057688779,0 8.740432129942192,53.09474206417154,0 8.742461321006612,53.09497330622804,0 8.743369094205162,53.09545381835408,0 8.744166136527545,53.09689613424413,0 8.751212682148427,53.1002043587284,0 8.757037706837007,53.09496600033415,0 8.761635401876436,53.09199790143359,0 8.766037809189953,53.08704196729598,0 8.771820945470889,53.08363245375951,0 8.782536935540687,53.07784064763331,0 8.786265919977044,53.07676453481056,0 8.789699175821884,53.08196615411372,0 8.788722441260212,53.08147619500415,0 8.778974029541756,53.0849201089646,0 8.780683687568205,53.08692838146088,0 8.774462975732618,53.0977853243932,0 8.756865434937442,53.109308214985,0 8.744999483236525,53.11322043931452,0 8.738713795963326,53.11672989982746,0 8.72765335916319,53.11855312693121,0 8.709218444002506,53.11971659260157,0 8.708560808392939,53.1209049564524,0 8.678273482286194,53.12524976908559,0 8.674595444119902,53.12252968341381,0 + + + + + + + Strecke Bremen innen + #msn_ylw-pushpin + + 1 + + + + 8.708724476633979,53.12086826685329,0 8.709358702567108,53.11976945542838,0 8.711768057350472,53.1198051548082,0 8.715252223626685,53.12001218798962,0 8.718679939180959,53.11977774959727,0 8.722598641036328,53.11955874841641,0 8.7268798318331,53.1190398828886,0 8.732046762436473,53.11822572949538,0 8.737783380370276,53.11778165809755,0 8.742417566470538,53.11727526684384,0 8.747898546792301,53.11655751705759,0 8.74973887492153,53.11641252791998,0 8.751926633160977,53.12052733283063,0 8.74218044649864,53.12284664296733,0 8.734113276500224,53.12582608106469,0 8.726845855508248,53.12769161851261,0 8.724647445085722,53.13054911314237,0 8.721592262800961,53.1316392498812,0 8.710313096215101,53.13400750485604,0 8.708724476633979,53.12086826685329,0 + + + + + + + + + diff --git a/AIS/SQL/ais_initial.db b/AIS/SQL/ais_initial.db index 56806f24..8e2aba0c 100644 Binary files a/AIS/SQL/ais_initial.db and b/AIS/SQL/ais_initial.db differ diff --git a/AIS/bsmd.AIS2Service/.editorconfig b/AIS/bsmd.AIS2Service/.editorconfig new file mode 100644 index 00000000..2a9bbbbc --- /dev/null +++ b/AIS/bsmd.AIS2Service/.editorconfig @@ -0,0 +1,131 @@ +[*.cs] + +# IDE1006: Naming Styles +dotnet_diagnostic.IDE1006.severity = none +csharp_indent_labels = one_less_than_current +csharp_using_directive_placement = outside_namespace:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = block_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_throw_expression = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_space_around_binary_operators = before_and_after +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_prefer_tuple_swap = true:suggestion +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent +csharp_prefer_static_local_function = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_conditional_delegate_call = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent +csharp_style_var_elsewhere = false:silent + +[*.{cs,vb}] +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +indent_size = 4 +end_of_line = crlf +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion +[*.{cs,vb}] +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_style_readonly_field = true:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_style_allow_multiple_blank_lines_experimental = true:silent +dotnet_style_allow_statement_immediately_after_block_experimental = true:silent +dotnet_code_quality_unused_parameters = all:suggestion +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_event = false:silent diff --git a/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs b/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs index 9eaa2a77..b11da2eb 100644 --- a/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs +++ b/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs @@ -163,7 +163,7 @@ namespace bsmd.AIS2Service public List LoadAlarms(MonitorAssignment assignment) { List result = new List(); - string loadAlarmString = "SELECT id, timestamp, type, acknowledged FROM alarm WHERE zone_assignment_id = @ID"; + string loadAlarmString = "SELECT id, timestamp_first, timestamp_last, type, acknowledged FROM alarm WHERE zone_assignment_id = @ID"; SQLiteCommand laCmd = new SQLiteCommand(loadAlarmString, _connection); laCmd.Parameters.AddWithValue("@ID", assignment.Id); SQLiteDataReader reader = laCmd.ExecuteReader(); @@ -173,10 +173,11 @@ namespace bsmd.AIS2Service { int id = reader.GetInt32(0); Alarm alarm = new Alarm(id, assignment); - alarm.Timestamp = reader.GetDateTime(1); - alarm.ZoneMonitorType = (MonitorAssignment.ZoneMonitorType)reader.GetInt32(2); - if(!reader.IsDBNull(3)) - alarm.Acknowledged = reader.GetDateTime(3); + alarm.Timestamp_First = reader.GetDateTime(1); + alarm.Timestamp_Last = reader.GetDateTime(2); + alarm.ZoneMonitorType = (MonitorAssignment.ZoneMonitorType)reader.GetInt32(3); + if(!reader.IsDBNull(4)) + alarm.Acknowledged = reader.GetDateTime(4); result.Add(alarm); } reader.Close(); @@ -200,7 +201,7 @@ namespace bsmd.AIS2Service if (alarm.Id <= 0) { // insert - string saveAlarmString = $"INSERT INTO alarm (zone_assignment_id, timestamp, type, acknowledged) VALUES ({alarm.Assignment.Id}, '{alarm.Timestamp}', {alarm.ZoneMonitorType}, {alarm.Acknowledged})"; + string saveAlarmString = $"INSERT INTO alarm (zone_assignment_id, timestamp_first, timestamp_last, type, acknowledged) VALUES ({alarm.Assignment.Id}, '{alarm.Timestamp_First}', '{alarm.Timestamp_Last}', {alarm.ZoneMonitorType}, {alarm.Acknowledged})"; SQLiteCommand cmd = new SQLiteCommand(saveAlarmString, _connection); int insertedRows = cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -210,7 +211,7 @@ namespace bsmd.AIS2Service else { // update - string updateAlarmString = $"UPDATE alarm SET acknowledged = {alarm.Acknowledged} WHERE id = {alarm.Id}"; + string updateAlarmString = $"UPDATE alarm SET acknowledged = {alarm.Acknowledged}, timestamp_last = '{alarm.Timestamp_Last}' WHERE id = {alarm.Id}"; SQLiteCommand cmd = new SQLiteCommand(updateAlarmString, _connection); int updatedRows = cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -322,7 +323,7 @@ namespace bsmd.AIS2Service public bool Save(MonitorAssignment assignment) { if (assignment == null) return false; - string saveGeoPointString = $"INSERT INTO zone_assignment (mmsi, monitor_zone_id, type) VALUES ({assignment.MMSI}, {assignment.MonitorZoneId}, {assignment.MonitorType})"; + string saveGeoPointString = $"INSERT INTO zone_assignment (mmsi, monitor_zone_id, type) VALUES ({assignment.MMSI}, {assignment.MonitorZoneId}, {(int) assignment.MonitorType})"; SQLiteCommand cmd = new SQLiteCommand(saveGeoPointString, _connection); int insertedRows = cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -332,7 +333,7 @@ namespace bsmd.AIS2Service public List LoadAssignmentsForZone(long zoneId) { List assignments = new List(); - string loadAssignmentsString = "SELECT za.id, za.mmsi, za.monitor_zone_id, za.type FROM zone_assigment za WHERE za.monitor_zone_id = @ID"; + string loadAssignmentsString = "SELECT za.id, za.mmsi, za.monitor_zone_id, za.type FROM zone_assignment za WHERE za.monitor_zone_id = @ID"; SQLiteCommand laCmd = new SQLiteCommand(loadAssignmentsString, _connection); laCmd.Parameters.AddWithValue("@ID", zoneId); SQLiteDataReader reader = laCmd.ExecuteReader(); diff --git a/AIS/bsmd.AIS2Service/MonitorZone.cs b/AIS/bsmd.AIS2Service/MonitorZone.cs index 36f1bda0..c244d332 100644 --- a/AIS/bsmd.AIS2Service/MonitorZone.cs +++ b/AIS/bsmd.AIS2Service/MonitorZone.cs @@ -36,7 +36,7 @@ namespace bsmd.AIS2Service public class MonitorGroup : DBEntity { - private static ILog _log = LogManager.GetLogger(typeof(MonitorGroup)); + private static readonly ILog _log = LogManager.GetLogger(typeof(MonitorGroup)); #region fields @@ -296,7 +296,9 @@ namespace bsmd.AIS2Service public MonitorAssignment Assignment { get { return _assignment; } } - public DateTime Timestamp { get; set; } + public DateTime Timestamp_First { get; set; } + + public DateTime Timestamp_Last { get; set; } public DateTime? Acknowledged { get; set; } diff --git a/AIS/bsmd.AIS2Service/bsmd.AIS2Service.csproj b/AIS/bsmd.AIS2Service/bsmd.AIS2Service.csproj index 8904470b..ee70ec22 100644 --- a/AIS/bsmd.AIS2Service/bsmd.AIS2Service.csproj +++ b/AIS/bsmd.AIS2Service/bsmd.AIS2Service.csproj @@ -136,6 +136,7 @@ ais_initial.db PreserveNewest + diff --git a/AIS/bsmd.AIS2Service/bsmd.AIS2Service.sln b/AIS/bsmd.AIS2Service/bsmd.AIS2Service.sln index a2ee96fd..011e4680 100644 --- a/AIS/bsmd.AIS2Service/bsmd.AIS2Service.sln +++ b/AIS/bsmd.AIS2Service/bsmd.AIS2Service.sln @@ -5,7 +5,12 @@ VisualStudioVersion = 17.3.32901.215 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.AIS2Service", "bsmd.AIS2Service.csproj", "{73C2580C-4CE2-44DC-9BCF-41C6F860CFCC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AISAdmin", "..\AISAdmin\AISAdmin.csproj", "{EDEE0E87-47F4-44F6-A165-D84D4A99E5C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AISAdmin", "..\AISAdmin\AISAdmin.csproj", "{EDEE0E87-47F4-44F6-A165-D84D4A99E5C7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FD023314-0F18-4BC9-B13A-4D4755292AF3}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution