using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid;
using DevExpress.XtraPrinting;
using IStation.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
using IStation.BLL;
namespace IStation.WinFrmUI.Monitor
{
public partial class ResultChartControl : DevExpress.XtraEditors.XtraUserControl
{
public ResultChartControl()
{
InitializeComponent();
}
private class CurrentModel : HistoryDataHelper
{
///
/// 名称
///
public string Name { get; set; }
///
/// 泵台数
///
public string PumpCount { get; set; }
///
/// 开机时间段
///
public string Time { get; set; }
///
/// 电费
///
public double Electricity { get; set; }
}
List _currentModel = new List();
///
/// 绑定数据
///
///
public void SetBindingData(DateTime datetime)
{
PumpRunHelper pumpRunHelper = new PumpRunHelper();
pumpRunHelper.GetPumpRunParasOneDay(datetime,out string error1);
pumpRunHelper.GetByHistoryOneData(new DateTime(2023,2,5),out string error);
}
//电费计算
private double electricityPirce(DateTime startTime, DateTime endTime, double electricity)
{
var ElePriceSetting = new BLL.ElecPrice().GetAll().First();
var MonthList = ElePriceSetting.Settings.MonthList;
var FindMonth = MonthList.Find(x => x.StartMonth <= startTime.Month && x.EndMonth >= startTime.Month);
foreach (var item in FindMonth.HourList)
{
if (startTime.Hour >= item.StartHour && endTime.Hour <= item.EndHour)
{
return Math.Round(item.Price * electricity, 2);
}
}
return 0;
}
private double GetElectrityData(DateTime Str, DateTime end)
{
return 0;
}
//表格点击事件
private void gridControl2_MouseDown(object sender, MouseEventArgs e)
{
GridView gridView = gridControl2.MainView as GridView;
if (gridView != null)
{
// 获取鼠标所在的单元格
DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo = gridView.CalcHitInfo(e.Location);
// 如果点击到单元格上
if (hitInfo.InRowCell)
{
// 获取点击的单元格的行和列
int rowHandle = hitInfo.RowHandle;
int columnHandle = hitInfo.Column.VisibleIndex;
object cellValue = gridView.GetRowCellValue(rowHandle, gridView.Columns[columnHandle]);
// 处理获取到的单元格数据
if (cellValue != null)
{
}
}
}
}
}
}