212 lines
9.6 KiB
C#
212 lines
9.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Web.UI.WebControls;
|
|
using GThinking.N_CONTROL;
|
|
using GThinking.N_MODEL.Page;
|
|
using GThinking.N_MISPRO;
|
|
using GThinking.N_MISPRO.Data;
|
|
using GThinking.N_MISPRO.Utility;
|
|
|
|
namespace GThinking.N_XLXSBJ
|
|
{
|
|
/// <summary>
|
|
/// 外部线缆产品导入下各「线缆报价等效替换」列表页的公共基类。
|
|
/// </summary>
|
|
public abstract class XLBJD_WBBJDDXListBase : SingleGridBase
|
|
{
|
|
protected XLBJD_WBBJDDX entity = new XLBJD_WBBJDDX();
|
|
protected XLBJD_WBBJDDX_M queryentity = new XLBJD_WBBJDDX_M();
|
|
|
|
protected abstract string ThLx { get; }
|
|
|
|
protected abstract gtGridView GridControl { get; }
|
|
|
|
protected void DXList_Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860043;
|
|
this.UMName = "外部线缆产品导入";
|
|
this.CurMaster = (MasterSingleGrid)Master;
|
|
this.ModuleGV = GridControl;
|
|
this.CurEntity = entity;
|
|
this.CurQueryEntity = queryentity;
|
|
this.sURLTarget = "XLBJD_WBBJDDXInfo.aspx";
|
|
this.sQueryURLTarget = "XLBJD_WBBJDDXQuery.aspx";
|
|
this.PageWidth = 960;
|
|
this.PageHeight = 640;
|
|
base.DataKeyNames = new string[] { "XLXSBJDXTHDZQD_XH", "XLXSBJDXTHDZQD_THLX" };
|
|
base.InitPage();
|
|
TPageParams newParams = new TPageParams();
|
|
newParams.AddString("XLXSBJDXTHDZQD_THLX", ThLx);
|
|
SetNewFormParam(newParams);
|
|
if (!IsPostBack)
|
|
{
|
|
Master_OnStandardQuery(null, null);
|
|
}
|
|
}
|
|
|
|
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
|
{
|
|
base.InitEntityByCondition();
|
|
entity.EntityTable.QuerySelSql = GetQuerySelSQL().ToString();
|
|
base.Master_OnStandardQuery(sender, e);
|
|
entity.GridDataBind(GridControl, tSession);
|
|
}
|
|
|
|
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
LinkPageParam.AddString("XLXSBJDXTHDZQD_XH", GridControl.DataKeys[e.Row.RowIndex]["XLXSBJDXTHDZQD_XH"].ToString().Trim());
|
|
LinkPageParam.AddString("XLXSBJDXTHDZQD_THLX", GridControl.DataKeys[e.Row.RowIndex]["XLXSBJDXTHDZQD_THLX"].ToString().Trim());
|
|
}
|
|
base.moduleGV_RowDataBound(sender, e);
|
|
}
|
|
|
|
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
|
{
|
|
base.InitEntityByCondition();
|
|
entity.EntityTable.QuerySelSql = GetQuerySelSQL().ToString();
|
|
GridControl.SelectedIndex = -1;
|
|
base.moduleGV_PageIndexChanging(sender, e);
|
|
}
|
|
|
|
protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone)
|
|
{
|
|
entity.Param.Add("XLXSBJDXTHDZQD_XH", GridControl.DataKeys[GridControl.SelectedIndex]["XLXSBJDXTHDZQD_XH"].ToString().Trim());
|
|
entity.Param.Add("XLXSBJDXTHDZQD_THLX", GridControl.DataKeys[GridControl.SelectedIndex]["XLXSBJDXTHDZQD_THLX"].ToString().Trim());
|
|
base.BeforeDelete(db, ref ActionIsDone);
|
|
}
|
|
|
|
protected override bool Master_AfterDeleteAction(object sender, EventArgs e)
|
|
{
|
|
if (!base.Master_AfterDeleteAction(sender, e)) { return false; }
|
|
entity.EntityTable.QuerySelSql = GetQuerySelSQL().ToString();
|
|
entity.GridDataBind(GridControl, tSession);
|
|
GridControl.SelectedIndex = -1;
|
|
return true;
|
|
}
|
|
|
|
private StringBuilder GetQuerySelSQL()
|
|
{
|
|
StringBuilder strSQL = new StringBuilder();
|
|
strSQL.AppendLine("select XLXSBJDXTHDZQD_XH, XLXSBJDXTHDZQD_THLX, XLXSBJDXTHDZQD_THQXHZF, XLXSBJDXTHDZQD_THHXHZF, ");
|
|
strSQL.AppendLine(" XLXSBJDXTHDZQD_THQGGZF, XLXSBJDXTHDZQD_THHGGZF, XLXSBJDXTHDZQD_THQDYDJZF, XLXSBJDXTHDZQD_THHDYDJZF, ");
|
|
strSQL.AppendLine(" XLXSBJDXTHDZQD_BZ, XLXSBJDXTHDZQD_WHR, XLXSBJDXTHDZQD_WHRID, XLXSBJDXTHDZQD_WHSJ ");
|
|
strSQL.AppendLine(" from XLXSBJDXTHDZQD ");
|
|
strSQL.AppendLine(" where XLXSBJDXTHDZQD_THLX = :pTHLX ");
|
|
entity.Param.Add("pTHLX", ThLx);
|
|
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THQXH").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THQXHZF like :pTHQXH ");
|
|
entity.Param.Add("pTHQXH", "%" + CurQueryEntity.FieldByName("THQXH").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THHXH").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THHXHZF like :pTHHXH ");
|
|
entity.Param.Add("pTHHXH", "%" + CurQueryEntity.FieldByName("THHXH").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THQGG").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THQGGZF like :pTHQGG ");
|
|
entity.Param.Add("pTHQGG", "%" + CurQueryEntity.FieldByName("THQGG").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THHGG").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THHGGZF like :pTHHGG ");
|
|
entity.Param.Add("pTHHGG", "%" + CurQueryEntity.FieldByName("THHGG").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THQDYDJ").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THQDYDJZF like :pTHQDYDJ ");
|
|
entity.Param.Add("pTHQDYDJ", "%" + CurQueryEntity.FieldByName("THQDYDJ").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THHDYDJ").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_THHDYDJZF like :pTHHDYDJ ");
|
|
entity.Param.Add("pTHHDYDJ", "%" + CurQueryEntity.FieldByName("THHDYDJ").Value.Trim() + "%");
|
|
}
|
|
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("THBZ").Value.Trim()))
|
|
{
|
|
strSQL.AppendLine(" and XLXSBJDXTHDZQD_BZ like :pTHBZ ");
|
|
entity.Param.Add("pTHBZ", "%" + CurQueryEntity.FieldByName("THBZ").Value.Trim() + "%");
|
|
}
|
|
|
|
strSQL.AppendLine(" order by XLXSBJDXTHDZQD_THYXJ desc, XLXSBJDXTHDZQD_XH ");
|
|
return strSQL;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 线缆报价等效替换各 THLX 是否由统一列表/卡片维护(与 XLBJD_WBBJDDXDZQDList 列一致,含 GGZZTH)。
|
|
/// </summary>
|
|
public static bool IsSupportedDxdThLx(string lx)
|
|
{
|
|
return GetVisibleDataFieldsForThLx(lx) != null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 各 THLX 下参与界面展示的 XLXSBJDXTHDZQD_* 字段名;null 表示不支持。供列表列与卡片行共用。
|
|
/// </summary>
|
|
public static Dictionary<string, byte> GetVisibleDataFieldsForThLx(string lx)
|
|
{
|
|
Dictionary<string, byte> s;
|
|
switch (lx)
|
|
{
|
|
case "DYDJJQTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQDYDJZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHDYDJZF"] = 0;
|
|
break;
|
|
case "XHZZTH":
|
|
case "XHJQTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHXHZF"] = 0;
|
|
break;
|
|
case "GGZZTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQGGZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHGGZF"] = 0;
|
|
break;
|
|
case "XHGGJQTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THQGGZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHGGZF"] = 0;
|
|
break;
|
|
case "XHDYDJJQTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THQDYDJZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHDYDJZF"] = 0;
|
|
break;
|
|
case "XHGGDYDJJQTH":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THQGGZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THQDYDJZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHGGZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHDYDJZF"] = 0;
|
|
break;
|
|
case "XHZZDYDJJQTHDYDJ":
|
|
s = new Dictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
|
|
s["XLXSBJDXTHDZQD_THQXHZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THQDYDJZF"] = 0;
|
|
s["XLXSBJDXTHDZQD_THHDYDJZF"] = 0;
|
|
break;
|
|
default:
|
|
return null;
|
|
}
|
|
s["XLXSBJDXTHDZQD_BZ"] = 0;
|
|
s["XLXSBJDXTHDZQD_WHR"] = 0;
|
|
s["XLXSBJDXTHDZQD_WHSJ"] = 0;
|
|
return s;
|
|
}
|
|
}
|
|
}
|