| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_1802.cs
- * 2.功能描述:环境日报
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 庄天威 2014/09/17 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- public partial class F_PM_1802 : FormBase
- {
- #region 成员变量
- //单例模式
- private static F_PM_1802 _instance;
- // 金额小数位数
- private string _amountDecimalplaces = "N1";
- #endregion
- #region 构造函数
- public F_PM_1802()
- {
- InitializeComponent();
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_1802 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PM_1802();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- private void F_PM_1802_Load(object sender, EventArgs e)
- {
- try
- {
- this.chart1.Series[0].LegendText = "温度";
- this.chart1.Series[0].XValueMember = "RecordDateStr";
- this.chart1.Series[0].YValueMembers = "Celsius";
- this.chart1.Series[1].LegendText = "湿度";
- this.chart1.Series[1].XValueMember = "RecordDateStr";
- this.chart1.Series[1].YValueMembers = "Humidity";
- }
- catch(Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- if(this.dkThermometer.ThermometerID == null)
- {
- this.dkThermometer.Focus();
- return;
- }
- DataSet dsThermometer = (DataSet)DoAsync(() =>
- {
- return this.GetCelsiusRecord();
- });
- if (dsThermometer != null)
- {
- if (dsThermometer.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.chart1.DataSource = ((DataSet)dsThermometer).Tables[Constant.INT_IS_ZERO].DefaultView;
- this.chart1.Series[0].LabelFormat = _amountDecimalplaces;
- this.chart1.Series[1].LabelFormat = _amountDecimalplaces;
- chart1.ChartAreas[0].AxisX.Interval = 7;
- chart1.ChartAreas[0].AxisX.IntervalOffset = 7;
- chart1.ChartAreas[0].AxisY.Interval = 5;
- chart1.ChartAreas[0].AxisY.IntervalOffset = 5;
- this.chart1.Update();
- if (((DataSet)dsThermometer).Tables[Constant.INT_IS_ZERO].Rows.Count == Constant.INT_IS_ZERO)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- this.chart1.DataSource = null;
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.dkThermometer.Text = "";
- this.dkThermometer.ThermometerID = null;
- }
- private void F_PM_1802_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 根据界面查询条件获取数据集
- /// </summary>
- private DataSet GetCelsiusRecord()
- {
- try
- {
- CelsiusRecordEntity crEntity = new CelsiusRecordEntity();
- crEntity.ThermometerID = this.dkThermometer.ThermometerID;
- crEntity.RecordDate = this.txtRecordDateStart.Value.Date;
- crEntity.RecordDateEnd = this.txtRecordDateEnd.Value.Date.AddDays(1);
- crEntity.Days = ((TimeSpan)(crEntity.RecordDateEnd - crEntity.RecordDate)).Days;
- crEntity.PurviewType = 11;// 查看权限
- return PMModuleProxy.Service.GetCelsiusRecord(crEntity);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- }
- }
|