Пример #1
0
        public ActionResult GetStd_pdt_value(AddInspection_projectViewModel vm)
        {
            //int bridgeStructure_type, double bridgeLength, double bridgeWidth, int bridgeNspan, int inspection_type)
            int    bridgeStructure_type = (int)vm.bridge_structure_type; //桥梁结构类型
            int    inspection_type      = (int)vm.inspection_type;       //检测类型
            double bridgeLength         = (double)vm.bridge_length;
            double bridgeWidth          = (double)vm.bridge_width;
            int    bridgeNspan          = (int)vm.bridge_span_number;
            //int bridgeStructure_type, double bridgeLength, double bridgeWidth, int bridgeNspan, int inspection_type
            //TempData["std_pdt_value"] = GetQuota.GetStdPdtValue(bridgeStructure_type, bridgeLength, bridgeWidth, bridgeNspan, inspection_type);
            decimal std_pdt_value = GetQuota.GetStdPdtValue(bridgeStructure_type, bridgeLength, bridgeWidth, bridgeNspan, inspection_type);

            var newViewModel = new AddInspection_projectViewModel
            {
                contract_id           = vm.contract_id,
                contract_name         = vm.contract_name,
                inspection_type       = vm.inspection_type,
                bridge_id             = vm.bridge_id,
                bridge_name           = vm.bridge_name,
                bridge_structure_type = vm.bridge_structure_type,
                standard_price        = std_pdt_value
            };

            ModelState.Clear();

            return(View("AddInspection_project", newViewModel));
            //return View(newView);
            //return RedirectToAction("AddInspection_project", newViewModel);
        }
Пример #2
0
        public void TestStdPdtValue()
        {
            //arrange

            //石拱桥、圬工拱桥
            int bridgeStructure_type = 2;

            //结构定期检测
            int inspection_type = 2;

            double bridgeLength = 35;
            double bridgeWidth  = 42;
            int    bridgeNspan  = 2; //桥梁跨数

            //action
            decimal std_pdt_price = GetQuota.GetStdPdtValue(bridgeStructure_type, bridgeLength, bridgeWidth, bridgeNspan, inspection_type);

            decimal key = 35000 + 120 * (35 - 30) + 120 * (42 - 40) + 0 * (2 - 1);    //答案

            //assert
            Assert.AreEqual(std_pdt_price, key);
        }