Esempio n. 1
0
        //unos koseva na terernu
        private void picbDashboardTeren_MouseUp(object sender, MouseEventArgs e)
        {
            Kosevi kos = new Kosevi();

            kos.Set_XY((decimal)e.Location.X,
                       (decimal)e.Location.Y,
                       (decimal)picbDashboardTeren.Height,
                       (decimal)picbDashboardTeren.Width);
            kos.Suter_id  = igrac_odabran.Id;
            kos.Vrsta_sut = 'I';
            //dohvacanje podataka iz forme Kosevi_popup
            try
            {
                using (var form = new Kosevi_popup(picbDashboardTeren.Location.X + e.Location.X,
                                                   picbDashboardTeren.Location.Y + e.Location.Y,
                                                   this.DesktopLocation.X,
                                                   this.DesktopLocation.Y,
                                                   kos))
                {
                    form.ShowDialog();
                    kos.Pogodak = form.Pogodeno_popup;
                    kos.Br_Bod  = form.Bodovi_popup;
                }
                kosevi_lista.Add(kos);
                Change_label("Šut je zabilježen");
            }
            catch (ArgumentException err)
            {
                lblDashboardResult.ForeColor = Color.Red;
                Change_label(Convert.ToString(err));
            }
        }
Esempio n. 2
0
 public Kosevi_popup(int X, int Y, int formX, int formY, Kosevi kos)
 {
     InitializeComponent();
     //lokacija popoupa
     this.Location = new Point(formX + X, formY + Y);
     kos_sut       = kos;
 }
Esempio n. 3
0
        public static void Kosevi_Put(Kosevi ko)
        {
            SQLiteCommand com = DB_connection.conn.CreateCommand();

            com.CommandText = String.Format(@"INSERT INTO KOSEVI (Pozicija_x, Pozicija_y, Suter_ID, Vrsta_sutera, Pogodjeno, Br_bodova)
                                               VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')",
                                            ko.Poz_X, ko.Poz_Y, ko.Suter_id, ko.Vrsta_sut, ko.Pogodak, ko.Br_Bod);
            com.ExecuteNonQuery();
            com.Dispose();
        }
Esempio n. 4
0
        public static List <Kosevi> Kosevi_Get_All()
        {
            var lista = new List <Kosevi>();

            SQLiteCommand com = DB_connection.conn.CreateCommand();

            com.CommandText = String.Format(@"SELECT * FROM KOSEVI");
            SQLiteDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                Kosevi k = new Kosevi();
                k.Id = Convert.ToInt32(reader["ID"]);
                if (reader["Pozicija_x"].GetType() != typeof(DBNull))
                {
                    k.Poz_X = Convert.ToDecimal(reader["Pozicija_x"]);
                }
                if (reader["Pozicija_y"].GetType() != typeof(DBNull))
                {
                    k.Poz_Y = Convert.ToDecimal(reader["Pozicija_y"]);
                }
                if (reader["Suter_ID"].GetType() != typeof(DBNull))
                {
                    k.Suter_id = Convert.ToInt32(reader["Suter_ID"]);
                }
                if (reader["Vrsta_sutera"].GetType() != typeof(DBNull))
                {
                    k.Vrsta_sut = Convert.ToChar(reader["Vrsta_sutera"]);
                }
                if (reader["Pogodjeno"].GetType() != typeof(DBNull))
                {
                    k.Pogodak = (bool)reader["Pogodjeno"];
                }
                if (reader["Br_bodova"].GetType() != typeof(DBNull))
                {
                    k.Br_Bod = Convert.ToInt32(reader["Br_bodova"]);
                }
                lista.Add(k);
            }
            com.Dispose();

            return(lista);
        }
Esempio n. 5
0
        private void picbKoseviTeren_MouseUp(object sender, MouseEventArgs e)
        {
            Kosevi kos = new Kosevi();

            kos.Set_XY((decimal)e.Location.X, (decimal)e.Location.Y, (decimal)picbKoseviTeren.Height, (decimal)picbKoseviTeren.Width);
            if (s == 'E')
            {
                kos.Suter_id = ekipa.Id;
            }
            else if (s == 'I')
            {
                kos.Suter_id = gridView.igrac_id.Id;
            }
            kos.Vrsta_sut = s;
            //koordinate za izracunavanje pozicjie klika
            var X     = picbKoseviTeren.Location.X + e.Location.X;
            var Y     = picbKoseviTeren.Location.Y + e.Location.Y;
            var formX = this.DesktopLocation.X;
            var formY = this.DesktopLocation.Y;

            //salje se na popup fomu
            try
            {
                using (var form = new Kosevi_popup(X, Y, formX, formY, kos))
                {
                    form.ShowDialog();
                    if (form.status == true)
                    {
                        Change_label("Šut je zabilježen");
                    }
                }
            }
            catch (ArgumentException err)
            {
                lblKoseviResult.ForeColor = Color.Red;
                Change_label("greška kod unosa šuta: " + err.ToString());
            }
        }