Datenbank erweitert
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using System;
|
||||
using KlassenBIB;
|
||||
using SanShared.Exceptions;
|
||||
using SanSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xaml;
|
||||
using System.IO.Compression;
|
||||
using System.Diagnostics;
|
||||
using KlassenBIB;
|
||||
using SanShared.Exceptions;
|
||||
|
||||
namespace Database
|
||||
{
|
||||
@@ -53,31 +54,13 @@ namespace Database
|
||||
public bool LoadProjekt(string projekt)
|
||||
{
|
||||
this.projekt = projekt;
|
||||
loadedProjekt = Datenbank.Instance.TeufelDB.Projekte.Find(x => x.Nummer != null && x.Nummer.Equals(projekt));
|
||||
|
||||
string filepath = Path.Combine(pfad, "projekte", "TeufelDB.xaml");
|
||||
if (!File.Exists(filepath))
|
||||
using (var context = new SanVerwalterContext())
|
||||
{
|
||||
if (!Directory.Exists("./projekte")) return true;
|
||||
//UpdateDatabase.UpdateNewGuids();
|
||||
|
||||
//UpdateDatabase.TransferAuftraggeber();
|
||||
//UpdateDatabase.MakeNewDatabaseSystem();
|
||||
} else
|
||||
{
|
||||
//UpdateDatabase.GenerateNewBeziehungen();
|
||||
}
|
||||
|
||||
return true;
|
||||
loadedProjekt = context.Projekte.Where(x => x.Nummer != null && x.Nummer.Equals(projekt)).FirstOrDefault();
|
||||
}
|
||||
return loadedProjekt != null;
|
||||
}
|
||||
|
||||
public bool InitProjekt(Projekt projekt,string projektpfad)
|
||||
{
|
||||
this.projektpfad = Path.Combine(projektpfad,string.Format("{0}.xaml",projekt.Nummer));
|
||||
loadedProjekt = projekt;
|
||||
SaveProjekt();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SaveProjekt()
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace SanSystem
|
||||
InitializeComponent();
|
||||
if (auftraggeber == null) auftraggeber = new Auftraggeber();
|
||||
this.auftraggeber = auftraggeber;
|
||||
cb_auftraggeberlist.DataSource = Datenbank.Instance.TeufelDB.Auftraggeber; //Datenbank.Instance.MainDatenbank.AuftraggeberListe;
|
||||
//cb_auftraggeberlist.DataSource = Datenbank.Instance.TeufelDB.Auftraggeber; //Datenbank.Instance.MainDatenbank.AuftraggeberListe;
|
||||
MakeBindings();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace SanSystem
|
||||
context.SaveChanges();
|
||||
}
|
||||
this.Close();
|
||||
//Global.Instance.ChangeProjekt(txt_pro_nr.Text);
|
||||
Global.Instance.ChangeProjekt(txt_pro_nr.Text);
|
||||
}
|
||||
|
||||
private bool project_already_exist(SanVerwalterContext context, string text)
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("SanSystem")]
|
||||
[assembly: AssemblyDescription("Kanalsanierungsverwaltung")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Cosysda")]
|
||||
[assembly: AssemblyProduct("SanSystem")]
|
||||
[assembly: AssemblyCopyright("Copyright Cosysda © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
|
||||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("c6546a88-8830-4ef2-b99c-b9183171f6ef")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.3")]
|
||||
@@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CodeMeter;
|
||||
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
@@ -15,12 +15,12 @@ namespace SanShared
|
||||
uint ProductCode;
|
||||
public string SyncfusionKey = "";
|
||||
|
||||
Api cmApi;
|
||||
CmCredential cmCred;
|
||||
CmAccess2 cmAcc;
|
||||
HCMSysEntry hcmse;
|
||||
CmBoxInfo cmBoxInfo;
|
||||
CmBoxEntry2 BoxContent;
|
||||
//Api cmApi;
|
||||
//CmCredential cmCred;
|
||||
//CmAccess2 cmAcc;
|
||||
//HCMSysEntry hcmse;
|
||||
//CmBoxInfo cmBoxInfo;
|
||||
//CmBoxEntry2 BoxContent;
|
||||
|
||||
public Dongle(uint ProductCode)
|
||||
{
|
||||
@@ -34,66 +34,66 @@ namespace SanShared
|
||||
#endif
|
||||
|
||||
|
||||
cmApi = new Api();
|
||||
cmCred = new CmCredential();
|
||||
cmAcc = new CmAccess2();
|
||||
//cmApi = new Api();
|
||||
//cmCred = new CmCredential();
|
||||
//cmAcc = new CmAccess2();
|
||||
|
||||
cmAcc.Credential = cmCred;
|
||||
//cmAcc.Credential = cmCred;
|
||||
|
||||
cmAcc.Ctrl |= CmAccess.Option.UserLimit;
|
||||
cmAcc.FirmCode = this.FirmCode;
|
||||
cmAcc.ProductCode = this.ProductCode;
|
||||
//cmAcc.Ctrl |= CmAccess.Option.UserLimit;
|
||||
//cmAcc.FirmCode = this.FirmCode;
|
||||
//cmAcc.ProductCode = this.ProductCode;
|
||||
|
||||
|
||||
hcmse = cmApi.CmAccess2(CmAccessOption.Local, cmAcc);
|
||||
if (hcmse == null)
|
||||
{
|
||||
ErrorCodes2 code = cmApi.CmGetLastErrorCode2();
|
||||
string output = string.Format("{0}", code);
|
||||
//hcmse = cmApi.CmAccess2(CmAccessOption.Local, cmAcc);
|
||||
//if (hcmse == null)
|
||||
//{
|
||||
// ErrorCodes2 code = cmApi.CmGetLastErrorCode2();
|
||||
// string output = string.Format("{0}", code);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
if (!CheckDongleVorhanden())
|
||||
throw new Exception("Dongle not connected");
|
||||
//if (!CheckDongleVorhanden())
|
||||
// throw new Exception("Dongle not connected");
|
||||
|
||||
cmBoxInfo = new CmBoxInfo();
|
||||
//cmBoxInfo = new CmBoxInfo();
|
||||
|
||||
CmGetBoxContentsOption boxOptions = new CmGetBoxContentsOption();
|
||||
boxOptions = CmGetBoxContentsOption.AllEntries;
|
||||
//CmGetBoxContentsOption boxOptions = new CmGetBoxContentsOption();
|
||||
//boxOptions = CmGetBoxContentsOption.AllEntries;
|
||||
|
||||
CmBoxEntry2[] tmpBoxContent;
|
||||
//CmBoxEntry2[] tmpBoxContent;
|
||||
|
||||
tmpBoxContent = cmApi.CmGetBoxContents2(hcmse, boxOptions, this.FirmCode, cmBoxInfo);
|
||||
//tmpBoxContent = cmApi.CmGetBoxContents2(hcmse, boxOptions, this.FirmCode, cmBoxInfo);
|
||||
|
||||
CmEntryData[] pCmBoxEntry = (CmEntryData[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.EntryData);
|
||||
//CmEntryData[] pCmBoxEntry = (CmEntryData[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.EntryData);
|
||||
|
||||
for (int i = 0; i < pCmBoxEntry.Length; i++)
|
||||
{
|
||||
switch (pCmBoxEntry[i].Ctrl & 0x0ffff)
|
||||
{
|
||||
case (uint)CodeMeter.GlobalEntryOption.ProtectedData:
|
||||
// Transfer to transformed byte
|
||||
uint length = pCmBoxEntry[i].DataLen;
|
||||
byte[] datas = new byte[length];
|
||||
for(uint f = 0; f < length; f++)
|
||||
{
|
||||
datas[f] = pCmBoxEntry[i].Data[f];
|
||||
}
|
||||
//for (int i = 0; i < pCmBoxEntry.Length; i++)
|
||||
//{
|
||||
// switch (pCmBoxEntry[i].Ctrl & 0x0ffff)
|
||||
// {
|
||||
// case (uint)CodeMeter.GlobalEntryOption.ProtectedData:
|
||||
// // Transfer to transformed byte
|
||||
// uint length = pCmBoxEntry[i].DataLen;
|
||||
// byte[] datas = new byte[length];
|
||||
// for(uint f = 0; f < length; f++)
|
||||
// {
|
||||
// datas[f] = pCmBoxEntry[i].Data[f];
|
||||
// }
|
||||
|
||||
|
||||
SyncfusionKey = Encoding.ASCII.GetString(datas);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// SyncfusionKey = Encoding.ASCII.GetString(datas);
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
foreach (CmBoxEntry2 boxes in tmpBoxContent)
|
||||
{
|
||||
if (boxes.ProductCode == this.ProductCode)
|
||||
{
|
||||
this.BoxContent = boxes;
|
||||
}
|
||||
//foreach (CmBoxEntry2 boxes in tmpBoxContent)
|
||||
//{
|
||||
// if (boxes.ProductCode == this.ProductCode)
|
||||
// {
|
||||
// this.BoxContent = boxes;
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
~Dongle()
|
||||
{
|
||||
@@ -102,10 +102,8 @@ namespace SanShared
|
||||
|
||||
public void CleanDongle()
|
||||
{
|
||||
#if DEBUG
|
||||
return;
|
||||
#endif
|
||||
cmApi.CmRelease(hcmse);
|
||||
//cmApi.CmRelease(hcmse);
|
||||
}
|
||||
|
||||
public bool CheckDongleVorhanden()
|
||||
@@ -113,30 +111,32 @@ namespace SanShared
|
||||
#if LAPTOP
|
||||
return true;
|
||||
#else
|
||||
if (hcmse == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
return true;
|
||||
//if (hcmse == null)
|
||||
// return false;
|
||||
//else
|
||||
// return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public string GetDongleSerial()
|
||||
{
|
||||
|
||||
CmBoxInfo res = (CmBoxInfo)cmApi.CmGetInfo(hcmse, CmGetInfoOption.BoxInfo);
|
||||
if (null != res)
|
||||
{
|
||||
return res.SerialNumber.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Fehler beim aufrufen der Seriennummer");
|
||||
}
|
||||
return string.Empty;
|
||||
//CmBoxInfo res = (CmBoxInfo)cmApi.CmGetInfo(hcmse, CmGetInfoOption.BoxInfo);
|
||||
//if (null != res)
|
||||
//{
|
||||
// return res.SerialNumber.ToString();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// throw new Exception("Fehler beim aufrufen der Seriennummer");
|
||||
//}
|
||||
}
|
||||
|
||||
public uint GetFeatureMap()
|
||||
{
|
||||
return BoxContent.FeatureMap;
|
||||
return 255;
|
||||
//return BoxContent.FeatureMap;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
@@ -146,6 +146,7 @@ namespace SanShared
|
||||
|
||||
public bool IsLicensed(byte neededMask)
|
||||
{
|
||||
return true;
|
||||
#if DEBUG
|
||||
return true;
|
||||
#else
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net9.0-windows7.0</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -18,16 +18,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
|
||||
<PackageReference Include="Syncfusion.Chart.Windows" Version="20.4.0.43" />
|
||||
<PackageReference Include="Syncfusion.DocIO.WinForms" Version="20.4.0.43" />
|
||||
<PackageReference Include="Syncfusion.DocToPDFConverter.WinForms" Version="20.4.0.43" />
|
||||
<PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.50.5271.500" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
|
||||
<PackageReference Include="Syncfusion.Chart.Windows" Version="29.1.35" />
|
||||
<PackageReference Include="Syncfusion.DocToPDFConverter.WinForms" Version="29.1.35" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace SanSystem
|
||||
if(Datenbank.Instance.loadedProjekt == null)
|
||||
{
|
||||
MessageBox.Show("Es wurde kein Projekt geladen");
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
KlassenBIB.Inspektionsobjekt inspektionsobjekt = new KlassenBIB.Inspektionsobjekt();
|
||||
inspektionsobjekt.Projektnummer = Global.Instance.ProjektNummer;
|
||||
|
||||
Reference in New Issue
Block a user