добавляет удаление аккаунт
This commit is contained in:
parent
f2928f71be
commit
c412738640
@ -87,6 +87,17 @@ namespace AwesomeEmailExtractor
|
||||
Role = role;
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
SqliteCommand command = new SqliteCommand();
|
||||
command.Connection = Globals.db;
|
||||
command.CommandText = "DELETE FROM users WHERE id = @id";
|
||||
|
||||
SqliteParameter loginParam = new SqliteParameter("@id", ID);
|
||||
command.Parameters.Add(loginParam);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public class AdminUtils
|
||||
|
@ -101,6 +101,12 @@
|
||||
<Compile Include="RegistrationForm.Designer.cs">
|
||||
<DependentUpon>RegistrationForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SettingsForm.Designer.cs">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="AuthorizationForm.resx">
|
||||
<DependentUpon>AuthorizationForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -116,6 +122,9 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="SettingsForm.resx">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<EmbeddedResource Include="RegistrationForm.resx">
|
||||
<DependentUpon>RegistrationForm.cs</DependentUpon>
|
||||
|
38
MainForm.Designer.cs
generated
38
MainForm.Designer.cs
generated
@ -37,6 +37,10 @@
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.аккаунтToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.administrationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resultStatusStrip.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -112,6 +116,7 @@
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.аккаунтToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
@ -131,6 +136,35 @@
|
||||
this.helpToolStripMenuItem.Size = new System.Drawing.Size(65, 20);
|
||||
this.helpToolStripMenuItem.Text = "Справка";
|
||||
//
|
||||
// аккаунтToolStripMenuItem
|
||||
//
|
||||
this.аккаунтToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.settingsToolStripMenuItem,
|
||||
this.administrationToolStripMenuItem,
|
||||
this.exitToolStripMenuItem});
|
||||
this.аккаунтToolStripMenuItem.Name = "аккаунтToolStripMenuItem";
|
||||
this.аккаунтToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
|
||||
this.аккаунтToolStripMenuItem.Text = "Аккаунт";
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.settingsToolStripMenuItem.Text = "Настройки";
|
||||
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click);
|
||||
//
|
||||
// administrationToolStripMenuItem
|
||||
//
|
||||
this.administrationToolStripMenuItem.Name = "administrationToolStripMenuItem";
|
||||
this.administrationToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.administrationToolStripMenuItem.Text = "Администрирование";
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.exitToolStripMenuItem.Text = "Выход";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -166,6 +200,10 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem аккаунтToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem administrationToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,5 +53,11 @@ namespace AwesomeEmailExtractor
|
||||
{ "uniqueEmails", uniqueEmails }
|
||||
});
|
||||
}
|
||||
|
||||
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SettingsForm settingsForm = FormManager.Current.CreateForm<SettingsForm>();
|
||||
settingsForm.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
122
SettingsForm.Designer.cs
generated
Normal file
122
SettingsForm.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
namespace AwesomeEmailExtractor
|
||||
{
|
||||
partial class SettingsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.changePasswordButton = new System.Windows.Forms.Button();
|
||||
this.entryNewPassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.entryRePassword = new System.Windows.Forms.TextBox();
|
||||
this.deleteAccountButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// changePasswordButton
|
||||
//
|
||||
this.changePasswordButton.Location = new System.Drawing.Point(34, 96);
|
||||
this.changePasswordButton.Name = "changePasswordButton";
|
||||
this.changePasswordButton.Size = new System.Drawing.Size(275, 26);
|
||||
this.changePasswordButton.TabIndex = 0;
|
||||
this.changePasswordButton.Text = "Изменить пароль";
|
||||
this.changePasswordButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// entryNewPassword
|
||||
//
|
||||
this.entryNewPassword.Location = new System.Drawing.Point(158, 12);
|
||||
this.entryNewPassword.Name = "entryNewPassword";
|
||||
this.entryNewPassword.Size = new System.Drawing.Size(151, 20);
|
||||
this.entryNewPassword.TabIndex = 2;
|
||||
this.entryNewPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.label2.Location = new System.Drawing.Point(30, 12);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(118, 20);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Новый пароль";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.label3.Location = new System.Drawing.Point(30, 53);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(125, 20);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Повтор пароля";
|
||||
//
|
||||
// entryRePassword
|
||||
//
|
||||
this.entryRePassword.Location = new System.Drawing.Point(158, 53);
|
||||
this.entryRePassword.Name = "entryRePassword";
|
||||
this.entryRePassword.Size = new System.Drawing.Size(151, 20);
|
||||
this.entryRePassword.TabIndex = 6;
|
||||
this.entryRePassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// deleteAccountButton
|
||||
//
|
||||
this.deleteAccountButton.Location = new System.Drawing.Point(34, 137);
|
||||
this.deleteAccountButton.Name = "deleteAccountButton";
|
||||
this.deleteAccountButton.Size = new System.Drawing.Size(275, 26);
|
||||
this.deleteAccountButton.TabIndex = 7;
|
||||
this.deleteAccountButton.Text = "Удалить аккаунт";
|
||||
this.deleteAccountButton.UseVisualStyleBackColor = true;
|
||||
this.deleteAccountButton.Click += new System.EventHandler(this.deleteAccountButton_Click);
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(338, 184);
|
||||
this.Controls.Add(this.deleteAccountButton);
|
||||
this.Controls.Add(this.entryRePassword);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.entryNewPassword);
|
||||
this.Controls.Add(this.changePasswordButton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "SettingsForm";
|
||||
this.Text = "Настройки";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button changePasswordButton;
|
||||
private System.Windows.Forms.TextBox entryNewPassword;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox entryRePassword;
|
||||
private System.Windows.Forms.Button deleteAccountButton;
|
||||
}
|
||||
}
|
36
SettingsForm.cs
Normal file
36
SettingsForm.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AwesomeEmailExtractor
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void deleteAccountButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Вы уверены что хотите удалить аккаунт?", "Удаление аккаунта", MessageBoxButtons.YesNo);
|
||||
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Globals.currentUser.Delete();
|
||||
MessageBox.Show("Аккаунт удален");
|
||||
|
||||
this.Close();
|
||||
|
||||
AuthorizationForm authorization = FormManager.Current.CreateForm<AuthorizationForm>();
|
||||
FormManager.Current.Navigate(this.Owner, authorization);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
SettingsForm.resx
Normal file
120
SettingsForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Reference in New Issue
Block a user