/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PC_0105.cs
* 2.功能描述:查看覆历
* 编辑履历:
* 作者 日期 版本 修改内容
* 庄天威 2014/10/06 1.00 新建
*******************************************************************************/
using System;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.Client.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.PCModule
{
///
/// 查看覆历
///
public partial class F_PC_0105 : FormBase
{
#region 成员常量
private static F_PC_0105 _instance; // 单例模式使用
//范围权限
private string _purview;
#endregion
#region 构造函数
public F_PC_0105()
{
InitializeComponent();
this.Text = FormTitles.F_PC_0105;
this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
this.btnSearch.Text = ButtonText.BTN_SEARCH;
this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
}
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_PC_0105 Instance
{
get
{
if (_instance == null)
{
_instance = new F_PC_0105();
}
return _instance;
}
}
#endregion
#region 事件处理
///
/// 查询
///
///
///
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
if (this.dkGrouting.GroutingLineID == null)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.dkGrouting.Focus();
return;
}
DateTime? TimeStart = null;
DateTime? TimeEnd = null;
if (this.cbTime.Checked == true)
{
TimeStart = Convert.ToDateTime(this.txtDateStart.Text);
TimeEnd = Convert.ToDateTime(this.txtDateEnd.Text).AddHours(23).AddMinutes(59).AddSeconds(59);
}
DataSet dsMouldRecord = (DataSet)PCModuleProxy.Service.GetMouldRecordByMainId(this.dkGrouting.GroutingLineID, null, TimeStart, TimeEnd);
DataSet dsMouldHistory = (DataSet)PCModuleProxy.Service.GetMouldHistoryByMainId(this.dkGrouting.GroutingLineID, null, TimeStart, TimeEnd);
if (dsMouldRecord != null)
{
this.dgvMouldRecord.AutoGenerateColumns = false;
this.dgvMouldRecord.DataSource = dsMouldRecord.Tables[0];
}
if (dsMouldHistory != null)
{
this.dgvMouldHistory.AutoGenerateColumns = false;
this.dgvMouldHistory.DataSource = dsMouldHistory.Tables[0];
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清空条件
///
///
///
private void btnClearCondition_Click(object sender, EventArgs e)
{
this.dkGrouting.GroutingLineID = null;
this.dkGrouting.Text = "";
this.cbTime.Checked = false;
this.dgvMouldHistory.DataSource = null;
this.dgvMouldRecord.DataSource = null;
}
///
/// 窗体加载
///
///
///
private void F_PC_0105_Load(object sender, EventArgs e)
{
try
{
getPurview();
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 获取成型线权限
///
private void getPurview()
{
try
{
StringBuilder sbPurview = new StringBuilder();
DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(5, LogInUserInfo.CurrentUser.UserID);
if (dsPurview != null)
{
foreach (DataRow dr in dsPurview.Tables[0].Rows)
{
sbPurview.Append(dr[0].ToString() + ",");
}
if (sbPurview.Length != Constant.INT_IS_ZERO)
{
this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
}
}
this.dkGrouting.Purview = _purview;
this.dkGrouting.IsEnablePurview = true;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}