Beispiel #1
0
        private void listTipsters_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            e.DrawFocusRectangle();
            Tipster tipster = listTipsters.Items[e.Index] as Tipster;

            if (tipster.Valid.Equals("n"))
            {
                e.Graphics.DrawString(tipster.ToString(), new Font("Lucida Console", 9.75F, FontStyle.Regular, GraphicsUnit.Pixel), new SolidBrush(Color.Red), e.Bounds);
            }
            else
            {
                e.Graphics.DrawString(tipster.ToString(), new Font("Lucida Console", 9.75F, FontStyle.Regular, GraphicsUnit.Pixel), new SolidBrush(Color.Black), e.Bounds);
            }
        }
Beispiel #2
0
        //Vo listBox gi stava tipsterite
        public void select_tipsters()
        {
            using (OracleConnection connection = new OracleConnection(FormLogin.connString))
            {
                connection.Open(); // NIKAKO NE SMEE DA SE ZABORAVI!
                String queryTipsters = "SELECT * FROM Tipster";

                OracleCommand command = new OracleCommand(queryTipsters, connection);
                command.CommandType = CommandType.Text;
                OracleDataReader reader = command.ExecuteReader();
                listTipsters.Items.Clear();
                while (reader.Read())
                {
                    Tipster tipster = new Tipster(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetInt32(5), reader.GetString(6), reader.GetString(7));
                    listTipsters.Items.Add(tipster);
                }
            }


            listTipsters.SelectedIndex = 0;
        }
Beispiel #3
0
 //Gi menuva podatocite za tipsterot od desnata strana pri promena na selektiraniot indeks
 private void listTipsters_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listTipsters.SelectedIndex >= 0)
     {
         Tipster tipster = (Tipster)listTipsters.SelectedItem;
         lblUsernameData.Text = tipster.Username;
         lblPasswordData.Text = tipster.Password;
         lblNameData.Text     = tipster.Name;
         lblSurnameData.Text  = tipster.Surname;
         lblEmailData.Text    = tipster.Email;
         lblRatingData.Text   = String.Format("{0}", tipster.Money);
         if (tipster.Valid.Equals("n"))
         {
             btnBan.Text = FormLogin.translator["UnBanBtn " + FormLogin.currLanguage];
         }
         else
         {
             btnBan.Text = FormLogin.translator["BanBtn " + FormLogin.currLanguage];
         }
     }
 }
Beispiel #4
0
        //Metod za baniranje na tipsterite
        private void btnBan_Click(object sender, EventArgs e)
        {
            if (listTipsters.SelectedIndex >= 0)
            {
                Tipster tipster = (Tipster)listTipsters.SelectedItem;
                String  valid   = "'y'";
                if (tipster.Valid.Equals("y"))
                {
                    valid = "'n'";
                }
                String queryBan = "UPDATE Tipster SET valid = " + valid + " WHERE idTipster=" + tipster.IdTipster;

                using (OracleConnection connection = new OracleConnection(FormLogin.connString))
                {
                    connection.Open();
                    OracleCommand command = new OracleCommand(queryBan, connection);
                    command.CommandType = CommandType.Text;
                    command.ExecuteNonQuery();
                }
                int selectedIndex = listTipsters.SelectedIndex;
                FormAdmin_Load(this, null);
                listTipsters.SelectedIndex = selectedIndex;
            }
        }
Beispiel #5
0
        //Vo listBox gi stava tipsterite
        public void select_tipsters()
        {
            using (OracleConnection connection = new OracleConnection(FormLogin.connString))
            {
                connection.Open(); // NIKAKO NE SMEE DA SE ZABORAVI! 
                String queryTipsters = "SELECT * FROM Tipster";

                OracleCommand command = new OracleCommand(queryTipsters, connection);
                command.CommandType = CommandType.Text;
                OracleDataReader reader = command.ExecuteReader();
                listTipsters.Items.Clear();
                while (reader.Read())
                {
                    Tipster tipster = new Tipster(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetInt32(5), reader.GetString(6), reader.GetString(7));
                    listTipsters.Items.Add(tipster);
                }
            }
           
            
            listTipsters.SelectedIndex = 0;
        }