123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using CCWin;
- 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 WCS_Client.Utility;
- namespace WCS_Client.From
- {
- public partial class FrmALARAMRECORD : CCSkinMain
- {
- DataTable _dt;
- public FrmALARAMRECORD()
- {
- InitializeComponent();
- Bind();
- }
- private static FrmALARAMRECORD childFromInstanc;
- public static FrmALARAMRECORD ChildFromInstanc
- {
- get
- {
- if (childFromInstanc == null || childFromInstanc.IsDisposed)
- {
- childFromInstanc = new FrmALARAMRECORD();
- }
- return childFromInstanc;
- }
- }
- //绑定数据
- private void Bind()
- {
- PageData pd = QueryPageDataMethods(pagerControl1.CurrentPage, pagerControl1.PageSize);
- if (pd == null)
- {
- if (_dt != null)
- _dt.Clear();
- }
- else
- {
- pagerControl1.Record = pd.RowsCount;
- dgvTask.DataSource = pd.Dt;
- _dt = pd.Dt;
- }
- }
- //获取数据集
- private PageData QueryPageDataMethods(int PageIndex, int PageSize)
- {
- string _SQLText = @"select ALARAMR_EQUNO,ALARAMR_EQUTYPE,ALARAMR_ALARAMNO,ALARAMR_ALARAMMSG,
- to_char(ALARAMR_ALARAMSTARTTIME,'yyyy-mm-dd hh24:mi:ss') ALARAMR_ALARAMSTARTTIME,to_char(ALARAMR_ALARAMENDTIME,'yyyy-mm-dd hh24:mi:ss') ALARAMR_ALARAMENDTIME,ALARAMR_WCSTASKID
- from WCS_ALARAMRECORD where 1=1 ";
- List<string> wherelist = new List<string>();
- if (string.IsNullOrWhiteSpace(txtEquNo.Text) == false)
- wherelist.Add(string.Format("ALARAMR_EQUNO like '%{0}%'", txtEquNo.Text));
- if (string.IsNullOrWhiteSpace(txtEquType.Text.Trim()) == false)
- wherelist.Add(string.Format("ALARAMR_EQUTYPE like '%{0}%'", txtEquType.Text.Trim()));
- if (string.IsNullOrWhiteSpace(txtALARAMRMsg.Text.Trim()) == false)
- wherelist.Add(string.Format("ALARAMR_ALARAMMSG like '%{0}%'", txtALARAMRMsg.Text.Trim()));
- if (string.IsNullOrWhiteSpace(sknStartDate.text) == false)
- {
- DateTime startdate = Convert.ToDateTime(sknStartDate.text);
- string starttime = startdate.ToString("yyyy-MM-dd");
- wherelist.Add(string.Format("to_char(ALARAMR_ALARAMSTARTTIME,'yyyy-mm-dd')>='{0}'", starttime));
- }
- if (string.IsNullOrWhiteSpace(sknEndDate.text) == false)
- {
- DateTime enddate = Convert.ToDateTime(sknEndDate.text);
- string endtime = enddate.ToString("yyyy-MM-dd");
- wherelist.Add(string.Format("to_char(ALARAMR_ALARAMSTARTTIME,'yyyy-mm-dd')<='{0}'", endtime));
- }
- string _Orderby = " ALARAMR_ALARAMSTARTTIME desc";
- PageData pd = BaseWorkflow.QueryPageData(_SQLText, _Orderby, wherelist, PageIndex, PageSize);
- return pd;
- }
- private void pagerControl1_BindSource(object sender, EventArgs e)
- {
- Bind();
- }
- private void btnResert_Click(object sender, EventArgs e)
- {
- txtEquNo.Text = string.Empty;
- txtEquType.Text = string.Empty;
- txtALARAMRMsg.Text = string.Empty;
- sknStartDate.text = string.Empty;
- sknEndDate.text = string.Empty;
- Bind();
- }
- private void btn_QueryTask_Click(object sender, EventArgs e)
- {
- pagerControl1.CurrentPage = 1;
- Bind();
- }
- }
- }
|