コード例 #1
0
ファイル: ChargRecordBll.cs プロジェクト: ylz201/chargepile
        /// <summary>
        /// 查询本月平均充电量
        /// </summary>
        /// <returns></returns>
        public DataTable FindByRankAvgZdl(string kssj, string jssj, int page, int rows2, ref int count)
        {
            var chargpilebll = new ChargPileBll();
            var datatable    = new DataTable();
            var dtCdl        = FindByRankZdl(kssj, jssj, page, rows2, ref count);
            var dtCount      = chargpilebll.FindByChargePileStationCount();

            datatable.Columns.Add("rownum", Type.GetType("System.Decimal"));
            datatable.Columns.Add("zhanjc", Type.GetType("System.String"));
            datatable.Columns.Add("pjcdl", Type.GetType("System.String"));
            foreach (DataRow rows in dtCdl.Rows)
            {
                foreach (DataRow row in dtCount.Rows)
                {
                    if (rows["zhanjc"].ToString() != row["zhanjc"].ToString())
                    {
                        continue;
                    }
                    var cdl = rows["zdl"].ToString();
                    var zdl = 0m;
                    zdl = !string.IsNullOrEmpty(cdl) ? decimal.Parse(cdl) : 0;

                    var zsl = int.Parse(row["count"].ToString());
                    try
                    {
                        var datarow = datatable.NewRow();
                        if (zsl == 0)
                        {
                            continue;
                        }
                        var avgZdl = zdl / zsl;
                        datarow["rownum"] = rows["rownum"];
                        datarow["zhanjc"] = row["zhanjc"];
                        datarow["pjcdl"]  = avgZdl.ToString("f2");
                        datatable.Rows.Add(datarow);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
            return(datatable);
        }
コード例 #2
0
ファイル: ChargRecordBll.cs プロジェクト: ylz201/chargepile
        /// <summary>
        /// 查询本月运行故障率
        /// </summary>
        /// <returns></returns>
        public DataTable FindByRankFailureRate(string kssj, string jssj, int page, int rows2, ref int count)
        {
            var chargpilebll = new ChargPileBll();
            var datatable    = new DataTable();
            var dtCdl        = FindByRankRunCount(kssj, jssj, page, rows2, ref count);
            var dtCount      = chargpilebll.FindByChargePileStationCount();

            datatable.Columns.Add("rownum", Type.GetType("System.Decimal"));
            datatable.Columns.Add("zhanjc", Type.GetType("System.String"));
            datatable.Columns.Add("gzl", Type.GetType("System.String"));
            foreach (DataRow rows in dtCdl.Rows)
            {
                foreach (DataRow row in dtCount.Rows)
                {
                    if (rows["zhanjc"].ToString() != row["zhanjc"].ToString())
                    {
                        continue;
                    }

                    var yxcl = decimal.Parse(rows["count"].ToString());
                    var zsl  = int.Parse(row["count"].ToString());
                    try
                    {
                        var datarow = datatable.NewRow();
                        if (zsl == 0)
                        {
                            continue;
                        }
                        var gzl = yxcl / zsl;
                        gzl = gzl * 100;
                        datarow["rownum"] = rows["rownum"];
                        datarow["zhanjc"] = row["zhanjc"];
                        datarow["gzl"]    = gzl.ToString("f2");
                        datatable.Rows.Add(datarow);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
            return(datatable);
        }