private void btnAddColor_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in lviColors.SelectedItems)
     {
         Models.Color color = db.Colors.Where(x => x.Id == (int)item.Tag).FirstOrDefault();
         selectedTeam.Colors.Add(color);
     }
     lstTeamColors.DataSource = selectedTeam.Colors.ToList();
     db.SaveChanges();
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     match.Result    = (Result)cboResult.SelectedItem;
     match.Score1    = (int)nudTeam1Score.Value;
     match.Score2    = (int)nudTeam2Score.Value;
     match.MatchTime = dtpMatchTime.Value;
     db.SaveChanges();
     this.Close();
 }
Exemple #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int colorId = (int)listViewItem.Tag;

            Models.Color selectedColor = db.Colors.Where(x => x.Id == colorId).FirstOrDefault();
            selectedColor.Red       = (int)nudRed.Value;
            selectedColor.Green     = (int)nudGreen.Value;
            selectedColor.Blue      = (int)nudBlue.Value;
            selectedColor.ColorName = txtColorName.Text.Trim();
            db.SaveChanges();
            this.Close();
        }
        private void btnAddColor_Click(object sender, EventArgs e)
        {
            DialogResult dr = cdColor.ShowDialog();

            if (dr == DialogResult.OK)
            {
                string promptValue = Prompt.ShowDialog("Renk adı giriniz:", "Renk-Adı");
                if (promptValue == "")
                {
                    promptValue = cdColor.Color.Name;
                }
                Models.Color color = new Models.Color()
                {
                    Red       = cdColor.Color.R,
                    Blue      = cdColor.Color.B,
                    Green     = cdColor.Color.G,
                    ColorName = promptValue
                };
                db.Colors.Add(color);
                db.SaveChanges();
                LoadColors();
            }
        }
Exemple #5
0
        private void btnCreateMatch_Click(object sender, EventArgs e)
        {
            Match match = new Match();

            match.MatchTime = dtpMatchTime.Value;

            match.Team1Id = team1.Id;
            match.Team1   = team1;
            match.Team2Id = team2.Id;
            match.Team2   = team2;
            match.Score1  = (int)nudTeam1Score.Value;
            match.Score2  = (int)nudTeam2Score.Value;
            if (cboResult.SelectedIndex != -1)
            {
                match.Result = (Result)cboResult.SelectedItem;
            }
            db.Matches.Add(match);
            db.SaveChanges();
            this.Close();
        }
Exemple #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     player.PlayerName = txtPlayerName.Text.Trim();
     player.PhotoPath  = txtPlayerPhotoPath.Text.Trim();
     player.Team       = (Team)cboTeams.SelectedItem;
     if (txtPlayerPhotoPath.Text != "")
     {
         MemoryStream   stream    = new MemoryStream();
         HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(txtPlayerPhotoPath.Text.Trim());
         myRequest.Method = "GET";
         HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
         Bitmap          bmp        = new Bitmap(myResponse.GetResponseStream());
         bmp.Save(stream, ImageFormat.Jpeg);
         player.Photo = stream.GetBuffer();
     }
     else
     {
         player.Photo = (byte[])new ImageConverter().ConvertTo(WeAreTheChampions.Properties.Resources.anonim, typeof(byte[]));
     }
     db.SaveChanges();
     this.Close();
 }