public void SetExpressions() { for (int i = 1; i <= 6; i++) { int y = i; P20A.SetExpr(y, () => Projects.Sum(x => x.P20A[y])); P20B.SetExpr(y, () => Projects.Sum(x => x.P20B[y])); P20C.SetExpr(y, () => Projects.Sum(x => x.P20C[y])); P20D.SetExpr(y, () => Projects.Sum(x => x.P20D[y])); P20E.SetExpr(y, () => Projects.Sum(x => x.P20E[y])); P20F.SetExpr(y, () => Projects.Sum(x => x.P20F[y])); P22A.SetExpr(y, () => Projects.Sum(x => x.P22A[y])); var city = DocumentManager.CurrentDocument.City; C8A.SetExpr(y, () => city.C8A[y]); C8B.SetExpr(y, () => city.C8B[y]); C8C_1.SetExpr(y, () => city.C8C[y] * city.C14A); C8D.SetExpr(y, () => city.C8D[y]); C7C.SetExpr(y, () => city.C7C[y]); C8E.SetExpr(y, () => city.C8E[y]); } P20G = new YearwiseSum(P20A, P20B, P20C, P20D, P20E, P20F); }
public void SetExpressions() { P2F = new YearwiseSum(P02 + 10, 10, P2A, P2B, P2C, P2D, P2E); P3T = new YearwiseSum(P02 + 10, 10, P3A, P3B, P3C, P3D, P3E); for (int i = 1; i <= 10; i++) // mod 20120206 { int year = i; P3F.SetExpr(year, () => P2F[year] - P3T[year]); } P5A = new DoubleExpression(() => P3D.KnownYearsSum); P5C = new DoubleExpression(() => DocumentManager.CurrentDocument.City.C10B); P5D = new DoubleExpression(() => DocumentManager.CurrentDocument.City.C10A); P6A = new DoubleExpression(() => P3E.KnownYearsSum); P6C = new DoubleExpression(() => DocumentManager.CurrentDocument.City.C11B); P6D = new DoubleExpression(() => DocumentManager.CurrentDocument.City.C11A); P7E = new DoubleExpression(() => P7A + P7B + P7C + P7D); for (int i = 2; i <= 10; i++) { int year = P02 + i; P14A.SetExprA(year, () => { if (year >= P5B + P5C.GetValue() || year < P5B) { return(0); } else { if (year == P5B) { return(P5A.GetValue()); } else { return(P14A[year - 1]); } } }); P14B.SetExprA(year, () => { if (P14A[year] == 0 || year - P02 <= 0) { return(0); } else { return(P14A[year] - Enumerable.Range(P02 + 1, year - P02).Sum(x => P14D[x])); } }); P14C.SetExprA(year, () => (P14B[year - 1] + P14B[year]) / 2 * P5D.GetValue()); P14D.SetExprA(year, () => P14A[year] / P5C.GetValue()); } for (int i = 2; i <= 10; i++) { int year = P02 + i; P15A.SetExprA(year, () => { if (year >= P6B + P6C.GetValue() || year < P6B) { return(0); } else { if (year == P6B) { return(P6A.GetValue()); } else { return(P15A[year - 1]); } } }); P15B.SetExprA(year, () => { if (P15A[year] == 0 || year - P02 <= 0) { return(0); } else { return(P15A[year] - Enumerable.Range(P02 + 1, year - P02).Sum(x => P15D[x])); } }); P15C.SetExprA(year, () => (P15B[year - 1] + P15B[year]) / 2 * P6D.GetValue()); P15D.SetExprA(year, () => P15A[year] / P6C.GetValue()); } for (int i = 2; i <= 10; i++) { int year = P02 + i; P16A.SetExprA(year, () => { //if(year>P1G+DocumentManager.CurrentDocument.City.C12B) //{ //} return(0); }); P16B.SetExprA(year, () => year > P1F_2 ? P7C : 0); } for (int i = 2; i <= 10; i++) { int year = P02 + i; P17A.SetExprA(year, () => year > P1F_2 ? P4A : 0); P17B.SetExprA(year, () => P14C[year] + P14D[year] + P15C[year] + P15D[year]); } P18_1F = new YearwiseSum(P02 + 8, 14, P18_1A, P18_1B, P18_1C, P18_1D, P18_1E); for (int i = -3; i <= 10; i++) { int year = i; P18_1A.SetExpr(year, () => DocumentManager.CurrentDocument.City.C6A[year]); P18_1B.SetExpr(year, () => DocumentManager.CurrentDocument.City.C6B[year]); P18_1C.SetExpr(year, () => DocumentManager.CurrentDocument.City.C6C[year]); P18_1D.SetExpr(year, () => DocumentManager.CurrentDocument.City.C6D[year]); P18_1E.SetExpr(year, () => DocumentManager.CurrentDocument.City.C6E[year]); } P18_2D = new YearwiseSum(P02 + 8, 14, P18_2A, P18_2B, P18_2C); for (int i = -3; i <= 10; i++) { int year = i; P18_2A.SetExpr(year, () => DocumentManager.CurrentDocument.City.C7A[year]); P18_2B.SetExpr(year, () => DocumentManager.CurrentDocument.City.C7B[year]); P18_2C.SetExpr(year, () => DocumentManager.CurrentDocument.City.C7C[year]); } for (int i = -3; i <= 10; i++) { int year = i; P18A.SetExpr(year, () => DocumentManager.CurrentDocument.City.C8A[year]); P18B.SetExpr(year, () => DocumentManager.CurrentDocument.City.C8B[year]); P18C.SetExpr(year, () => DocumentManager.CurrentDocument.City.C8C[year]); P18D.SetExpr(year, () => DocumentManager.CurrentDocument.City.C8D[year]); P18E.SetExpr(year, () => DocumentManager.CurrentDocument.City.C8E[year]); } P19_1F = new YearwiseSum(P02 + 8, 14, P19_1A, P19_1B, P19_1C, P19_1D, P19_1E); for (int i = -3; i <= 10; i++) { int year = i; P19_1A.SetExpr(year, () => P18_1A[year]); P19_1B.SetExpr(year, () => P18_1B[year]); P19_1C.SetExpr(year, () => P18_1C[year]); P19_1D.SetExpr(year, () => P18_1D[year]); P19_1E.SetExpr(year, () => P18_1E[year]); } P19_2D = new YearwiseSum(P02 + 8, 14, P19_2A, P19_2B, P19_2C); for (int i = -3; i <= 10; i++) { int year = i; P19_2A.SetExpr(year, () => P18_2A[year]); P19_2B.SetExpr(year, () => P18_2B[year]); P19_2C.SetExpr(year, () => P18_2C[year]); } for (int i = -3; i <= 10; i++) { int year = i; P19A.SetExpr(year, () => P19_1F[year] - P19_1D[year]); P19B.SetExpr(year, () => P19_2B[year] + P19_2C[year]); P19C.SetExpr(year, () => P19A[year] - P19B[year]); P19D.SetExpr(year, () => P19C[year] * DocumentManager.CurrentDocument.City.C14A); } P20G = new YearwiseSum(P02 + 9, 9, P20A, P20B, P20C, P20D, P20E, P20F); for (int i = 1; i <= 9; i++) { int year = i; P20A.SetExpr(year, () => NaNto0(P3A[year])); P20B.SetExpr(year, () => NaNto0(P3B[year])); P20C.SetExpr(year, () => NaNto0(P3C[year])); P20D.SetExpr(year, () => NaNto0(P3D[year])); P20E.SetExpr(year, () => NaNto0(P3E[year])); P20F.SetExpr(year, () => NaNto0(P3F[year])); } for (int i = 1; i <= 9; i++) { int year = i; P21A.SetExpr(year, () => P20A[year]); P21B.SetExpr(year, () => P18B[year + 1]); P21C.SetExpr(year, () => P18A[year + 1]); } for (int i = 1; i <= 9; i++) { int year = i; P22A.SetExpr(year, () => P17B[year + 1]); P22B.SetExpr(year, () => DocumentManager.CurrentDocument.City.C7C[year + 1]); P22C.SetExpr(year, () => P18E[year + 1]); } }