public void create(IDbConnection conn, string sql, int crossType, int valueType, int colStatFuncs, int rowStatFuncs, string pattern) { this.int_7 = crossType; this.int_6 = valueType; this.long_0 = colStatFuncs; this.long_1 = rowStatFuncs; this.string_0 = "{0:" + pattern + "}"; if (((((colStatFuncs & 1) == 1) || ((rowStatFuncs & 1) == 1)) || (((colStatFuncs & 16) == 16) || ((rowStatFuncs & 16) == 16))) || (((colStatFuncs & 32) == 32) || ((rowStatFuncs & 32) == 32))) { this.bool_2 = true; this.arrayList_4 = new ArrayList(); for (int i = 0; i < this.arrayList_2.Count; i++) { ArrayList list2 = (ArrayList)this.arrayList_2[i]; ArrayList list = new ArrayList(); for (int j = 0; j < list2.Count; j++) { list.Add(new int[this.int_1, this.int_0]); } this.arrayList_4.Add(list); } } DBTableModel model = new DBTableModel(conn); try { model.executeQuery(sql); } catch (Exception exception) { throw new Exception("无法正确执行SQL语句生成交叉表,错误原因:" + exception.Message); } try { this.method_8(model); this.method_0(model); this.method_4(); this.method_5(); } catch (Exception exception2) { model.close(); throw new Exception("生成交叉表过程中出现错误,错误原因:" + exception2.Message); } }
private void method_8(DBTableModel dbtableModel_0) { if (dbtableModel_0.getColumnCount() <= 1) { throw new Exception("无法建立交叉表,因为交叉表要求至少超过两个字段的数据集"); } if (dbtableModel_0.getColumnCount() == 2) { this.int_7 = 1; this.int_6 = 111; } else if (dbtableModel_0.getColumnCount() > 2) { if (this.int_7 == 0) { this.int_7 = this.method_7(dbtableModel_0.getColumnTypeInt(2)); } if (this.int_6 == 0) { this.int_6 = this.method_6(dbtableModel_0.getColumnTypeInt(2)); } } }
private void method_0(DBTableModel dbtableModel_0) { string key = null; string str2 = null; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; while (dbtableModel_0.next()) { double num5; int[,] numArray4; key = dbtableModel_0.getStringValue(0).Trim(); str2 = dbtableModel_0.getStringValue(1).Trim(); if (!this.hashtable_0.ContainsKey(key)) { if (this.bool_0) { continue; } this.method_1(key); } if (!this.hashtable_1.ContainsKey(str2)) { if (this.bool_1) { continue; } this.method_2(str2); } num = (int)this.hashtable_0[key]; num2 = (int)this.hashtable_1[str2]; num4 = num % this.int_0; num3 = num2 % this.int_1; num /= this.int_0; num2 /= this.int_1; object obj2 = ((ArrayList)this.arrayList_2[num2])[num]; switch (this.int_7) { case 1: double[,] numArray2; IntPtr ptr3; IntPtr ptr4; (numArray2 = (double[, ])obj2)[(int)(ptr3 = (IntPtr)num3), (int)(ptr4 = (IntPtr)num4)] = numArray2[(int)ptr3, (int)ptr4] + 1.0; goto Label_02B7; case 2: case 5: { if (this.int_6 == 111) { goto Label_0290; } double[,] numArray3 = (double[, ])obj2; numArray3[num3, num4] += dbtableModel_0.getDoubleValue(2); goto Label_02B7; } case 3: { if (this.int_6 == 111) { break; } double num7 = dbtableModel_0.getIntValue(2); ((double[, ])obj2)[num3, num4] = (((double[, ])obj2)[num3, num4] < num7) ? ((double[, ])obj2)[num3, num4] : num7; goto Label_02B7; } case 4: { if (this.int_6 != 111) { goto Label_0219; } int num6 = dbtableModel_0.getIntValue(2); ((int[, ])obj2)[num3, num4] = (((int[, ])obj2)[num3, num4] > num6) ? ((int[, ])obj2)[num3, num4] : num6; goto Label_02B7; } default: goto Label_02B7; } int num8 = dbtableModel_0.getIntValue(2); ((int[, ])obj2)[num3, num4] = (((int[, ])obj2)[num3, num4] < num8) ? ((int[, ])obj2)[num3, num4] : num8; goto Label_02B7; Label_0219: num5 = dbtableModel_0.getIntValue(2); ((double[, ])obj2)[num3, num4] = (((double[, ])obj2)[num3, num4] > num5) ? ((double[, ])obj2)[num3, num4] : num5; goto Label_02B7; Label_0290: numArray4 = (int[, ])obj2; numArray4[num3, num4] += dbtableModel_0.getIntValue(2); Label_02B7: if (this.bool_2) { int[,] numArray; IntPtr ptr; IntPtr ptr2; (numArray = (int[, ])((ArrayList)this.arrayList_4[num2])[num])[(int)(ptr = (IntPtr)num3), (int)(ptr2 = (IntPtr)num4)] = numArray[(int)ptr, (int)ptr2] + 1; } } this.int_4 = this.arrayList_0.Count; this.int_5 = this.arrayList_1.Count; }