Advertisement
Adijata

Tutorijal vjezba 4

Nov 11th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.45 KB | None | 0 0
  1. // osoba
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace WindowsFormsApplication3
  10. {
  11.     public class Osoba
  12.     {
  13.        public enum Spol
  14.        {
  15.            Ženski,
  16.            Muški
  17.        }
  18.        public Osoba(string Ime, string Prezime, int GodinaRođenja, string Grad, string Email, string Password, DateTime Datum, bool SaPopustom, Spol Spol)
  19.        {
  20.            ime = Ime;
  21.            prezime = Prezime;
  22.            godinaRođenja = GodinaRođenja;
  23.            grad = Grad;
  24.            datumUpisa = Datum;
  25.            email = Email;
  26.            saPopustom = SaPopustom;
  27.            password = Password;
  28.            spol = Spol;
  29.  
  30.        }
  31.  
  32.         public string ime
  33.         {
  34.             get;
  35.             set;
  36.         }
  37.         public string prezime
  38.         {
  39.             get;
  40.             set;
  41.         }
  42.  
  43.         public int godinaRođenja
  44.         {
  45.             get;
  46.             set;
  47.         }
  48.         public string grad
  49.         {
  50.             get;
  51.             set;
  52.         }
  53.         public DateTime datumUpisa
  54.         {
  55.             get;
  56.             set;
  57.         }
  58.         public string email
  59.         {
  60.             get;
  61.             set;
  62.         }
  63.         public bool saPopustom
  64.         {
  65.             get;
  66.             set;
  67.         }
  68.         public string password
  69.         {
  70.             get;
  71.             set;
  72.         }
  73.  
  74.         public Spol spol
  75.         {
  76.             get;
  77.             set;
  78.         }
  79.     }
  80. }
  81.  
  82.  
  83. // forma
  84.  
  85. using System;
  86. using System.Collections.Generic;
  87. using System.ComponentModel;
  88. using System.Data;
  89. using System.Drawing;
  90. using System.Linq;
  91. using System.Text;
  92. using System.Threading.Tasks;
  93. using System.Windows.Forms;
  94.  
  95. namespace WindowsFormsApplication3
  96. {
  97.     public partial class Form1 : Form
  98.     {
  99.        
  100.         public Form1()
  101.         {
  102.             InitializeComponent();
  103.             listaOsoba = new List<Osoba>();
  104.            
  105.            
  106.         }
  107.  
  108.         public List<Osoba> listaOsoba
  109.         {
  110.             get;
  111.             set;
  112.         }
  113.      
  114.         Osoba.Spol pol
  115.         {
  116.             get;
  117.             set;
  118.         }
  119.        
  120.  
  121.         private void button1_Click(object sender, EventArgs e)
  122.         {
  123.  
  124.             listaOsoba.Add(new Osoba(textBox1.Text, textBox4.Text, int.Parse(textBox2.Text), textBox3.Text, textBox5.Text, maskedTextBox1.Text, DateTime.Now, checkBox1.Checked, pol));
  125.         }
  126.  
  127.         private void label1_Click(object sender, EventArgs e)
  128.         {
  129.  
  130.         }
  131.  
  132.         private void textBox2_TextChanged(object sender, EventArgs e)
  133.         {
  134.            
  135.         }
  136.  
  137.         private void label3_Click(object sender, EventArgs e)
  138.         {
  139.  
  140.         }
  141.  
  142.         private void textBox1_TextChanged(object sender, EventArgs e)
  143.         {
  144.            
  145.            
  146.         }
  147.  
  148.         private void textBox4_TextChanged(object sender, EventArgs e)
  149.         {
  150.            
  151.         }
  152.  
  153.         private void textBox2_TextChanged_1(object sender, EventArgs e)
  154.         {
  155.            
  156.         }
  157.  
  158.         private void textBox3_TextChanged(object sender, EventArgs e)
  159.         {
  160.            
  161.         }
  162.  
  163.         private void textBox5_TextChanged(object sender, EventArgs e)
  164.         {
  165.            
  166.         }
  167.  
  168.         private void textBox6_TextChanged(object sender, EventArgs e)
  169.         {
  170.            
  171.  
  172.         }
  173.  
  174.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  175.         {
  176.            
  177.         }
  178.  
  179.         private void radioButton1_CheckedChanged(object sender, EventArgs e)
  180.         {
  181.             pol = Osoba.Spol.Muški;
  182.         }
  183.  
  184.         private void radioButton2_CheckedChanged(object sender, EventArgs e)
  185.         {
  186.             pol = Osoba.Spol.Ženski;
  187.         }
  188.  
  189.         private void button2_Click(object sender, EventArgs e)
  190.         {
  191.             foreach(Osoba o in listaOsoba){
  192.                 string ispis = "Ime: " + o.ime + " Prezime: " + o.prezime + " Grad: " + o.grad + " Godina rođenja:  " + o.godinaRođenja + " Datum upisa: " + o.datumUpisa + " Spol: " + o.spol;
  193.                MessageBox.Show(ispis);
  194.             }
  195.         }
  196.  
  197.         private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
  198.         {
  199.             maskedTextBox1.Size = new Size(143, 40);
  200.         }
  201.  
  202.         private void button3_Click(object sender, EventArgs e)
  203.         {
  204.             this.Close();
  205.         }
  206.     }
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement