Commit c4b05a3e authored by M3156's avatar M3156
Browse files

kuvabugi ja delete profile esto, jos transaktio on auki

parent 299fe30e
No preview for this file type
......@@ -78,7 +78,7 @@ namespace iTool
imgAddTool.Source = new BitmapImage(new Uri(dlg.FileName, UriKind.RelativeOrAbsolute)); // näyttää valitun kuvan
string i = imgAddTool.Source.ToString().Split('/')[imgAddTool.Source.ToString().Split('/').Length - 1]; //kuvatiedoston nimi
//path = $@"F:\iTool\iTool\iTool\images\{i}";
path = $@"images\{i}"; //polku kuvatiedostoon
path = $@"{Active.ProjectPath}\images\{i}"; //polku kuvatiedostoon
//Metodi, joka lisää numeron kuvatiedostonimen alkuun, jos samanniminen kuvatiedosto on jop olemassa 'images' kansiossa
if (File.Exists(path))
......@@ -86,7 +86,7 @@ namespace iTool
int x = 0;
for (; File.Exists(path);)
{
path = $@"images\{x}{i}";
path = $@"{Active.ProjectPath}\images\{x}{i}";
//path = $@"F:\iTool\iTool\iTool\images\{x}{i}";
imgFile = $"{x}{i}";
x++;
......@@ -99,8 +99,8 @@ namespace iTool
}
// relaatiivinen polku kuvatiedostoon
relativePath = $"{Directory.GetParent(Environment.CurrentDirectory).Parent.FullName}\\{path}";
//relativePath = $"{Directory.GetParent(Environment.CurrentDirectory).Parent.FullName}\\{path}";
relativePath = path;
// polku valituun kuvatiedostoon
dirPath = $@"{System.IO.Path.GetDirectoryName(dlg.FileName)}\{System.IO.Path.GetFileName(dlg.FileName)}";
}
......
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="iTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
......@@ -24,4 +24,9 @@
</setting>
</iTool.Properties.Settings>
</userSettings>
</configuration>
\ No newline at end of file
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
\ No newline at end of file
......@@ -257,20 +257,49 @@ namespace iTool
private void BtnDeleteProfile_Click(object sender, RoutedEventArgs e)
{
//POISTETAAN KÄYTTÄJÄ
var result = MessageBox.Show($"Do you really want to delete your user profile and all of your data from the iTool database?", "iTool: Delete Profile", MessageBoxButton.YesNo); //VARMISTUSIKKUNA
if (result == MessageBoxResult.Yes) //YES
try
{
DB.DeleteProfile(); //YLIKIRJOITETAAN KÄYTTÄJÄ TIETOKANNASSA
Active.main = new MainWindow(); //LUODAAN LOGIN IKKUNAN OLIO
Active.main.Show(); //NÄYTETÄÄN LOGIN IKKUNA
Active.main.txbMainError.Text = "You have deleted your profile successfully"; //ESITETÄÄN VIESTI KÄYTTÄJÄLLE
this.Close(); //SULJETAAN TÄMÄ IKKUNA
//POISTETAAN KÄYTTÄJÄ
List<Transaction> transactions = DB.GetTransactionsFromMysql();
List<Transaction> checkTr = new List<Transaction>();
bool transactionActive = false;
foreach (Transaction item in transactions)
{
if (item.ActualEndDate == null)
{
checkTr.Add(item);
}
}
if (checkTr.Count() > 0)
transactionActive = true;
if (transactionActive)
{
txbMessagesProfile.Text = "Cannot delete your profile while you have an ongoing transaction";
}
else
{
var result = MessageBox.Show($"Do you really want to delete your user profile and all of your data from the iTool database?", "iTool: Delete Profile", MessageBoxButton.YesNo); //VARMISTUSIKKUNA
if (result == MessageBoxResult.Yes) //YES
{
DB.DeleteProfile(); //YLIKIRJOITETAAN KÄYTTÄJÄ TIETOKANNASSA
Active.main = new MainWindow(); //LUODAAN LOGIN IKKUNAN OLIO
Active.main.Show(); //NÄYTETÄÄN LOGIN IKKUNA
Active.main.txbMainError.Text = "You have deleted your profile successfully"; //ESITETÄÄN VIESTI KÄYTTÄJÄLLE
this.Close(); //SULJETAAN TÄMÄ IKKUNA
}
else //NO
{
txbMessagesProfile.Text = $"You did nothing";
}
}
}
else //NO
catch
{
txbMessagesProfile.Text = $"You did nothing";
throw;
}
}
......
......@@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>lLzxlMN3wEBgyauERMszMYIEnvJdNE5AAGguNrT2S7A=</dsig:DigestValue>
<dsig:DigestValue>ikuxzGRQdS8nH1KkbVa7vfJO4tH7kpOF02ctrrUKbnM=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
......
......@@ -55,14 +55,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="iTool.exe" size="995768">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="iTool.exe" size="996792">
<assemblyIdentity name="iTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>+P9N4G9w2K7xe6MtGEcIqivfWniuyzhNiwVGHySfJJw=</dsig:DigestValue>
<dsig:DigestValue>H4bDV5BgtWdDo+SWHN5WGDBBkorFsLP9Ad1/Vx7LHns=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
......
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="iTool.application" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="iTool" asmv2:product="iTool" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.6.1" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="iTool.exe.manifest" size="4623">
<assemblyIdentity name="iTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>9PTP0mN+hkQA6OPHqOXjTz2M4qf4T21PfGTOGSmk+Dc=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="iTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<userSettings>
<iTool.Properties.Settings>
<setting name="server" serializeAs="String">
<value>mysql.labranet.jamk.fi</value>
</setting>
<setting name="database" serializeAs="String">
<value>M3156_3</value>
</setting>
<setting name="userID" serializeAs="String">
<value>M3156</value>
</setting>
<setting name="password" serializeAs="String">
<value>Mn1GQ5TbFX7UI0tjH2Y4H2oWtcfs4zra</value>
</setting>
</iTool.Properties.Settings>
</userSettings>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<asmv1:assemblyIdentity name="iTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<description asmv2:iconFile="escrewdriver_31H_icon.ico" xmlns="urn:schemas-microsoft-com:asm.v1" />
<application />
<entryPoint>
<assemblyIdentity name="iTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="iTool.exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--
UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentOS>
<osVersionInfo>
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
</osVersionInfo>
</dependentOS>
</dependency>
<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="iTool.exe" size="982456">
<assemblyIdentity name="iTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>hOH1wgLJto/1DvkX/JXNRm8jXDBbxKoKck2AkZ56Wk4=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MySql.Data.dll" size="424448">
<assemblyIdentity name="MySql.Data" version="6.9.9.0" publicKeyToken="C5687FC88969C44D" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>z1JCyodj5/UiC37FF0m11VPrQRt8tszqKfa8jk+yNYc=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<file name="escrewdriver_31H_icon.ico" size="313812">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>TWxM9TCQY2QsvmH2LoM6AZVbSR23JgHF8PzcLiTclNE=</dsig:DigestValue>
</hash>
</file>
<file name="iTool.exe.config" size="1715">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>L3hwe684RELrUCRz/hkrglVo80yl69ErKzxv5RRLHMI=</dsig:DigestValue>
</hash>
</file>
</asmv1:assembly>
\ No newline at end of file
......@@ -65,7 +65,9 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
......@@ -178,6 +180,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="iTool_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment