Пример #1
0
 public TaskInfo(FileInfo file_info1, FileInfo fileInfo2, TypeOfOperation typeOfOperation)
 {
     FileInputInfo   = file_info1;
     FileOutputInfo  = fileInfo2;
     TypeOfOperation = typeOfOperation;
     GetStartBlockCount(file_info1);
 }
Пример #2
0
 public Report(DateTime date, TypeOfOperation type, string sender, string receiver)
 {
     Date          = date;
     OperationType = type;
     SenderId      = sender;
     ReceiverId    = receiver;
 }
Пример #3
0
 /// <summary>
 /// Operation Class
 /// </summary>
 /// <param name="first">Firts Number</param>
 /// <param name="second">Second Number</param>
 /// <param name="type">Type of Operation</param>
 /// <param name="sub1">Sub Operation of First number</param>
 /// <param name="sub2">Sub Operation of Second number</param>
 public Operation(string first = null, string second = null, TypeOfOperation type = TypeOfOperation.NULL, SubOperations sub1 = SubOperations.NULL, SubOperations sub2 = SubOperations.NULL)
 {
     Type      = type;
     FirstNum  = first;
     SecondNum = second;
     FirstSub  = sub1;
     SecondSub = sub2;
 }
Пример #4
0
        static GeometricPatameter GetHypotheticalResults(ShapeType typeOfShape, TypeOfOperation typeOfOperation, double result)
        {
            GeometricPatameter hypotheticalResultParam = new GeometricPatameter();

            switch (typeOfShape)
            {
            case ShapeType.Triangle:

                switch (typeOfOperation)
                {
                case TypeOfOperation.Perimeter:
                    hypotheticalResultParam.Radius           = result / 2 * Math.PI;
                    hypotheticalResultParam.SideOfQuadrangle = result / 4;
                    break;

                case TypeOfOperation.Square:
                    hypotheticalResultParam.Radius           = Math.Sqrt(result / Math.PI);
                    hypotheticalResultParam.SideOfQuadrangle = Math.Sqrt(result);
                    break;
                }
                break;

            case ShapeType.Quadrangle:

                switch (typeOfOperation)
                {
                case TypeOfOperation.Perimeter:
                    hypotheticalResultParam.Radius         = result / 2 * Math.PI;
                    hypotheticalResultParam.SideOfTriangle = result / 3;
                    break;

                case TypeOfOperation.Square:
                    hypotheticalResultParam.Radius         = Math.Sqrt(result / Math.PI);
                    hypotheticalResultParam.SideOfTriangle = Math.Sqrt(4 * result / Math.Sqrt(3));
                    break;
                }
                break;

            case ShapeType.Circle:
                switch (typeOfOperation)
                {
                case TypeOfOperation.Perimeter:
                    hypotheticalResultParam.SideOfQuadrangle = result / 4;
                    hypotheticalResultParam.SideOfTriangle   = result / 3;
                    break;

                case TypeOfOperation.Square:
                    hypotheticalResultParam.SideOfTriangle   = Math.Sqrt(4 * result / Math.Sqrt(3));
                    hypotheticalResultParam.SideOfQuadrangle = Math.Sqrt(result);
                    break;
                }
                break;
            }

            return(hypotheticalResultParam);
        }
Пример #5
0
        public async Task <IActionResult> Post([FromBody] TypeOfOperation typeOfOperation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _repository.Save(typeOfOperation);

            return(CreatedAtAction("Get", new { id = typeOfOperation.TypeOfOperationId }, typeOfOperation));
        }
        public async Task Update(TypeOfOperationViewModel typeOfOperation)
        {
            var c = new TypeOfOperation
            {
                TypeOfOperationId = typeOfOperation.TypeOfOperationId,
                Name     = typeOfOperation.Name,
                IsActive = typeOfOperation.IsActive
            };

            _db.TypeOfOperations.Update(c);
            await _db.SaveChangesAsync();
        }
Пример #7
0
        public bool action(Document <T> document, TypeOfOperation typeOfOperation)
        {
            bool result = true;

            switch (typeOfOperation)
            {
            case TypeOfOperation.GET:  getDocumentByKeyValue(document, "", ""); break;

            case TypeOfOperation.POST: postDocument(document); break;
            }
            return(result);
        }
Пример #8
0
        public async Task Post_ReturnsPostedTypeOfOperationOnSuccess()
        {
            var typeOfOperation = new TypeOfOperation {
                Name = "Cool Flight", IsActive = true
            };

            _mockRepositoryTypeOfOperation.Setup(x => x.GetAll()).ReturnsAsync(_typeOfOperations);

            var result = await _typeOfOperationController.Post(typeOfOperation);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.GetType() == typeof(CreatedAtActionResult));
            Assert.AreEqual(typeOfOperation, (result as CreatedAtActionResult)?.Value);
        }
Пример #9
0
        public async Task Post_ReturnsBadRequestOnInvalidModelState()
        {
            var typeOfOperation = new TypeOfOperation {
                Name = "Bas Flight", IsActive = true
            };

            _mockRepositoryTypeOfOperation.Setup(x => x.GetAll()).ReturnsAsync(_typeOfOperations);

            _typeOfOperationController.ModelState.AddModelError("test", "test");
            var result = await _typeOfOperationController.Post(typeOfOperation);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.GetType() == typeof(BadRequestObjectResult));
        }
Пример #10
0
        static void ShowSizesCalculations(double result, TypeOfOperation typeOfOperation, ShapeType typeOfShape)
        {
            Console.Clear();

            switch (typeOfOperation)
            {
            case TypeOfOperation.Perimeter:
                Console.WriteLine($"the perimeter of this {typeOfShape} is {result}\n" + "");
                break;

            case TypeOfOperation.Square:
                Console.WriteLine($"the area of this {typeOfShape} is {result}\n" + "");
                break;
            }
        }
Пример #11
0
        static void Main()
        {
            ShapeType       typeOfShape     = GetTypeOfShape();
            TypeOfOperation typeOfOperation = GetTypeOfOperation(typeOfShape);
            double          userValue       = GetUserValue(typeOfShape);
            GeometricShape  shape           = new GeometricShape(typeOfShape, userValue);
            double          result          = Calculate(shape, typeOfOperation);

            ShowSizesCalculations(result, typeOfOperation, typeOfShape);
            GeometricPatameter hypotheticalResults = GetHypotheticalResults(typeOfShape, typeOfOperation, result);

            ShowSizesHypotheticalCalculations(hypotheticalResults, typeOfOperation, typeOfShape);

            Console.ReadKey();
        }
Пример #12
0
        static double Calculate(GeometricShape shape, TypeOfOperation typeOfOperation)
        {
            double result = 0;

            switch (typeOfOperation)
            {
            case TypeOfOperation.Perimeter:
                result = shape.GetPerimeterOfShape();
                break;

            case TypeOfOperation.Square:
                result = shape.GetSquareOfShape();
                break;
            }

            return(result);
        }
Пример #13
0
 public async Task Save(TypeOfOperation typeOfOperation)
 {
     _db.TypeOfOperations.Add(typeOfOperation);
     await _db.SaveChangesAsync();
 }
Пример #14
0
 private void TypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     _type = (TypeOfOperation)TypeComboBox.SelectedIndex;
 }
Пример #15
0
        static void ShowSizesHypotheticalCalculations(GeometricPatameter hypotheticalResultParam, TypeOfOperation typeOfOperation, ShapeType typeOfShape)
        {
            switch (typeOfShape)
            {
            case ShapeType.Triangle:

                Console.WriteLine($"Hypothetical radius of {ShapeType.Circle} is {hypotheticalResultParam.Radius}");
                Console.WriteLine($"the side of this {ShapeType.Quadrangle} is {hypotheticalResultParam.SideOfQuadrangle}");
                break;

            case ShapeType.Quadrangle:

                Console.WriteLine($"Hypothetical radius of {ShapeType.Circle} is {hypotheticalResultParam.Radius}");
                Console.WriteLine($"Hypothetical side of {ShapeType.Triangle} is {hypotheticalResultParam.SideOfTriangle}");
                break;

            case ShapeType.Circle:

                Console.WriteLine($"Hypothetical side of {ShapeType.Quadrangle} is {hypotheticalResultParam.SideOfQuadrangle}");
                Console.WriteLine($"Hypothetical side of {ShapeType.Triangle} is {hypotheticalResultParam.SideOfTriangle}");
                break;
            }
        }