namespace Lucian___TEST public partial class Form1 Form List Eveniment

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
namespace Lucian___TEST
{
public partial class Form1 : Form
{
List<Eveniment> Evenimente = new List<Eveniment>();
public Form1()
{
InitializeComponent();
//Combobox
comboBox1.Items.Add("alegeti");
comboBox1.Items.Add("alegeti2");
for (int i = 1; i <= 10; i++)
{
comboBox1.Items.Add(i);
}
//Listview
string[] s = new string[3]
{
"Luci","Cata","Visi"
};
for(int i=0;i<s.Length;i++)
{
listView1.Items.Add(s[i]);
}
}
private void TextBox1_TextChanged(object sender, EventArgs e)
{
}
private void GroupBox1_Enter(object sender, EventArgs e)
{
}
private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
//Buton Adauga
private void Button1_Click(object sender, EventArgs e)
{
//textbox
string Nume = textBox1.Text;
//combobox
string Combo = comboBox1.SelectedItem.ToString();
//Conversie
int nr = 0;
if (Int32.TryParse(Combo, out int j))
nr = j;
//datetime picker
DateTime data = dateTimePicker1.Value.Date;
//listbox-extragere
string listbox = listBox1.SelectedItem.ToString();
//listview-extragere
string listview = listView1.SelectedItems[0].Text;
//declarare eveniment
Eveniment Ev = new Eveniment(Nume,data,nr,listbox);
Evenimente.Add(Ev);
//radioButton1 button
string tip = "";
if (radioButton1.Checked)
{
tip = "opt1";
}
else if (radioButton2.Checked)
{
tip = "opt2";
}
label8.Text += tip;
}
private bool MesajEroare(string n, int indexcb, int indexlb, int indexlv)
{
label6.Text = " ";
foreach (Eveniment Ev in Evenimente)
{
if (Ev.TipEveniment == n)
{
label6.Text += "Evenimentul deja exista";
return false;
}
}
if (n.Length > 5 && indexcb > 0 && indexlb >= 0 && indexlv > 0)
{
label6.Text = "Nu avem erori";
return true;
}
if (n.Length <= 5)
{
label6.Text += "Denumire scurta";
}
if (indexcb <= 0)
{
label6.Text += "Nu a fost selectat numarul";
}
if (indexlb < 0)
{
label6.Text += "Nu a fost selectata optiunea lb";
}
if (indexlv <= 0)
{
label6.Text += "Nu a fost selectata optiunea lv";
}
return false;
}
//Buton Afiseaza
private void Button2_Click(object sender, EventArgs e)
{
//golire textbox
treeView1.Nodes.Clear();
textBox1.Clear();
//Afisare
foreach (Eveniment Ev in Evenimente)
{
treeView1.Nodes.Add(Ev.ToString());
}
}
}
}