test
来源:互联网 发布:参与php开源项目 编辑:程序博客网 时间:2024/06/05 18:40
<pre name="code" class="csharp"> /// <summary> /// 根据条件获取公司级别实际完成接替率 /// </summary> /// <param name="startYear">起始年份</param> /// <param name="endYear">终止年份</param> /// <returns>实际完成接替率数据</returns> private List<ReplacementRateModel> GetCompanyActualReplacementRateBy(int startYear, int endYear) { List<ReplacementRateModel> models = new List<ReplacementRateModel>();//ReplacementRateModel是一个视图模型 string sqlOil = GetSqlFromXml.GetSqlBy("GetCompanyActualReplacementRateBy", fileName, "select");//通过xml找到对应的sql语句 string sqlOilSelect = string.Format(sqlOil, startYear, endYear);//将对应的参数填充到sql语句中去 DataTable dtCompany = helper.ExecDataTable(sqlOilSelect);//执行sql语句 foreach (DataRow row in dtCompany.Rows)//验证数据并做运算处理 { int year = CommOp.ToInt(row["ACTIVITYYEAR"]); if(year==startYear) { continue; } DataRow tempRow = year == 0 ? null : PerformanceTransfer.GetLastReserves(year, dtCompany); double lastOilReserves = tempRow == null ? 0 : CommOp.ToDouble(tempRow["OILRESERVES"]); double lastGasReserves = tempRow == null ? 0 :CommOp.ToDouble(tempRow["GASRESERVES"]); double dangOilReserves = CommOp.ToDouble(row["OILRESERVES"]); double oilProduction = CommOp.ToDouble(row["OILSJNCL"]); double dangGasReserves = CommOp.ToDouble(row["GASRESERVES"]); double gasProduction = CommOp.ToDouble(row["GASJNCL"]); models.Add(new ReplacementRateModel { Year = year, DangOilReserves = Math.Round(dangOilReserves,2), OilProduction = Math.Round(oilProduction,2), LastOilReserves =Math.Round( lastOilReserves,2), OilAddReserves = Math.Round(dangOilReserves + oilProduction - lastOilReserves, 2),//石油新增证实储量 OilReplacementRate = oilProduction == 0 ? 0.00 : Math.Round((dangOilReserves + oilProduction - lastOilReserves) / oilProduction,2), DangGasReserves = Math.Round(dangGasReserves,2), GasProduction = Math.Round(gasProduction,2), LastGasReserves =Math.Round( lastGasReserves,2), GasAddReserves = Math.Round(dangGasReserves + gasProduction - lastGasReserves, 2),//天然气新增证实储量 GasReplacementRate = gasProduction == 0 ? 0.00 : Math.Round((dangGasReserves + gasProduction - lastGasReserves) / gasProduction, 2) }); } return models;//返回视图模型,以供页面显示 }
0 0
- test
- test
- test
- test
- test
- test
- test
- Test
- test
- Test
- test
- test
- test
- test
- test
- test
- test
- Test
- 将activity作为模态对话框显示
- C++第六次上机实验
- Shiro--RememberMe管理配置
- 滤镜研究
- Extjs4---Cannot read property 'addCls' of null
- test
- Java如何对ArrayList里的元素排序
- iOS打开摄像头录像
- PAT L3-001. 凑零钱(背包&路径记录)
- layoutSubviews调用情况
- c++作业6
- iOS 版本更新
- 关于指针的知识点
- 2dx-lua游戏震屏效果&简单的lua-binding