├── .gitignore
└── Gestore di Entrate
├── Gestore di Entrate.sln
├── Gestore di Entrate
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Gestore di Entrate.csproj
├── Modules
│ ├── Consts.cs
│ ├── Entrata.cs
│ ├── GestoreDati.cs
│ ├── ITransaction.cs
│ ├── Mesi.cs
│ └── Uscita.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── bin
│ └── Debug
│ │ ├── Gestore di Entrate.exe
│ │ ├── Gestore di Entrate.exe.config
│ │ └── Gestore di Entrate.pdb
├── databaseEntrate.txt
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferences.cache
│ ├── Gestore di Entrate.csproj.AssemblyReference.cache
│ ├── Gestore di Entrate.csproj.CoreCompileInputs.cache
│ ├── Gestore di Entrate.csproj.FileListAbsolute.txt
│ ├── Gestore di Entrate.csproj.GenerateResource.cache
│ ├── Gestore di Entrate.exe
│ ├── Gestore di Entrate.pdb
│ ├── Gestore_di_Entrate.Form1.resources
│ └── Gestore_di_Entrate.Properties.Resources.resources
└── README.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Il file gitignore è stato creato automaticamente da Microsoft(R) Visual Studio.
3 | ################################################################################
4 |
5 | /.vs
6 | /Gestore di Entrate/Gestore di Entrate/obj/Release
7 | *.cs
8 | /Gestore di Entrate/Gestore di Entrate/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
9 | /Gestore di Entrate/.vs/Gestore di Entrate/v17
10 | /Gestore di Entrate/.vs/Gestore di Entrate/FileContentIndex
11 | /Gestore di Entrate/Gestore di Entrate/.vs
12 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.8.34330.188
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gestore di Entrate", "Gestore di Entrate\Gestore di Entrate.csproj", "{3EA43650-B758-4A17-990F-4E2558B09276}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3EA43650-B758-4A17-990F-4E2558B09276}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {3EA43650-B758-4A17-990F-4E2558B09276}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {3EA43650-B758-4A17-990F-4E2558B09276}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {3EA43650-B758-4A17-990F-4E2558B09276}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {304377EA-574E-43D0-8BBF-3A2E76A55ADB}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Gestore_di_Entrate
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Variabile di progettazione necessaria.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Pulire le risorse in uso.
12 | ///
13 | /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Codice generato da Progettazione Windows Form
24 |
25 | ///
26 | /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
27 | /// il contenuto del metodo con l'editor di codice.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
32 | System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
33 | System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
34 | System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
35 | this.spesaUtente = new System.Windows.Forms.TextBox();
36 | this.valoreSpesaUtente = new System.Windows.Forms.TextBox();
37 | this.label1 = new System.Windows.Forms.Label();
38 | this.label2 = new System.Windows.Forms.Label();
39 | this.acquisciSpesa = new System.Windows.Forms.Button();
40 | this.graficoDati = new System.Windows.Forms.DataVisualization.Charting.Chart();
41 | this.label3 = new System.Windows.Forms.Label();
42 | this.label4 = new System.Windows.Forms.Label();
43 | this.isEntrata = new System.Windows.Forms.CheckBox();
44 | this.isUscita = new System.Windows.Forms.CheckBox();
45 | this.meseComboBox = new System.Windows.Forms.ComboBox();
46 | ((System.ComponentModel.ISupportInitialize)(this.graficoDati)).BeginInit();
47 | this.SuspendLayout();
48 | //
49 | // spesaUtente
50 | //
51 | this.spesaUtente.Location = new System.Drawing.Point(89, 49);
52 | this.spesaUtente.Name = "spesaUtente";
53 | this.spesaUtente.Size = new System.Drawing.Size(335, 20);
54 | this.spesaUtente.TabIndex = 0;
55 | //
56 | // valoreSpesaUtente
57 | //
58 | this.valoreSpesaUtente.Location = new System.Drawing.Point(89, 77);
59 | this.valoreSpesaUtente.Name = "valoreSpesaUtente";
60 | this.valoreSpesaUtente.Size = new System.Drawing.Size(335, 20);
61 | this.valoreSpesaUtente.TabIndex = 1;
62 | //
63 | // label1
64 | //
65 | this.label1.AutoSize = true;
66 | this.label1.Location = new System.Drawing.Point(13, 80);
67 | this.label1.Name = "label1";
68 | this.label1.Size = new System.Drawing.Size(70, 13);
69 | this.label1.TabIndex = 2;
70 | this.label1.Text = "Valore Spesa";
71 | //
72 | // label2
73 | //
74 | this.label2.AutoSize = true;
75 | this.label2.Location = new System.Drawing.Point(13, 52);
76 | this.label2.Name = "label2";
77 | this.label2.Size = new System.Drawing.Size(68, 13);
78 | this.label2.TabIndex = 3;
79 | this.label2.Text = "Nome Spesa";
80 | //
81 | // acquisciSpesa
82 | //
83 | this.acquisciSpesa.Location = new System.Drawing.Point(443, 47);
84 | this.acquisciSpesa.Name = "acquisciSpesa";
85 | this.acquisciSpesa.Size = new System.Drawing.Size(247, 102);
86 | this.acquisciSpesa.TabIndex = 4;
87 | this.acquisciSpesa.Text = "Acquisisci Spesa";
88 | this.acquisciSpesa.UseVisualStyleBackColor = true;
89 | this.acquisciSpesa.Click += new System.EventHandler(this.acquisciSpesa_Click);
90 | //
91 | // graficoDati
92 | //
93 | chartArea2.Name = "ChartArea1";
94 | this.graficoDati.ChartAreas.Add(chartArea2);
95 | legend2.Name = "Legend1";
96 | this.graficoDati.Legends.Add(legend2);
97 | this.graficoDati.Location = new System.Drawing.Point(12, 164);
98 | this.graficoDati.Name = "graficoDati";
99 | series3.ChartArea = "ChartArea1";
100 | series3.Color = System.Drawing.Color.Lime;
101 | series3.Legend = "Legend1";
102 | series3.Name = "entrate";
103 | series4.ChartArea = "ChartArea1";
104 | series4.Color = System.Drawing.Color.Red;
105 | series4.Legend = "Legend1";
106 | series4.Name = "uscite";
107 | this.graficoDati.Series.Add(series3);
108 | this.graficoDati.Series.Add(series4);
109 | this.graficoDati.Size = new System.Drawing.Size(678, 318);
110 | this.graficoDati.TabIndex = 5;
111 | this.graficoDati.Text = "grafico";
112 | //
113 | // label3
114 | //
115 | this.label3.AutoSize = true;
116 | this.label3.Location = new System.Drawing.Point(22, 142);
117 | this.label3.Name = "label3";
118 | this.label3.Size = new System.Drawing.Size(50, 13);
119 | this.label3.TabIndex = 7;
120 | this.label3.Text = "Tipologia";
121 | //
122 | // label4
123 | //
124 | this.label4.AutoSize = true;
125 | this.label4.Location = new System.Drawing.Point(29, 106);
126 | this.label4.Name = "label4";
127 | this.label4.Size = new System.Drawing.Size(33, 13);
128 | this.label4.TabIndex = 9;
129 | this.label4.Text = "Mese";
130 | //
131 | // isEntrata
132 | //
133 | this.isEntrata.AutoSize = true;
134 | this.isEntrata.Location = new System.Drawing.Point(89, 141);
135 | this.isEntrata.Name = "isEntrata";
136 | this.isEntrata.Size = new System.Drawing.Size(59, 17);
137 | this.isEntrata.TabIndex = 10;
138 | this.isEntrata.Text = "entrata";
139 | this.isEntrata.UseVisualStyleBackColor = true;
140 | //
141 | // isUscita
142 | //
143 | this.isUscita.AutoSize = true;
144 | this.isUscita.Location = new System.Drawing.Point(154, 142);
145 | this.isUscita.Name = "isUscita";
146 | this.isUscita.Size = new System.Drawing.Size(54, 17);
147 | this.isUscita.TabIndex = 11;
148 | this.isUscita.Text = "uscita";
149 | this.isUscita.UseVisualStyleBackColor = true;
150 | //
151 | // meseComboBox
152 | //
153 | this.meseComboBox.FormattingEnabled = true;
154 | this.meseComboBox.Location = new System.Drawing.Point(89, 103);
155 | this.meseComboBox.Name = "meseComboBox";
156 | this.meseComboBox.Size = new System.Drawing.Size(335, 21);
157 | this.meseComboBox.TabIndex = 12;
158 | //
159 | // Form1
160 | //
161 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
162 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
163 | this.ClientSize = new System.Drawing.Size(845, 507);
164 | this.Controls.Add(this.meseComboBox);
165 | this.Controls.Add(this.isUscita);
166 | this.Controls.Add(this.isEntrata);
167 | this.Controls.Add(this.label4);
168 | this.Controls.Add(this.label3);
169 | this.Controls.Add(this.graficoDati);
170 | this.Controls.Add(this.acquisciSpesa);
171 | this.Controls.Add(this.label2);
172 | this.Controls.Add(this.label1);
173 | this.Controls.Add(this.valoreSpesaUtente);
174 | this.Controls.Add(this.spesaUtente);
175 | this.Name = "Form1";
176 | this.Text = "Form1";
177 | ((System.ComponentModel.ISupportInitialize)(this.graficoDati)).EndInit();
178 | this.ResumeLayout(false);
179 | this.PerformLayout();
180 |
181 | }
182 |
183 | #endregion
184 |
185 | private System.Windows.Forms.TextBox spesaUtente;
186 | private System.Windows.Forms.TextBox valoreSpesaUtente;
187 | private System.Windows.Forms.Label label1;
188 | private System.Windows.Forms.Label label2;
189 | private System.Windows.Forms.Button acquisciSpesa;
190 | private System.Windows.Forms.DataVisualization.Charting.Chart graficoDati;
191 | private System.Windows.Forms.Label label3;
192 | private System.Windows.Forms.Label label4;
193 | private System.Windows.Forms.CheckBox isEntrata;
194 | private System.Windows.Forms.CheckBox isUscita;
195 | private System.Windows.Forms.ComboBox meseComboBox;
196 | }
197 | }
198 |
199 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Diagnostics;
7 | using System.Drawing;
8 | using System.Globalization;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using System.Windows.Forms;
13 | using System.Windows.Forms.DataVisualization.Charting;
14 | using Gestore_di_Entrate.Modules;
15 |
16 | namespace Gestore_di_Entrate
17 | {
18 | ///
19 | /// Classe parziale per il form principale dell'applicazione.
20 | ///
21 | public partial class Form1 : Form
22 | {
23 | private GestoreDati Dati;
24 |
25 | ///
26 | /// Costruttore del form.
27 | ///
28 | public Form1()
29 | {
30 | InitializeComponent();
31 | // Inizializza l'istanza di GestoreDati con un riferimento al graficoDati.
32 | Dati = new GestoreDati(graficoDati);
33 | InizializzaComboBox();
34 | }
35 |
36 | private void InizializzaComboBox()
37 | {
38 | Mesi[] mesi = (Mesi[])Enum.GetValues(typeof(Mesi)); //Creo un array con tutti gli elementi del enum mesi
39 |
40 | foreach (var item in mesi)
41 | {
42 | meseComboBox.Items.Add(item);
43 | }
44 |
45 | meseComboBox.SelectedItem = 0;
46 | }
47 |
48 | ///
49 | /// Gestisce il click del pulsante per acquisire una spesa o un'entrata.
50 | ///
51 | /// L'oggetto che ha generato l'evento.
52 | /// Argomenti dell'evento.
53 | private void acquisciSpesa_Click(object sender, EventArgs e)
54 | {
55 | try
56 | {
57 | string nomeDellaSpesa = spesaUtente.Text;
58 | double valoreDellaSpesa = Double.Parse(valoreSpesaUtente.Text);
59 |
60 |
61 | spesaUtente.Text = "";
62 | valoreSpesaUtente.Text = "";
63 |
64 | // Controlla se sia stato selezionato sia 'Entrata' che 'Uscita'.
65 | if (isEntrata.Checked && isUscita.Checked)
66 | {
67 | MessageBox.Show("Non puoi selezionare entrata ed uscita assieme", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
68 | return;
69 | }
70 |
71 | // Controlla se il nome o il valore della spesa sono vuoti o non validi.
72 | if (String.IsNullOrEmpty(nomeDellaSpesa) || valoreDellaSpesa <= 0)
73 | {
74 | MessageBox.Show("Nome della spesa o valore della spesa non validi", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
75 | return;
76 | }
77 |
78 | // Controllo se è selezionato un mese
79 | if(meseComboBox.SelectedItem == null)
80 | {
81 | MessageBox.Show("Non hai selezionato un mese", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
82 | return;
83 | }
84 |
85 | //Converto item della combo box nel emum corrispondente
86 | Mesi meseSelezionato = (Mesi)meseComboBox.SelectedItem;
87 |
88 | // Se è selezionata l'opzione 'Entrata', aggiunge un'entrata.
89 | if (isEntrata.Checked)
90 | {
91 | var entrata = new Entrata();
92 | entrata.Name = nomeDellaSpesa;
93 | entrata.Value = valoreDellaSpesa;
94 |
95 | entrata.Mese = meseSelezionato;
96 |
97 | Dati.AggiungiEntrata(entrata);
98 | }
99 |
100 | // Se è selezionata l'opzione 'Uscita', aggiunge un'uscita.
101 | if (isUscita.Checked)
102 | {
103 | var uscita = new Uscita();
104 | uscita.Name = nomeDellaSpesa;
105 | uscita.Value = valoreDellaSpesa;
106 |
107 | uscita.Mese = meseSelezionato;
108 |
109 | Dati.AggiungiUscita(uscita);
110 | }
111 |
112 | }
113 | catch (Exception ex)
114 | {
115 | // Gestisce eventuali eccezioni mostrando un messaggio di errore.
116 | MessageBox.Show(ex.Message, "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
117 | }
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Gestore di Entrate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3EA43650-B758-4A17-990F-4E2558B09276}
8 | WinExe
9 | Gestore_di_Entrate
10 | Gestore di Entrate
11 | v4.8
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Form
52 |
53 |
54 | Form1.cs
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | Form1.cs
66 |
67 |
68 | ResXFileCodeGenerator
69 | Resources.Designer.cs
70 | Designer
71 |
72 |
73 | True
74 | Resources.resx
75 |
76 |
77 | SettingsSingleFileGenerator
78 | Settings.Designer.cs
79 |
80 |
81 | True
82 | Settings.settings
83 | True
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/Consts.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gestore_di_Entrate.Modules
8 | {
9 | class Consts
10 | {
11 | public const string DIRECTORY = "C:\\Users\\admin\\Source\\Repos\\zGiuly\\ExpenseManager\\Gestore di Entrate\\Gestore di Entrate\\databaseEntrate.txt";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/Entrata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gestore_di_Entrate.Modules
8 | {
9 | class Entrata : ITransaction
10 | {
11 | private double value;
12 | private string name;
13 | private Mesi mese;
14 |
15 | public double Value { get { return value; } set { this.value = value; } }
16 |
17 | public string Name { get { return name; } set { name = value; } }
18 |
19 | public Mesi Mese { get { return mese; } set { mese = value; } }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/GestoreDati.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Linq.Expressions;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Windows.Forms.DataVisualization.Charting;
11 | using System.Windows.Forms.VisualStyles;
12 | using System.Xml.Linq;
13 | using static System.Windows.Forms.LinkLabel;
14 |
15 | namespace Gestore_di_Entrate.Modules
16 | {
17 | class GestoreDati
18 | {
19 | private List entrate;
20 | private List uscite;
21 |
22 | public List Entrate { get { return entrate; } }
23 |
24 | public List Uscite { get { return uscite; } }
25 |
26 | private Chart grafico;
27 |
28 | public GestoreDati(Chart grafico)
29 | {
30 | entrate = new List();
31 | uscite = new List();
32 | this.grafico = grafico;
33 | InizializzaGrafico();
34 | }
35 |
36 | public void AggiungiEntrata(Entrata entrata)
37 | {
38 | entrate.Add(entrata);
39 |
40 | foreach (DataPoint corrente in grafico.Series["entrate"].Points)
41 | {
42 | if (corrente.AxisLabel.Equals(entrata.Mese.ToString()))
43 | {
44 | corrente.YValues[0] = corrente.YValues[0] + entrata.Value;
45 | }
46 | }
47 | SalvaDati();
48 | AggiornaChart();
49 | }
50 |
51 | public void AggiungiUscita(Uscita uscita)
52 | {
53 | uscite.Add(uscita);
54 |
55 | foreach (DataPoint corrente in grafico.Series["uscite"].Points)
56 | {
57 | if (corrente.AxisLabel.Equals(uscita.Mese.ToString()))
58 | {
59 | corrente.YValues[0] = corrente.YValues[0] + uscita.Value;
60 | }
61 | }
62 | SalvaDati();
63 | AggiornaChart();
64 | }
65 |
66 | public void RimuoviEntrata(string name)
67 | {
68 | Entrata instance = null;
69 | foreach (var entrata in entrate)
70 | {
71 | if(entrata.Name.Contains(name))
72 | {
73 | instance = entrata;
74 | break;
75 | }
76 | }
77 | if(instance != null) entrate.Remove(instance);
78 |
79 | foreach (DataPoint corrente in grafico.Series["entrate"].Points)
80 | {
81 | if (corrente.AxisLabel.Equals(instance.Mese))
82 | {
83 | corrente.YValues[0] = 0;
84 | break;
85 | }
86 | }
87 | SalvaDati(true, instance.Value);
88 | AggiornaChart();
89 | }
90 | public void RimuoviUscita(string name)
91 | {
92 | Uscita instance = null;
93 | foreach (var uscita in uscite)
94 | {
95 | if (uscita.Name.Contains(name))
96 | {
97 | instance = uscita;
98 | break;
99 | }
100 | }
101 | if (instance != null) uscite.Remove(instance);
102 |
103 | foreach (DataPoint corrente in grafico.Series["uscite"].Points)
104 | {
105 | if (corrente.AxisLabel.Equals(instance.Mese))
106 | {
107 | corrente.YValues[0] = 0;
108 | break;
109 | }
110 | }
111 | SalvaDati(true, instance.Value);
112 | AggiornaChart();
113 | }
114 |
115 | private void CreaDatabase()
116 | {
117 | string[] righeFile = File.ReadAllLines(Consts.DIRECTORY);
118 |
119 | foreach (string line in righeFile)
120 | {
121 | string[] elementiRiga = line.Split(',');
122 |
123 | foreach (DataPoint corrente in grafico.Series["entrate"].Points)
124 | {
125 | if (corrente.AxisLabel.Equals(elementiRiga[2]))
126 | {
127 | corrente.SetValueY(corrente.YValues[0] + double.Parse(elementiRiga[1]));
128 | }
129 | }
130 |
131 | foreach (DataPoint corrente in grafico.Series["uscite"].Points)
132 | {
133 | if (corrente.AxisLabel.Equals(elementiRiga[2]))
134 | {
135 | corrente.SetValueY(corrente.YValues[0] + double.Parse(elementiRiga[1]));
136 | }
137 | }
138 | }
139 | AggiornaChart();
140 | }
141 |
142 | private void SalvaDati(bool remove = false, double value = -1)
143 | {
144 | string[] righeFile = File.ReadAllLines(Consts.DIRECTORY);
145 | List filteredLines = new List();
146 |
147 |
148 | foreach (string line in righeFile)
149 | {
150 | filteredLines.Add(line);
151 | }
152 |
153 | if (!remove)
154 | {
155 | foreach (var item in uscite)
156 | {
157 | filteredLines.Add($"uscita,{item.Value},{item.Mese}");
158 | }
159 |
160 | foreach (var item in entrate)
161 | {
162 | filteredLines.Add($"entrata,{item.Value},{item.Mese}");
163 | }
164 |
165 | using (StreamWriter writer = new StreamWriter(Consts.DIRECTORY))
166 | {
167 | foreach (string line in filteredLines)
168 | {
169 | writer.WriteLine(line);
170 | }
171 | }
172 | return;
173 | }
174 |
175 | if (value == -1) throw new Exception("Nessun valore inserito");
176 |
177 | foreach (var item in filteredLines)
178 | {
179 | string[] elementiRiga = item.Split(',');
180 |
181 | if (double.Parse(elementiRiga[1]) == value)
182 | {
183 | filteredLines.Remove(item);
184 | break;
185 | }
186 | }
187 |
188 | using (StreamWriter writer = new StreamWriter(Consts.DIRECTORY))
189 | {
190 | foreach (string line in filteredLines)
191 | {
192 | writer.WriteLine(line);
193 | }
194 | }
195 | }
196 |
197 |
198 | private void InizializzaGrafico()
199 | {
200 | List mesi = new List { "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic" };
201 |
202 | for (int i = 0; i < 12; i++)
203 | {
204 | grafico.Series["entrate"].Points.AddXY(mesi[i], 0);
205 | grafico.Series["uscite"].Points.AddXY(mesi[i], 0);
206 | }
207 |
208 | grafico.ChartAreas[0].AxisX.Minimum = double.NaN;
209 | grafico.ChartAreas[0].AxisX.Maximum = double.NaN;
210 |
211 |
212 | CreaDatabase();
213 | }
214 |
215 | private void AggiornaChart()
216 | {
217 | grafico.Update();
218 | grafico.Refresh();
219 | }
220 | }
221 | }
222 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/ITransaction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gestore_di_Entrate.Modules
8 | {
9 | interface ITransaction
10 | {
11 | string Name { get; set; }
12 | double Value { get; set; }
13 |
14 | Mesi Mese { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/Mesi.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gestore_di_Entrate.Modules
8 | {
9 | enum Mesi
10 | {
11 | Gen,
12 | Feb,
13 | Mar,
14 | Apr,
15 | Mag,
16 | Giu,
17 | Lug,
18 | Ago,
19 | Set,
20 | Ott,
21 | Nov,
22 | Dic
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Modules/Uscita.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Gestore_di_Entrate.Modules
8 | {
9 | class Uscita : ITransaction
10 | {
11 | private double value;
12 | private string name;
13 | private Mesi mese;
14 |
15 | public double Value { get { return value; } set { this.value = value; } }
16 | public string Name { get { return name; } set { name = value; } }
17 |
18 | public Mesi Mese { get { return mese; } set { mese = value; } }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Gestore_di_Entrate
8 | {
9 | internal static class Program
10 | {
11 | ///
12 | /// Punto di ingresso principale dell'applicazione.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("Gestore di Entrate")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Gestore di Entrate")]
13 | [assembly: AssemblyCopyright("Copyright © 2023")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("3ea43650-b758-4a17-990f-4e2558b09276")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Codice generato da uno strumento.
4 | // Versione runtime:4.0.30319.42000
5 | //
6 | // Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
7 | // il codice viene rigenerato.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Gestore_di_Entrate.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
17 | ///
18 | // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
19 | // tramite uno strumento quale ResGen o Visual Studio.
20 | // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
21 | // con l'opzione /str oppure ricompilare il progetto VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gestore_di_Entrate.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
56 | /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Gestore_di_Entrate.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/bin/Debug/Gestore di Entrate.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/bin/Debug/Gestore di Entrate.exe
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/bin/Debug/Gestore di Entrate.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/bin/Debug/Gestore di Entrate.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/bin/Debug/Gestore di Entrate.pdb
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/databaseEntrate.txt:
--------------------------------------------------------------------------------
1 | entrata,25,Gen
2 | uscita,25,Gen
3 | entrata,15,Feb
4 | uscita,15,Feb
5 | entrata,30,Mar
6 | uscita,30,Mar
7 | entrata,500,Ago
8 | uscita,700,Ago
9 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.AssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.AssemblyReference.cache
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 4fd5c45ffcac25a25709307a354ce16e070ea82b475ac642013b5d9ed2f26f51
2 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.exe.config
2 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.exe
3 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.pdb
4 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.AssemblyReference.cache
5 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore_di_Entrate.Form1.resources
6 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore_di_Entrate.Properties.Resources.resources
7 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.GenerateResource.cache
8 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.CoreCompileInputs.cache
9 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.exe
10 | C:\Users\bella\source\repos\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.pdb
11 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.AssemblyReference.cache
12 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore_di_Entrate.Form1.resources
13 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore_di_Entrate.Properties.Resources.resources
14 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.GenerateResource.cache
15 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.csproj.CoreCompileInputs.cache
16 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.exe
17 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\obj\Debug\Gestore di Entrate.pdb
18 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.exe.config
19 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.exe
20 | C:\Users\admin\Source\Repos\zGiuly\ExpenseManager\Gestore di Entrate\Gestore di Entrate\bin\Debug\Gestore di Entrate.pdb
21 |
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.GenerateResource.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.csproj.GenerateResource.cache
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.exe
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore di Entrate.pdb
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore_di_Entrate.Form1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore_di_Entrate.Form1.resources
--------------------------------------------------------------------------------
/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore_di_Entrate.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nFire-coding/ExpenseManager/e66bd668d9cc3a9f65576e586be78c876f6e2e63/Gestore di Entrate/Gestore di Entrate/obj/Debug/Gestore_di_Entrate.Properties.Resources.resources
--------------------------------------------------------------------------------
/Gestore di Entrate/README.txt:
--------------------------------------------------------------------------------
1 | Expense Manager
2 |
3 | This is an educational and instructional program developed in C# to manage personal expenses. The program allows users to input and monitor their incoming and outgoing transactions.
4 |
5 | Instructions
6 | Make sure to have the .NET Core SDK installed on your system.
7 |
8 | The executable file can be found in the bin\Debug\Income Manager.exe directory.
9 |
10 | Important Note
11 | It is crucial to provide the correct file path when prompted during the program's execution.
12 |
13 | Possible Improvements
14 | This program is designed for educational purposes and, as such, is poorly written, filled with bugs and errors, having been created hastily in about fifteen minutes. Therefore, it is open to improvements from the community. You are encouraged to contribute and make changes freely.
--------------------------------------------------------------------------------