Exemplo n.º 1
0
 public ABCpitalica(Igrac io)
 {
     InitializeComponent();
     igracOsoba = io;
     singleGame = true;
     timer1.Interval = this.clock1.Time * 1000;
 }
Exemplo n.º 2
0
        public ABCpitalica(Igrac io, cmpIgrac c1, cmpIgrac c2 )
        {
            InitializeComponent();
            igracOsoba = io;
            ime3.Text = io.Ime.ToUpper() + " : ";
            cmp1 = c1;
            ime1.Text = cmp1.Ime.ToUpper() + " : " ;
            cmp2 = c2;
            ime2.Text = cmp2.Ime.ToUpper() + " : " ;

            timer1.Interval = this.clock1.Time * 1000;
            singleGame = false;
            svaPitanja = new String[brojPitanja * 4];
            tocniOdgovori = new char[brojPitanja];
            currentPath = Path.GetDirectoryName(Application.ExecutablePath);
            absolutePath = Path.Combine(currentPath, relativePath);

            pitalicaCurr = 1;
        }
Exemplo n.º 3
0
        void Button_Click(object sender, EventArgs e)
        {
            string username = logPanel.Username;
            string password = logPanel.Password;
            OleDbParameter user = new OleDbParameter(@"U", username);
            OleDbParameter pass = new OleDbParameter(@"P", password);
            try{

                connection.Open();
                if(username =="" || password =="")
                {
                    logPanel.label4.Visible = true;
                    logPanel.Password = "";
                    logPanel.Username = "";
                }
                else
                {
                    command = new OleDbCommand("select * from Igraci where user=@U", connection);
                    command.Parameters.Add(user);
                    reader = command.ExecuteReader();
                    if (!(reader.Read()))
                    {
                        command.Parameters.Clear();
                        command = new OleDbCommand("insert into Igraci([user],[pass]) values(@U,@P)", connection);
                        command.Parameters.Add(user);
                        command.Parameters.Add(pass);
                        command.ExecuteNonQuery();

                        this.igracOsoba = new Igrac(logPanel.Username, logPanel.Password);
                        this.osobaIgracGB.Text = logPanel.Username.ToUpper();
                        this.osobaBodovi._Text = new Int32().ToString();
                        this.Controls.Remove(logPanel);
                        this.menuStrip1.Visible = true;
                        this.splitContainer1.Visible = true;
                    }
                    else
                    {
                        command.Parameters.Clear();
                        command = new OleDbCommand("select * from Igraci where(user=@U and pass=@P)", connection);
                         command.Parameters.Add(user);
                        command.Parameters.Add(pass);
                        reader = command.ExecuteReader();
                        if (!(reader.Read()))
                        {
                            logPanel.label3.Visible = true;
                            logPanel.Password = "";
                            logPanel.Username = "";
                        }
                        else
                        {
                            this.ime = username;
                            this.Controls.Remove(logPanel);
                            this.menuStrip1.Visible = true;
                            this.splitContainer1.Visible = true;
                            this.igracOsoba = new Igrac(logPanel.Username, logPanel.Password);
                            this.osobaIgracGB.Text = logPanel.Username.ToUpper();
                            this.osobaBodovi._Text = new Int32().ToString();

                        }

                    }
             }
            }
            finally
            {
                if (reader != null)
                    reader.Close();
            }
            if (connection != null)
                connection.Close();
        }