Пример #1
0
        private bool ConvertAndValidateData(string name, string firstSide, string secondSide, string thirdSide)
        {
            DataValidator validator = new DataValidator();

            bool result = validator.GetData(name, DataConvertor.ConvertData(firstSide),
                                            DataConvertor.ConvertData(secondSide),
                                            DataConvertor.ConvertData(thirdSide));

            return(result);
        }
Пример #2
0
        public bool AddNewTriangle(string name, string firstSide, string secondSide, string thirdSide)
        {
            bool isAdd = false;

            if (ConvertAndValidateData(name, firstSide, secondSide, thirdSide))
            {
                TriangleComparer someTriangle = new TriangleComparer(name, DataConvertor.ConvertData(firstSide),
                                                                     DataConvertor.ConvertData(secondSide),
                                                                     DataConvertor.ConvertData(thirdSide));
                someTriangle.GetTriangleSquare();

                _triangle.Add(someTriangle);

                _triangle.Sort();
                _triangle.Reverse();

                isAdd = true;
            }

            return(isAdd);
        }