Files
N_XLXSBJ----MX/XLXHCPTXWHList.aspx.cs
2026-10-09 10:30:49 +08:00

137 lines
5.3 KiB
C#

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GThinking.N_MODEL.Page;
using GThinking.N_MISPRO.Data;
using GThinking.N_MISPRO;
using GThinking.N_MISPRO.Utility;
using System.Text;
using GThinking.N_CONTROL;
using System.Collections.Generic;
namespace GThinking.N_XLXSBJ
{
public partial class XLXHCPTXWHList : SingleGridBase
{
XLXHCPTXWH entity = new XLXHCPTXWH();
XLXHCPTXWH_M qryEntity = new XLXHCPTXWH_M();
public static Dictionary<string, string> dict = new Dictionary<string, string>();
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860166;
this.UMName = "线缆型号附加属性维护";
this.CurMaster = Master;
this.ModuleGV = ContentGrid;
this.CurEntity = entity;
this.CurQueryEntity = qryEntity;
this.sURLTarget = "XLXHCPTXWHInfo.aspx";
this.sQueryURLTarget = "XLXHCPTXWHQuery.aspx";
this.PageHeight = 600;
this.PageWidth = 600;
this.CanDeleteCheckedRows = true;
base.DataKeyNames = new string[] { "XLXSBJCPYS_XLJBXHID", "XLXSBJCPYS_DYDJID", "XLXSBJCPYS_XXJGID" };
this.Master.EnableNewBtn = false;
this.Master.EnableCopyBtn = false;
this.Master.EnableViewBtn = false;
this.Master.EnableEditBtn = false;
//this.Master.EnableDeleteBtn = false;
this.Master.EnableAttachBtn = false;
base.InitPage();
if (!IsPostBack)
{
Master_OnStandardQuery(null, null);
}
}
#region 模板事件
protected override void Master_OnStandardQuery(object sender, EventArgs e)
{
base.InitEntityByCondition();
entity.EntityTable.QuerySelSql = GetSql();
base.Master_OnStandardQuery(sender, e);
entity.GridDataBind(ContentGrid, tSession);
}
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
base.InitEntityByCondition();
entity.EntityTable.QuerySelSql = GetSql();
base.moduleGV_PageIndexChanging(sender, e);
ContentGrid.SelectedIndex = -1;
}
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
{
base.moduleGV_RowDataBound(sender, e);
}
protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone)
{
entity.EntityTable.DeleteSql = " delete from XLXSBJCPYS where XLXSBJCPYS_XLJBXHID=:XLXSBJCPYS_XLJBXHID and XLXSBJCPYS_DYDJID =:XLXSBJCPYS_DYDJID and XLXSBJCPYS_XXJGID =:XLXSBJCPYS_XXJGID ";
entity.Param.Add("XLXSBJCPYS_XLJBXHID", this.ContentGrid.SelectedDataKey["XLXSBJCPYS_XLJBXHID"].ToString().Trim());
entity.Param.Add("XLXSBJCPYS_DYDJID", this.ContentGrid.SelectedDataKey["XLXSBJCPYS_DYDJID"].ToString().Trim());
entity.Param.Add("XLXSBJCPYS_XXJGID", this.ContentGrid.SelectedDataKey["XLXSBJCPYS_XXJGID"].ToString().Trim());
base.BeforeDelete(db, ref ActionIsDone);
}
#endregion
#region 自定义函数
private string GetSql()
{
StringBuilder strSQL = new StringBuilder();
strSQL.AppendLine(" select XLXSBJCPYS_DYDJID, XLXSBJCPYS_XLJBXHID,XLXSBJCPYS_XXJGID ");
strSQL.AppendLine(" from XLXSBJCPYS ");
strSQL.AppendLine(" where 1=1 ");
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
{
strSQL.AppendLine(" and XLXSBJCPYS_XLJBXHID = :pXLXHID ");
entity.Param.Add("pXLXHID", CurQueryEntity.FieldByName("XLXHID").Value.Trim());
}
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("DYDJ").Value.Trim()))
{
strSQL.AppendLine(" and XLXSBJCPYS_DYDJID = :XLXSBJCPYS_DYDJID ");
entity.Param.Add("XLXSBJCPYS_DYDJID", CurQueryEntity.FieldByName("DYDJ").Value.Trim());
}
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHFJSX").Value.Trim()))
{
strSQL.AppendLine(" and XLXSBJCPYS_XXJGID like :XLXSBJCPYS_XXJGID ");
entity.Param.Add("XLXSBJCPYS_XXJGID","%"+CurQueryEntity.FieldByName("XLXHFJSX").Value.Trim()+"%");
}
strSQL.AppendLine(" order by XLXSBJCPYS_XLJBXHID,XLXSBJCPYS_DYDJID,XLXSBJCPYS_XXJGID ");
return strSQL.ToString();
}
#endregion
#region 控件事件
protected void btnDR_Click(object sender, EventArgs e)
{
TPageParams pageParams = new TPageParams();
pageParams.UrlPath = "DRXLXHCPTXWH.aspx";
pageParams.Title = "导入Excel文件";
pageParams.AddString("btnRefreshCID", btnRefresh.ClientID);
OpenDialog(pageParams);
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
moduleGV_PageIndexChanging(null, null);
}
#endregion
}
}