类 映射 遍历大全

foreach (T_GL_AnalysisCalculation item in AnalysisCalculationList)
                {
                    foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
                    {
                        var Key = p.Name;
                        var Value = p.GetValue(item, null);

#region 行业最优
                        if (Key == "Reporttype" && Value.ToString() == "Max")
                        {
                            foreach (System.Reflection.PropertyInfo pYear in item.GetType().GetProperties())
                            {
                                var KeyYear = pYear.Name;
                                var ValueYear = pYear.GetValue(item, null);
                                if (KeyYear == "Year" && ValueYear.ToString() == "1")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMax1 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "3")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMax3 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "5")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMax5 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "10")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMax10 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                            }
                        }

#endregion

#region 行业平均
                        if (Key == "Reporttype" && Value.ToString() == "Average")
                        {
                            foreach (System.Reflection.PropertyInfo pYear in item.GetType().GetProperties())
                            {
                                var KeyYear = pYear.Name;
                                var ValueYear = pYear.GetValue(item, null);
                                if (KeyYear == "Year" && ValueYear.ToString() == "1")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueAverage1 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "3")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueAverage3 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "5")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueAverage5 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "10")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueAverage10 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                            }
                        }

#endregion

#region 行业最差
                        if (Key == "Reporttype" && Value.ToString() == "Min")
                        {
                            foreach (System.Reflection.PropertyInfo pYear in item.GetType().GetProperties())
                            {
                                var KeyYear = pYear.Name;
                                var ValueYear = pYear.GetValue(item, null);
                                if (KeyYear == "Year" && ValueYear.ToString() == "1")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMin1 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "3")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMin3 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "5")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMin5 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                                if (KeyYear == "Year" && ValueYear.ToString() == "10")
                                {
                                    foreach (System.Reflection.PropertyInfo pYearValue in item.GetType().GetProperties())
                                    {
                                        var KeyYearName = pYearValue.Name;
                                        var KeyYearValue = pYearValue.GetValue(item, null);
                                        if (KeyYearName.Length > 5 && KeyYearName.Substring(Key.Length - 5).Replace("_", ".") == code.ToString())
                                        {
                                            entiey.ValueMin10 = Convert.ToDecimal(KeyYearValue);
                                        }
                                    }
                                }
                            }
                        }

#endregion

}
                }

foreach (System.Reflection.PropertyInfo p in entiey.GetType().GetProperties())
                {
                    var Key = p.Name;
                    var Value = p.GetValue(entiey, null);
                    if (Key.Substring(0, 1) == "Q")
                    {

foreach (var item in AnalysisCalculationQAllList)
                        {
                            if (item.Reporttype == quarter + Key.Substring(1, Key.Length - 1))
                            {
                                foreach (System.Reflection.PropertyInfo I in item.GetType().GetProperties())
                                {
                                    var itemKey = I.Name;
                                    var itemValue = I.GetValue(item, null);
                                    if (code.ToString() == itemKey.Replace("_", "."))
                                    {
                                        p.SetValue(entiey, itemValue, null);
                                    }
                                }
                            }
                        }
                    }
                }

时间: 2024-10-10 19:53:20

类 映射 遍历大全的相关文章

UML类图关系大全

UML类图关系大全 1.关联 双向关联: C1-C2:指双方都知道对方的存在,都可以调用对方的公共属性和方法. 在GOF的设计模式书上是这样描述的:虽然在分析阶段这种关系是适用的,但我们觉得它对于描述设计模式内的类关系来说显得太抽象了,因为在设计阶段关联关系必须被映射为对象引用或指针.对象引用本身就是有向的,更适合表达我们所讨论的那种关系.所以这种关系在设计的时候比较少用到,关联一般都是有向的. 使用ROSE 生成的代码是这样的: class C1 ...{ public:     C2* th

UML类图关系大全【转】

UML类图关系大全 1.关联双向关联:C1-C2:指双方都知道对方的存在,都可以调用对方的公共属性和方法.在GOF的设计模式书上是这样描述的:虽然在分析阶段这种关系是适用的,但我们觉得它对于描述设计模式内的类关系来说显得太抽象了,因为在设计阶段关联关系必须被映射为对象引用或指针.对象引用本身就是有向的,更适合表达我们所讨论的那种关系.所以这种关系在设计的时候比较少用到,关联一般都是有向的.使用ROSE 生成的代码是这样的: class C1 ...{public:    C2* theC2;};

opencv学习 2.Mat类图像遍历

图像的遍历 原图 1.简单存取像素值 代码如下: // Mat类图像遍历.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "cv.h" #include "cxcore.h" #include "highgui.h" using namespace std; using namespace cv; int _tmain(int argc, _TCHAR* argv[])

TelephonyManager类使用方法大全

这个类是很有用地,可以得到很多关于手机的信息,做应用时必须的工具. 不废话,直接上注释后的代码,请享用: <code> /** * *@author dingran *创建日期 2010-4-29 下午05:02:47 * */ package net.sunniwell.app; import android.app.Activity; import android.os.Bundle; import android.telephony.CellLocation; import androi

利用java.io.File类实现遍历本地磁盘上指定盘符或文件夹的所有的文件

2016-11-18 这是本人的第一篇随笔博客,纠结了半天还是选择自己学的时候比较用心的一些知识点上.利用java.io.File类指定本地的文件夹进行遍历所有的文件. package org.lxm.filedemo; import java.io.File; import java.util.Scanner; /* * 本程序是将某个盘的所有文件夹及其文件全部调出来的操作 */ public class FileAllDemo { public static void main(String

[SQL类] SQL优化大全(推荐)

概要 优化的理由 1. 大小写对SQL语句的影响(ORACLE) 2. 尽量使用(NOT) EXISTS 替代( NOT)IN这样的操作 3. 在海量查询时尽量少用格式转换 4. 查询海量数据是,可以使用OPTIMIZER HINTS(ORACLE) 5. ORDER BY和GROPU BY 6. 对列的操作 7. 避免使用OR 8. 用IN来替换OR 9. FROM 10. WHERE 11. IS NULL或IS NOT NULL 12. SELECT子句中避免使用 ‘ * ‘ 13. 避免

java File类-递归遍历目录结构和树状展现

f.listFiles(); //返回目录下的所有子目录和子文件版本一:未加计数器分层次 static void f(File f) { System.out.println(f.getName()); if(f.isDirectory()) { File[] files=f.listFiles(); //如果是目录,返回目录下的所有子目录和子文件 for(File fi:files) { f(fi); } } } 版本二:加计数器分层次 static void f(File f,int lev

生物信息类期刊全集大全

计算生物学,生物信息学,计算生物信息学 杂志 期刊 BMC BioinformaticsBMC Genomics BMC System Biology BMC subs BRIEFINGS IN BIOINFORMATICSBioinformaticsCOMPUTATIONAL BIOLOGY AND CHEMISTRYCell and subsCurrent BioinformaticsEvolutionary BioinformaticsGENOMICS PROTEOMICS & BIOIN

Scala学习——数组/映射/元组

数组 / 映射 / 元组 一.数组 1.定长数组 声明数组的两种形式: 声明指定长度的数组 val 数组名= new Array[类型](数组长度) 提供数组初始值的数组,无需new关键字 Scala声明数组时,需要带有Array类名,且使用 () 来指明长度或提供初始值序列. 在JVM中,Scala的Array以Java数组的方式实现.如arr在JVM中的类型对应java.lang.String[],charArr对应char[]. 2.变长数组 ArrayBuffer,全称scala.col