Beispiel #1
0
        private void ChangeTypeContent(bool st)
        {
            if (st)
            {
                last_versionTextBox.Enabled   = true;
                numericUpDown1.Enabled        = true;
                OnlineProtectionsList.Enabled = true;
                PlatformsList.Enabled         = true;
                if (AddingGame.ID_Game >= 1)
                {
                    return;
                }
                button6.Enabled = true;
                button7.Enabled = true;
            }
            else
            {
                AddingGame.Last_version     = AddingGame.OriginalGame.Last_version;
                last_versionTextBox.Enabled = false;
                AddingGame.Kol_updates      = AddingGame.OriginalGame.Kol_updates;
                numericUpDown1.Enabled      = false;

                AddingGame.Online_protections = AddingGame.OriginalGame.Online_protections;
                for (var i = 0; i < OnlineProtectionsList.Items.Count; i++)
                {
                    if (AddingGame.Online_protections.Any(p => p.ID_Protect == ((Online_protections)OnlineProtectionsList.Items[i]).ID_Protect))
                    {
                        OnlineProtectionsList.SetItemChecked(i, true);
                    }
                }
                OnlineProtectionsList.Enabled = false;

                AddingGame.Platforms = AddingGame.OriginalGame.Platforms;
                for (var i = 0; i < PlatformsList.Items.Count; i++)
                {
                    if (AddingGame.Platforms.Any(p => p.ID_Platform == ((Platforms)PlatformsList.Items[i]).ID_Platform))
                    {
                        PlatformsList.SetItemChecked(i, true);
                    }
                }
                PlatformsList.Enabled = false;

                button6.Enabled = false;
                button7.Enabled = false;
            }
        }
Beispiel #2
0
        public AddCollect(Games game)
        {
            InitializeComponent();
            gamesBindingSource1.DataSource = _context.Games.ToList().OrderBy(g => g.GetFullName());

            label3.Text = Settings.Default.DistrReg;

            PlatformsList.DataSource    = platformsBindingSource;
            PlatformsList.DisplayMember = "Name";
            PlatformsList.ValueMember   = "ID_Platform";
            PlatformsList.DataSource    = _context.Platforms.ToList();

            OnlineProtectionsList.DataSource    = online_protectionsBindingSource;
            OnlineProtectionsList.DisplayMember = "Name";
            OnlineProtectionsList.ValueMember   = "ID_Protect";
            OnlineProtectionsList.DataSource    = _context.Online_protections.ToList();

            DiskTypes.DataSource = _context.Disk_types.ToList();

            var LP = new List <Publishers> {
                new Publishers {
                    Name = "<отсутствует>", Id_Publisher = 0
                }
            };

            LP.AddRange(_context.Publishers.OrderBy(p => p.Name).ToArray());
            comboBox2.DataSource = LP;

            var LRF = new List <RF_Distributors> {
                new RF_Distributors {
                    Name = "<отсутствует>", ID_RF_Distributor = 0
                }
            };

            LRF.AddRange(_context.RF_Distributors.OrderBy(r => r.Name).ToArray());
            comboBox3.DataSource = LRF;

            var le = new List <Editions> {
                new Editions {
                    Name = "<отсутствует>", ID_Edition = 0
                }
            };

            le.AddRange(_context.Editions.ToArray());
            comboBox6.DataSource = le;

            var lb = new List <Boxes> {
                new Boxes {
                    Name = "<отсутствует>", ID_Box = 0
                }
            };

            lb.AddRange(_context.Boxes.ToArray());
            comboBox7.DataSource = lb;

            if (game == null)
            {
                AddingGame                   = _context.Games.Create();
                AddingGame.ID_Game           = (_context.Games.Any() ? _context.Games.Max(p => p.ID_Game) : 0) + 1;
                AddingGame.Game_disks        = new Collection <Game_disks>();
                AddingGame.Game_Type         = false;
                AddingGame.ID_Publisher      = 0;
                AddingGame.ID_RF_Distributor = 0;
                AddingGame.ID_Box            = 0;
                AddingGame.ID_Edition        = 0;
                AddBut.Visible               = true;
                EditButton.Visible           = false;
                AcceptButton                 = AddBut;
            }
            else
            {
                AddingGame         = game;
                AddBut.Visible     = false;
                EditButton.Visible = true;
                if (AddingGame.Original_Name != null)
                {
                    OriginalNameEn.Checked       = true;
                    original_NameTextBox.Enabled = true;
                }
                else
                {
                    OriginalNameEn.Checked       = false;
                    original_NameTextBox.Enabled = false;
                }

                if (AddingGame.ID_Publisher == null)
                {
                    AddingGame.ID_Publisher = 0;
                }

                if (AddingGame.ID_RF_Distributor == null)
                {
                    AddingGame.ID_RF_Distributor = 0;
                }


                for (var i = 0; i < PlatformsList.Items.Count; i++)
                {
                    if (AddingGame.Platforms.Any(p => p.ID_Platform == ((Platforms)PlatformsList.Items[i]).ID_Platform))
                    {
                        PlatformsList.SetItemChecked(i, true);
                    }
                }

                for (var i = 0; i < OnlineProtectionsList.Items.Count; i++)
                {
                    if (AddingGame.Online_protections.Any(p => p.ID_Protect == ((Online_protections)OnlineProtectionsList.Items[i]).ID_Protect))
                    {
                        OnlineProtectionsList.SetItemChecked(i, true);
                    }
                }

                listBox1.Items.AddRange(AddingGame.GamesInCollect.ToArray());

                if (AddingGame.Poster != null)
                {
                    var stream = new MemoryStream(AddingGame.Poster);
                    posterPictureBox.Image = Image.FromStream(stream);
                    label13.Visible        = false;
                }
                else
                {
                    posterPictureBox.Image = null;
                }
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                button5.Enabled = false;
                button6.Enabled = false;
                button7.Enabled = false;
                AcceptButton    = EditButton;
            }
            GameDiskList.DataSource       = AddingGame.Game_disks.ToList();
            gamesBindingSource.DataSource = new[] { AddingGame };
        }
Beispiel #3
0
        public AddContent(Games game, byte ctc)
        {
            InitializeComponent();
            rate_IgromaniaLabel.Text = string.Format("Рейтинг {0}:", Settings.Default.Recenzor);
            label3.Text            = Settings.Default.DistrReg;
            PersonRate.Maximum     = Settings.Default.MaxYourRating;
            numericUpDown2.Maximum = Settings.Default.MaxRecenzorRating;

            PlatformsList.DataSource    = platformsBindingSource;
            PlatformsList.DisplayMember = "Name";
            PlatformsList.ValueMember   = "ID_Platform";
            PlatformsList.DataSource    = _context.Platforms.ToList();

            OnlineProtectionsList.DataSource    = online_protectionsBindingSource;
            OnlineProtectionsList.DisplayMember = "Name";
            OnlineProtectionsList.ValueMember   = "ID_Protect";
            OnlineProtectionsList.DataSource    = _context.Online_protections.ToList();


            DiskTypes.DataSource = _context.Disk_types.ToList();

            var lp = new List <Publishers> {
                new Publishers {
                    Name = "<отсутствует>", Id_Publisher = 0
                }
            };

            lp.AddRange(_context.Publishers.OrderBy(p => p.Name).ToArray());
            comboBox2.DataSource = lp;

            var ld = new List <Developers> {
                new Developers {
                    Name = "<отсутствует>", ID_Developer = 0
                }
            };

            ld.AddRange(_context.Developers.OrderBy(d => d.Name).ToArray());
            comboBox1.DataSource = ld;

            var lrf = new List <RF_Distributors> {
                new RF_Distributors {
                    Name = "<отсутствует>", ID_RF_Distributor = 0
                }
            };

            lrf.AddRange(_context.RF_Distributors.OrderBy(r => r.Name).ToArray());
            comboBox3.DataSource = lrf;

            var le = new List <Editions> {
                new Editions {
                    Name = "<отсутствует>", ID_Edition = 0
                }
            };

            le.AddRange(_context.Editions.ToArray());
            comboBox6.DataSource = le;

            var lb = new List <Boxes> {
                new Boxes {
                    Name = "<отсутствует>", ID_Box = 0
                }
            };

            lb.AddRange(_context.Boxes.ToArray());
            comboBox7.DataSource = lb;

            if ((game.ID_Content == null) || (ctc == 1))
            {
                AddingGame              = _context.Games.Create();
                AddingGame.ID_Game      = (_context.Games.Any() ? _context.Games.Max(p => p.ID_Game) : 0) + 1;
                AddingGame.Game_Type    = false;
                AddingGame.TypeContent  = false;
                AddingGame.ID_Developer = game.ID_Developer ?? 0;

                AddingGame.ID_Publisher = game.ID_Publisher ?? 0;

                AddingGame.ID_RF_Distributor = game.ID_RF_Distributor ?? 0;

                AddingGame.ID_Box            = 0;
                AddingGame.ID_Edition        = 0;
                AddingGame.Localisation_Type = game.Localisation_Type;
                comboBox4.SelectedIndex      = Decimal.ToInt32(AddingGame.Localisation_Type ?? 0);
                comboBox5.SelectedIndex      = 0;
                AddBut.Visible     = true;
                EditButton.Visible = false;
                AddingGame.Series  = game.Series;
                AddingGame.Genres  = game.Genres;

                AddingGame.ID_Content   = game.ID_Game;
                AddingGame.OriginalGame = game;
                AddingGame.Game_disks   = new Collection <Game_disks>();
                ChangeTypeContent(false);
                AcceptButton = AddBut;
            }
            else
            {
                AddingGame         = game;
                AddBut.Visible     = false;
                EditButton.Visible = true;
                if (AddingGame.Original_Name != null)
                {
                    OriginalNameEn.Checked       = true;
                    original_NameTextBox.Enabled = true;
                }
                else
                {
                    OriginalNameEn.Checked       = false;
                    original_NameTextBox.Enabled = false;
                }

                if (AddingGame.ID_Developer == null)
                {
                    AddingGame.ID_Developer = 0;
                }

                if (AddingGame.ID_Publisher == null)
                {
                    AddingGame.ID_Publisher = 0;
                }

                if (AddingGame.ID_RF_Distributor == null)
                {
                    AddingGame.ID_RF_Distributor = 0;
                }

                comboBox4.SelectedIndex = Decimal.ToInt32(AddingGame.Localisation_Type ?? 0);
                comboBox5.SelectedIndex = Decimal.ToInt32(AddingGame.Status_complite);

                for (var i = 0; i < PlatformsList.Items.Count; i++)
                {
                    if (AddingGame.Platforms.Any(p => p.ID_Platform == ((Platforms)PlatformsList.Items[i]).ID_Platform))
                    {
                        PlatformsList.SetItemChecked(i, true);
                    }
                }

                for (var i = 0; i < OnlineProtectionsList.Items.Count; i++)
                {
                    if (AddingGame.Online_protections.Any(p => p.ID_Protect == ((Online_protections)OnlineProtectionsList.Items[i]).ID_Protect))
                    {
                        OnlineProtectionsList.SetItemChecked(i, true);
                    }
                }

                if (AddingGame.Poster != null)
                {
                    var stream = new MemoryStream(AddingGame.Poster);
                    posterPictureBox.Image = Image.FromStream(stream);
                    label13.Visible        = false;
                }
                else
                {
                    posterPictureBox.Image = null;
                }

                ChangeTypeContent(AddingGame.TypeContent ?? false);
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                button5.Enabled = false;
                button8.Enabled = false;
                AcceptButton    = EditButton;
            }

            SerName.Text = AddingGame.Series != null ? AddingGame.Series.Name : "<отсутствует>";

            GenLst.Text             = String.Join("\n", AddingGame.Genres.Select(g => g.Name));
            GameDiskList.DataSource = AddingGame.Game_disks.ToList();
            ParentGameName.Text     = AddingGame.OriginalGame.GetFullName().Contains(":")
                                ? string.Format("{0} -", AddingGame.OriginalGame.GetFullName())
                                : string.Format("{0}:", AddingGame.OriginalGame.GetFullName());
            if (AddingGame.OriginalGame.OriginalGame != null)
            {
                StandAlone.Checked = false;
                StandAlone.Enabled = false;
            }
            nameTextBox.Left     = ParentGameName.Right + 5;
            rectangleShape1.Left = ParentGameName.Right + 3;

            gamesBindingSource.DataSource = new[] { AddingGame };
        }
Beispiel #4
0
        public AddGame(Games game)
        {
            InitializeComponent();
            rate_IgromaniaLabel.Text = string.Format("Рейтинг {0}:", Settings.Default.Recenzor);
            label3.Text            = Settings.Default.DistrReg;
            PersonRate.Maximum     = Settings.Default.MaxYourRating;
            numericUpDown2.Maximum = Settings.Default.MaxRecenzorRating;

            PlatformsList.DataSource    = platformsBindingSource;
            PlatformsList.DisplayMember = "Name";
            PlatformsList.ValueMember   = "ID_Platform";
            PlatformsList.DataSource    = _context.Platforms.ToList();

            OnlineProtectionsList.DataSource    = online_protectionsBindingSource;
            OnlineProtectionsList.DisplayMember = "Name";
            OnlineProtectionsList.ValueMember   = "ID_Protect";
            OnlineProtectionsList.DataSource    = _context.Online_protections.ToList();

            GenresList.DataSource    = genresBindingSource;
            GenresList.DisplayMember = "Name";
            GenresList.ValueMember   = "ID_Genre";
            GenresList.DataSource    = _context.Genres.ToList();

            DiskTypes.DataSource = _context.Disk_types.ToList();

            var LP = new List <Publishers> {
                new Publishers {
                    Name = "<отсутствует>", Id_Publisher = 0
                }
            };

            LP.AddRange(_context.Publishers.OrderBy(p => p.Name).ToArray());
            comboBox2.DataSource = LP;

            var LD = new List <Developers> {
                new Developers {
                    Name = "<отсутствует>", ID_Developer = 0
                }
            };

            LD.AddRange(_context.Developers.OrderBy(d => d.Name).ToArray());
            comboBox1.DataSource = LD;

            var LRF = new List <RF_Distributors> {
                new RF_Distributors {
                    Name = "<отсутствует>", ID_RF_Distributor = 0
                }
            };

            LRF.AddRange(_context.RF_Distributors.OrderBy(r => r.Name).ToArray());
            comboBox3.DataSource = LRF;

            var LS = new List <Series> {
                new Series {
                    Name = "<отсутствует>", ID_Ser = 0
                }
            };

            LS.AddRange(_context.Series.OrderBy(s => s.Name).ToArray());
            comboBox8.DataSource = LS;

            var le = new List <Editions> {
                new Editions {
                    Name = "<отсутствует>", ID_Edition = 0
                }
            };

            le.AddRange(_context.Editions.ToArray());
            comboBox6.DataSource = le;

            var lb = new List <Boxes> {
                new Boxes {
                    Name = "<отсутствует>", ID_Box = 0
                }
            };

            lb.AddRange(_context.Boxes.ToArray());
            comboBox7.DataSource = lb;

            if (game == null)
            {
                AddingGame                   = _context.Games.Create();
                AddingGame.Game_Type         = false;
                AddingGame.ID_Game           = (_context.Games.Any() ? _context.Games.Max(p => p.ID_Game) : 0) + 1;
                AddingGame.Game_disks        = new Collection <Game_disks>();
                AddingGame.ID_Developer      = 0;
                AddingGame.ID_Publisher      = 0;
                AddingGame.ID_RF_Distributor = 0;
                AddingGame.ID_Box            = 0;
                AddingGame.ID_Edition        = 0;
                AddingGame.ID_Ser            = 0;
                comboBox4.SelectedIndex      = 0;
                comboBox5.SelectedIndex      = 0;
                AddBut.Visible               = true;
                EditButton.Visible           = false;
                AcceptButton                 = AddBut;
            }
            else
            {
                AddingGame         = game;
                AddBut.Visible     = false;
                EditButton.Visible = true;
                if (AddingGame.Original_Name != null)
                {
                    OriginalNameEn.Checked       = true;
                    original_NameTextBox.Enabled = true;
                }
                else
                {
                    OriginalNameEn.Checked       = false;
                    original_NameTextBox.Enabled = false;
                }

                if (AddingGame.ID_Developer == null)
                {
                    AddingGame.ID_Developer = 0;
                }

                if (AddingGame.ID_Publisher == null)
                {
                    AddingGame.ID_Publisher = 0;
                }

                if (AddingGame.ID_RF_Distributor == null)
                {
                    AddingGame.ID_RF_Distributor = 0;
                }

                if (AddingGame.ID_Ser == null)
                {
                    AddingGame.ID_Ser = 0;
                }

                if (AddingGame.ID_Box == null)
                {
                    AddingGame.ID_Box = 0;
                }

                if (AddingGame.ID_Edition == null)
                {
                    AddingGame.ID_Edition = 0;
                }


                comboBox4.SelectedIndex = Decimal.ToInt32(AddingGame.Localisation_Type ?? 0);
                comboBox5.SelectedIndex = Decimal.ToInt32(AddingGame.Status_complite);


                for (var i = 0; i < PlatformsList.Items.Count; i++)
                {
                    if (AddingGame.Platforms.Any(p => p.ID_Platform == ((Platforms)PlatformsList.Items[i]).ID_Platform))
                    {
                        PlatformsList.SetItemChecked(i, true);
                    }
                }

                for (var i = 0; i < GenresList.Items.Count; i++)
                {
                    if (AddingGame.Genres.Any(p => p.ID_Genre == ((Genres)GenresList.Items[i]).ID_Genre))
                    {
                        GenresList.SetItemChecked(i, true);
                    }
                }

                for (var i = 0; i < OnlineProtectionsList.Items.Count; i++)
                {
                    if (AddingGame.Online_protections.Any(p => p.ID_Protect == ((Online_protections)OnlineProtectionsList.Items[i]).ID_Protect))
                    {
                        OnlineProtectionsList.SetItemChecked(i, true);
                    }
                }

                if (AddingGame.Poster != null)
                {
                    var stream = new MemoryStream(AddingGame.Poster);
                    posterPictureBox.Image = Image.FromStream(stream);
                    label13.Visible        = false;
                }
                else
                {
                    posterPictureBox.Image = null;
                }
                button1.Enabled  = false;
                button2.Enabled  = false;
                button3.Enabled  = false;
                button4.Enabled  = false;
                button5.Enabled  = false;
                button6.Enabled  = false;
                button7.Enabled  = false;
                button8.Enabled  = false;
                button9.Enabled  = false;
                button10.Enabled = false;
                AcceptButton     = EditButton;
            }
            GameDiskList.DataSource       = AddingGame.Game_disks.ToList();
            gamesBindingSource.DataSource = new[] { AddingGame };
        }