almost finished

This commit is contained in:
szabomarton 2024-05-27 13:16:08 +02:00
parent eeb77e7a81
commit da9bf843d6
15 changed files with 173 additions and 31 deletions

View File

@ -37,16 +37,16 @@ namespace WindowsFormsApp1
this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.Film_cime = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.Talalat = new System.Windows.Forms.Label();
this.listBox2 = new System.Windows.Forms.ListBox();
this.button4 = new System.Windows.Forms.Button();
this.Cim = new System.Windows.Forms.TextBox();
this.Ev = new System.Windows.Forms.TextBox();
this.Jelolesek = new System.Windows.Forms.TextBox();
this.Dijak = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.Searched = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
@ -67,6 +67,7 @@ namespace WindowsFormsApp1
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(198, 368);
this.listBox1.TabIndex = 1;
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
//
// label2
//
@ -112,6 +113,7 @@ namespace WindowsFormsApp1
this.button1.TabIndex = 6;
this.button1.Text = "Új film felvétele";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
@ -121,15 +123,16 @@ namespace WindowsFormsApp1
this.button2.TabIndex = 7;
this.button2.Text = "Legtöbb díjat kapta";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label6
// Film_cime
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(283, 256);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(55, 13);
this.label6.TabIndex = 8;
this.label6.Text = "Film címe:";
this.Film_cime.AutoSize = true;
this.Film_cime.Location = new System.Drawing.Point(283, 256);
this.Film_cime.Name = "Film_cime";
this.Film_cime.Size = new System.Drawing.Size(55, 13);
this.Film_cime.TabIndex = 8;
this.Film_cime.Text = "Film címe:";
//
// button3
//
@ -139,15 +142,16 @@ namespace WindowsFormsApp1
this.button3.TabIndex = 9;
this.button3.Text = "keres";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label7
// Talalat
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(283, 357);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(74, 13);
this.label7.TabIndex = 10;
this.label7.Text = "Találat kiírása";
this.Talalat.AutoSize = true;
this.Talalat.Location = new System.Drawing.Point(283, 357);
this.Talalat.Name = "Talalat";
this.Talalat.Size = new System.Drawing.Size(74, 13);
this.Talalat.TabIndex = 10;
this.Talalat.Text = "Találat kiírása";
//
// listBox2
//
@ -165,6 +169,7 @@ namespace WindowsFormsApp1
this.button4.TabIndex = 12;
this.button4.Text = "listázz";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Cim
//
@ -194,12 +199,12 @@ namespace WindowsFormsApp1
this.Dijak.Size = new System.Drawing.Size(159, 20);
this.Dijak.TabIndex = 16;
//
// textBox5
// Searched
//
this.textBox5.Location = new System.Drawing.Point(286, 303);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(159, 20);
this.textBox5.TabIndex = 17;
this.Searched.Location = new System.Drawing.Point(286, 303);
this.Searched.Name = "Searched";
this.Searched.Size = new System.Drawing.Size(159, 20);
this.Searched.TabIndex = 17;
//
// textBox6
//
@ -207,6 +212,7 @@ namespace WindowsFormsApp1
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(198, 20);
this.textBox6.TabIndex = 18;
this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
//
// Form1
//
@ -214,16 +220,16 @@ namespace WindowsFormsApp1
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.Searched);
this.Controls.Add(this.Dijak);
this.Controls.Add(this.Jelolesek);
this.Controls.Add(this.Ev);
this.Controls.Add(this.Cim);
this.Controls.Add(this.button4);
this.Controls.Add(this.listBox2);
this.Controls.Add(this.label7);
this.Controls.Add(this.Talalat);
this.Controls.Add(this.button3);
this.Controls.Add(this.label6);
this.Controls.Add(this.Film_cime);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5);
@ -250,16 +256,16 @@ namespace WindowsFormsApp1
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label Film_cime;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label Talalat;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox Cim;
private System.Windows.Forms.TextBox Ev;
private System.Windows.Forms.TextBox Jelolesek;
private System.Windows.Forms.TextBox Dijak;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox Searched;
private System.Windows.Forms.TextBox textBox6;
}
}

View File

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
namespace WindowsFormsApp1
{
@ -39,21 +40,136 @@ namespace WindowsFormsApp1
Data.films.Add(film);
line = streamReader.ReadLine();
}
streamReader.Close();
fileStream.Close();
foreach (var item in Data.films)
{
Data.filmnames.Add(item.cim);
}
Data.filmnames.Sort();
foreach (var item in Data.filmnames)
{
listBox1.Items.Add(item);
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
if (Cim.Text != null && Ev.Text != null && Jelolesek.Text != null && Dijak.Text != null)
{
char[] azon = new char[6];
for (int i = Cim.Text.Length - 1, j = 0; i > Cim.Text.Length - 4; i--, j++)
{
azon[j] = Cim.Text[i];
}
azon[4] = Ev.Text[Ev.Text.Length - 1];
azon[5] = Ev.Text[Ev.Text.Length - 2];
string azonosito = azon.ToString();
Film film = new Film(azonosito, Cim.Text, Convert.ToInt32(Ev.Text), Convert.ToInt32(Jelolesek.Text), Convert.ToInt32(Dijak.Text));
Data.films.Add(film);
return;
}
MessageBox.Show("ERROR");
return;
}
private void button2_Click(object sender, EventArgs e)
{
Film_cime.Text = $"Film címe: {Data.films[Filmname_index()].cim}";
}
private int Filmname_index()
{
int max = Data.films[0].dij;
foreach (var item in Data.films)
{
if (item.dij > max)
{
max = item.dij;
}
}
return max;
}
private void button3_Click(object sender, EventArgs e)
{
string cim = Search(Searched.Text);
string talalat = $"Találat kiírása: {cim}";
Talalat.Text = talalat;
}
private string Search(string searched_word)
{
string pattrern = $"{searched_word}".ToLower();
Regex regex = new Regex(pattrern);
if (searched_word == "")
{
MessageBox.Show("ERROR");
return "";
}
foreach (var item in Data.filmnames)
{
if (regex.IsMatch(item.ToLower()))
{
return item;
}
}
return "";
}
private void button4_Click(object sender, EventArgs e)
{
textBox6.Text = Searched.Text;
Search2(textBox6.Text);
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void Search2(string searched_word)
{
string pattrern = $"{searched_word}".ToLower();
Regex regex = new Regex(pattrern);
if (searched_word == "")
{
MessageBox.Show("ERROR");
return;
}
foreach (var item in Data.filmnames)
{
if (regex.IsMatch(item.ToLower()))
{
listBox2.Items.Add(item);
}
}
return;
}
}
public static class Data
{
public static List<Film> films = new List<Film>();
public static List<string> filmnames = new List<string>();
}
public class Film

View File

@ -54,6 +54,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1 @@
8069502011d0681850e57a53d5a1673222f430a6

View File

@ -0,0 +1,10 @@
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240527\WindowsFormsApp1\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb