1234567891011121314151617181920212223242526 |
- 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)
- {
- float coef;
- if (productType == 1) { coef = 1.1f; }
- else if (productType == 2) { coef = 2.5f; }
- else if (productType == 3) { coef = 8.43f; }
- else { return -1; }
- float square = width * length;
- float rez = square * coef;
- if (materialType == 1) { rez += rez * 0.003f; }
- else if (materialType == 2) { rez += rez * 0.0012f; }
- else { return -1; }
- return (int)Math.Round(Convert.ToDouble(rez) * count);
- }
- }
- }
|