1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WSUniversalLib
- {
- public class Calculation
- {
- public static int GetQuantityForProduct(int productType, int materialType, int count, float width, float length)
- {
-
- double sqaure = width * length;
- double quantity;
- switch(productType)
- {
- case 1:
- quantity = sqaure * 1.1;
- break;
- case 2:
- quantity = sqaure * 2.5;
- break;
- case 3:
- quantity = sqaure * 8.43;
- break;
- default:
- return -1;
- break;
- }
- quantity = quantity * count;
- switch(materialType)
- {
- case 1:
- quantity = quantity * 1.003;
- break;
- case 2:
- quantity = quantity * 1.0012;
- break;
- default:
- return -1;
- break;
- }
- return Convert.ToInt32(Math.Ceiling(quantity));
- }
- }
- }
|