Ejemplo n.º 1
0
        private void UpdatRefereeBase()
        {
            reffere.Clear();
            Referee r = null;

            foreach (RefereeView item in refereeView)
            {
                switch (item.Role)
                {
                case "Main":
                {
                    r = new MainReferee
                    {
                        ID        = item.ID,
                        FirstName = item.FirstName,
                        LastName  = item.LastName,
                        IsBusy    = item.IsBusy,
                        Role      = item.Role,
                        Salary    = item.Salary,
                        MatchID   = item.MatchID
                    };
                    break;
                }

                case "Technical":
                {
                    r = new TechnicalReferee
                    {
                        ID        = item.ID,
                        FirstName = item.FirstName,
                        LastName  = item.LastName,
                        IsBusy    = item.IsBusy,
                        Role      = item.Role,
                        Salary    = item.Salary,
                        MatchID   = item.MatchID
                    };
                    break;
                }

                case "Linear":
                {
                    r = new LinearReferee
                    {
                        ID        = item.ID,
                        FirstName = item.FirstName,
                        LastName  = item.LastName,
                        IsBusy    = item.IsBusy,
                        Role      = item.Role,
                        Salary    = item.Salary,
                        MatchID   = item.MatchID
                    };
                    break;
                }

                case "Observer":
                {
                    r = new ObserverReferee
                    {
                        ID        = item.ID,
                        FirstName = item.FirstName,
                        LastName  = item.LastName,
                        IsBusy    = item.IsBusy,
                        Role      = item.Role,
                        Salary    = item.Salary,
                        MatchID   = item.MatchID
                    };
                    break;
                }
                }
                SetNextReferee(r);
                reffere.Add(r);
            }
        }
Ejemplo n.º 2
0
        private void AddReffere(object parameter)
        {
            if (!ValidateParams(parameter))
            {
                ShowInfoWindow("Wypełnij pola poprawnie");
                return;
            }
            var    values = (object[])parameter;
            double n;
            double salary    = 0;
            bool   isNumeric = double.TryParse((string)values[2].ToString(), out n);

            if (isNumeric)
            {
                salary = double.Parse((string)values[2].ToString());
            }
            else
            {
                ShowInfoWindow("Wypełnij pola poprawnie");
                return;
            }

            string  role = (string)values[3].ToString();
            Referee r    = null;

            switch (role)
            {
            case "Main":
            {
                r = new MainReferee
                {
                    ID        = Helpers.FindMaxValue(reffere, x => x.ID) + 1,
                    FirstName = values[0].ToString(),
                    LastName  = values[1].ToString(),
                    IsBusy    = false,
                    Salary    = salary,
                    Role      = role
                };
                break;
            }

            case "Technical":
            {
                r = new TechnicalReferee
                {
                    ID        = Helpers.FindMaxValue(reffere, x => x.ID) + 1,
                    FirstName = values[0].ToString(),
                    LastName  = values[1].ToString(),
                    IsBusy    = false,
                    Salary    = salary,
                    Role      = role
                };
                break;
            }

            case "Linear":
            {
                r = new LinearReferee
                {
                    ID        = Helpers.FindMaxValue(reffere, x => x.ID) + 1,
                    FirstName = values[0].ToString(),
                    LastName  = values[1].ToString(),
                    IsBusy    = false,
                    Salary    = salary,
                    Role      = role
                };
                break;
            }

            case "Observer":
            {
                r = new ObserverReferee
                {
                    ID        = Helpers.FindMaxValue(reffere, x => x.ID) + 1,
                    FirstName = values[0].ToString(),
                    LastName  = values[1].ToString(),
                    IsBusy    = false,
                    Salary    = salary,
                    Role      = role
                };
                break;
            }
            }
            SetNextReferee(r);
            reffere.Add(r);
            UpdatRefereeGrid();
        }