Example #1
0
        public void AddData(string name, object value)
        {
            switch (name)
            {
            case "КодКонтента": ID.Add((int)value); break;

            case "Название": ContentName.Add((string)value); break;

            case "Рейтинг": Rating.Add(double.Parse(value.ToString())); break;

            case "Год": Year.Add((int)value); break;

            case "Сюжет": Story.Add((string)value); break;

            case "Продолжительность": Duration.Add((int)value); break;

            case "ЦенаПокупки": PurchasePrice.Add(double.Parse(value.ToString())); break;

            case "ЦенаПроката": RentalPrice.Add(double.Parse(value.ToString())); break;

            case "Постер": Poster.Add((string)value); break;

            default: MessageBox.Show($"Поле {name} отсутствует!"); break;
            }
        }
Example #2
0
        public SkillGroup(string name, int[] rating, string[] skills) : this()
        {
            Name = name;

            // Ensure rating has elements for all classes
            if (rating.Length != Consts.Classes.ClassTable.Count)
            {
                throw new ArgumentOutOfRangeException(String.Format("You must include ratings for all classes - passed {0}, expected {1}", rating.Length, Consts.Classes.ClassTable.Count), "rating");
            }
            else
            {
                // Loop over the rating array, appending to the Ratings property
                for (int i = 0; i < rating.Length; i++)
                {
                    Rating.Add(Consts.Classes.ClassTable[i], rating[i]);
                }
            }

            // Ensure skillsInGroup has at least 1 element
            if (skills.Length == 0)
            {
                throw new ArgumentOutOfRangeException("You must pass at least one skill name", "skillsInGroup");
            }
            else
            {
                // Loop over each skill/group in skillsInGroup
                foreach (string skill in skills)
                {
                    // Attempt to find a corresponding skill
                    SkillType matchedSkill = Consts.Skills.SkillTable.SingleOrDefault <SkillType>(s => s.Name.ToLower().Equals(skill.ToLower()));

                    // Did we find one?
                    if (matchedSkill != null)
                    {
                        // Add to the resolved list
                        Skills.Add(matchedSkill);
                    }
                    else
                    {
                        // Check for a group matching the name instead
                        SkillGroup matchedGroup = Consts.Skills.SkillGroupTable.SingleOrDefault(g => g.Name.ToLower().Equals(skill.ToLower()));

                        // Did we find one?
                        if (matchedGroup != null)
                        {
                            // Add the group's skills to the resolved list
                            Skills.AddRange(matchedGroup.Skills);
                        }
                        else
                        {
                            // Log a warning and continue
                            Logging.Log.Warn(String.Format("Unable to find matching skill or group for \"{0}\" defined in skill group {1}", skill, Name));
                        }
                    }
                }
            }
        }
        public SecuritesByRiskAndTypes()
        {
            Rating.Add(new PieData("AA", 13));
            Rating.Add(new PieData("MBB+", 7));
            Rating.Add(new PieData("BBB", 45));
            Rating.Add(new PieData("BBB-", 20));
            Rating.Add(new PieData("NR", 15));

            Security.Add(new PieData("FRN", 16.0));
            Security.Add(new PieData("FCB", 41.0));
            Security.Add(new PieData("CIB", 25.0));
            Security.Add(new PieData("IAB", 18.0));
        }