/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_RPT_080106.cs
* 2.功能描述:温湿计明细表
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2016/06/21 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.WCF.Proxys.SystemModuleService;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.WCF.DataModels;
namespace Dongke.IBOSS.PRD.Client.ReportModule
{
///
/// 温湿计明细表
///
public partial class F_RPT_080106 : DockPanelBase
{
#region 成员变量
//单例模式
private static F_RPT_080106 _instance;
#endregion
#region 构造函数
public F_RPT_080106()
{
InitializeComponent();
}
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_RPT_080106 Instance
{
get
{
if (_instance == null)
{
_instance = new F_RPT_080106();
}
return _instance;
}
}
#endregion
#region 事件
///
/// 窗体加载
///
private void F_RPT_080106_Load(object sender, EventArgs e)
{
// 加载权限
FormPermissionManager.FormPermissionControl(this.Name, this,
Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
this.dgvCelsiusRecord.AutoGenerateColumns = false;
this.Text = FormTitles.F_RPT_080106;
}
///
/// 获取数据
///
private void btnSearch_Click(object sender, System.EventArgs e)
{
try
{
ServiceResultEntity resultEntity = (ServiceResultEntity)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
{
return this.GetCelsiusRecord();
}));
if (resultEntity.Data != null)
{
if (resultEntity.Data.Tables.Count != Constant.INT_IS_ZERO)
{
this.dgvCelsiusRecord.DataSource = ((DataSet)resultEntity.Data).Tables[Constant.INT_IS_ZERO];
this.dgvCelsiusRecord.ReadOnly = true;
if (this.dgvCelsiusRecord.Rows.Count == Constant.INT_IS_ZERO)
{
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else
{
this.dgvCelsiusRecord.DataSource = null;
// 提示未查找到数据
MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清空条件
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.txtRemarks.Text = "";
this.dkThermometer.Text = "";
this.dkThermometer.ThermometerID = null;
this.txtRecordDateStart.Value = DateTime.Now;
this.txtRecordDateEnd.Value = DateTime.Now;
}
///
/// 窗体关闭
///
///
///
private void F_PM_1701_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 关闭按钮事件
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 自动列宽事件
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
this.dgvCelsiusRecord.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
}
#endregion
#region 私有方法
///
/// 根据界面查询条件获取数据集
///
private ServiceResultEntity GetCelsiusRecord()
{
try
{
CelsiusRecordEntity crEntity = new CelsiusRecordEntity();
if (this.dkThermometer.ThermometerID != null)
{
crEntity.ThermometerID = this.dkThermometer.ThermometerID;
}
crEntity.RecordDate = this.txtRecordDateStart.Value.Date;
crEntity.RecordDateEnd = this.txtRecordDateEnd.Value.Date.AddDays(1);
crEntity.ThermometerIDS = this.dkThermometer.ThermometerIDS;
if (string.IsNullOrWhiteSpace(this.txtRemarks.Text))
{
crEntity.Remarks = this.txtRemarks.Text;
}
return ReportModuleProxy.Service.GetRPT080106IData(crEntity);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}