Files
2026-07-10 15:25:05 +08:00

65 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CommonLib;
using System.Data.SqlClient;
using CommonLib.data;
namespace Lskj.Main.sub
{
public partial class FrmHistoryMessage : FormBase
{
public FrmHistoryMessage()
{
InitializeComponent();
}
private void btnQuery_Click(object sender, EventArgs e)
{
try
{
string strSql = "";
if (this.tabControl1.SelectedIndex == 0)
{
strSql = string.Format(@"select * from P_MsgHintEmployeeTab a WITH (nolock) join P_MessageHintTab b WITH (nolock)
on a.messageid=b.messageid where ((LoginAccount='{0}') or (LoginAccount='{0}')) and starttime>='{1}'
and starttime<'{2}' order by starttime",ERPInfo.Instance.EmployeeName,dtStart.Value,dtEnd.Value);
DataSet dsNew = SqlHelper.ExecuteDataSet(CommandType.Text, strSql, "P_MsgHintEmployeeTab", null);
gvNew.DataSource = dsNew.Tables[0];
}
else
{
strSql = string.Format(@"select * from P_h_MsgHintEmployeeTab a WITH (nolock) join P_h_MessageHintTab b WITH (nolock)
on a.messageid=b.messageid where ((LoginAccount='{0}') or (LoginAccount='{0}'))
and starttime>='{1}' and starttime<'{2}' order by starttime", ERPInfo.Instance.EmployeeName, dtStart.Value, dtEnd.Value);
DataSet dsHistory = SqlHelper.ExecuteDataSet(CommandType.Text, strSql, "P_h_MsgHintEmployeeTab", null);
gvHistory.DataSource = dsHistory.Tables[0];
}
}
catch (Exception ex)
{
PubUtil.WriteError("查询记录出错!",ex.Message);
}
}
private void FrmHistoryMessage_Load(object sender, EventArgs e)
{
gvNew.AutoGenerateColumns = false;
gvHistory.AutoGenerateColumns = false;
btnQuery_Click(null, null);
}
private void btnClose_Click(object sender, EventArgs e)
{
Close();
}
}
}