209 lines
8.6 KiB
C#
209 lines
8.6 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;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class BJCPXDList : SingleGridBase
|
||
{
|
||
BJCPXD entity = new BJCPXD();
|
||
BJCPXD_M qryEntity = new BJCPXD_M();
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860097;
|
||
this.UMName = "报价产品修订";
|
||
this.CurMaster = Master;
|
||
this.ModuleGV = ContentGrid;
|
||
this.CurEntity = entity;
|
||
this.CurQueryEntity = qryEntity;
|
||
this.sURLTarget = "BJCPXDInfo.aspx";
|
||
this.sQueryURLTarget = "BJCPXDQuery.aspx";
|
||
this.PageHeight = 600;
|
||
this.PageWidth = 750;
|
||
this.CanDeleteCheckedRows = true;
|
||
base.DataKeyNames = new string[] { "XLXSBJYLZDMX_SQDH", "XLXSBJYLZDMX_XH" };
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
CurQueryEntity.FieldByName("XLXHIDJQPP").Value = "True";
|
||
CurQueryEntity.FieldByName("XLGGIDJQPP").Value = "True";
|
||
}
|
||
|
||
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)
|
||
{
|
||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||
{
|
||
LinkPageParam.AddString("XLXSBJYLZDMX_SQDH", this.ContentGrid.DataKeys[e.Row.RowIndex]["XLXSBJYLZDMX_SQDH"].ToString().Trim());
|
||
LinkPageParam.AddString("XLXSBJYLZDMX_XH", this.ContentGrid.DataKeys[e.Row.RowIndex]["XLXSBJYLZDMX_XH"].ToString().Trim());
|
||
}
|
||
base.moduleGV_RowDataBound(sender, e);
|
||
}
|
||
|
||
protected override bool Master_BeforeDeleteAction(object sender, EventArgs e)
|
||
{
|
||
|
||
entity.Param.Add("XLXSBJYLZDMX_SQDH", this.ContentGrid.DataKeys[ContentGrid.SelectedIndex]["XLXSBJYLZDMX_SQDH"].ToString().Trim());
|
||
entity.Param.Add("XLXSBJYLZDMX_XH", this.ContentGrid.DataKeys[ContentGrid.SelectedIndex]["XLXSBJYLZDMX_XH"].ToString().Trim());
|
||
|
||
return base.Master_BeforeDeleteAction(sender, e);
|
||
|
||
}
|
||
|
||
protected override void AfterDelete(TDatabase db, ref bool ActionIsDone)
|
||
{
|
||
base.AfterDelete(db, ref ActionIsDone);
|
||
}
|
||
|
||
protected override bool Master_AfterDeleteAction(object sender, EventArgs e)
|
||
{
|
||
if (!base.Master_AfterDeleteAction(sender, e))
|
||
{ return false; }
|
||
base.InitEntityByCondition();
|
||
entity.EntityTable.QuerySelSql = GetSql();
|
||
entity.GridDataBind(ContentGrid, tSession);
|
||
ContentGrid.SelectedIndex = -1;
|
||
return true;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 自定义函数
|
||
|
||
private string GetSql()
|
||
{
|
||
StringBuilder strSQL = new StringBuilder();
|
||
strSQL.AppendLine(" select XLXSBJYLZDMX_SQDH,XLXSBJYLZDMX_XH,XLXSBJYLZDMX_BJDXH,");
|
||
strSQL.AppendLine(" XLXSBJYLZDMX_BJDXLXHID,XLXSBJYLZDMX_BJDXLGGID,XLXSBJYLZDMX_BJDXLBZID,RTRIM(XLXSBJYLZDMX_BJDXLBZID)||'|'||isnull(A.XLBZ_XLBZLXMC,' ') as XLBZ, ");
|
||
strSQL.AppendLine(" XLXSBJYLZDMX_BJDDYDJID,XLXSBJYLZDMX_XLXHID,XLXSBJYLZDMX_XLGGID, ");
|
||
strSQL.AppendLine(" XLXSBJYLZDMX_XLBZID,XLXSBJYLZDMX_DYDJID,RTRIM(XLXSBJYLZDMX_XLBZID)||'|'||isnull(B.XLBZ_XLBZLXMC,' ') as XDXLBZ,");
|
||
strSQL.AppendLine(" XLXSBJYLZDMX_BZ,XLXSBJYLZDMX_WHR,XLXSBJYLZDMX_WHRID,XLXSBJYLZDMX_WHSJ,XLXSBJYLZDMX_DZSC ");
|
||
strSQL.AppendLine(" from XLXSBJYLZDMX ");
|
||
strSQL.AppendLine(" left join XLBZ A on A.XLBZ_XLBZID = XLXSBJYLZDMX_BJDXLBZID ");
|
||
strSQL.AppendLine(" left join XLBZ B on B.XLBZ_XLBZID = XLXSBJYLZDMX_XLBZID ");
|
||
strSQL.AppendLine(" where 1=1 and XLXSBJYLZDMX_SQDH='0000000000'");
|
||
//型号模糊
|
||
if (!CurQueryEntity.FieldByName("XLXHIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||
{
|
||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
|
||
{
|
||
strSQL.AppendLine(" \r\n and XLXSBJYLZDMX_BJDXLXHID like :pXLXHID ");
|
||
entity.Param.Add("pXLXHID", "%" + CurQueryEntity.FieldByName("XLXHID").Value.Trim() + "%");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string sXLXHID = CurQueryEntity.FieldByName("XLXHID").Value.Trim();
|
||
if (!string.IsNullOrEmpty(sXLXHID))
|
||
{
|
||
string[] sTemp = sXLXHID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (sTemp.Length >= 2)
|
||
{
|
||
strSQL.AppendLine(" \r\n and " + CMISproDataBase.GetWhereEqual("XLXSBJYLZDMX_BJDXLXHID", sXLXHID));
|
||
}
|
||
else
|
||
{
|
||
strSQL.AppendLine(" \r\n and XLXSBJYLZDMX_BJDXLXHID = :pXLXHID ");
|
||
entity.Param.Add("pXLXHID", sXLXHID);
|
||
}
|
||
}
|
||
}
|
||
//规格模糊
|
||
if (!CurQueryEntity.FieldByName("XLGGIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||
{
|
||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLGGID").Value.Trim()))
|
||
{
|
||
strSQL.AppendLine(" and replace(XLXSBJYLZDMX_BJDXLGGID,'*','×') like :pXLGGID ");
|
||
entity.Param.Add("pXLGGID", "%" + CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×") + "%");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string sXLGGID = CurQueryEntity.FieldByName("XLGGID").Value.Trim();
|
||
if (!string.IsNullOrEmpty(sXLGGID))
|
||
{
|
||
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (sTemp.Length >= 2)
|
||
{
|
||
strSQL.AppendLine(" and " + CMISproDataBase.GetWhereEqual(" replace(XLXSBJYLZDMX_BJDXLGGID,'*','×')", sXLGGID.Replace('*', '×')));
|
||
}
|
||
else
|
||
{
|
||
strSQL.AppendLine(" and replace(XLXSBJYLZDMX_BJDXLGGID,'*','×') = :pXLGGID ");
|
||
entity.Param.Add("pXLGGID", CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×"));
|
||
}
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("ST").Value.Trim()))
|
||
{
|
||
strSQL.AppendLine(" and XLXSBJYLZDMX_BJDXLBZID = :pST ");
|
||
entity.Param.Add("pST", CurQueryEntity.FieldByName("ST").Value.Trim());
|
||
}
|
||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("DYDJ").Value.Trim()))
|
||
{
|
||
strSQL.AppendLine(" and XLXSBJYLZDMX_BJDDYDJID = :pDYDJ ");
|
||
entity.Param.Add("pDYDJ", CurQueryEntity.FieldByName("DYDJ").Value.Trim());
|
||
}
|
||
strSQL.AppendLine(" order by XLXSBJYLZDMX_XH");
|
||
return strSQL.ToString();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 控件事件
|
||
|
||
protected void btnDR_Click(object sender, EventArgs e)
|
||
{
|
||
TPageParams pageParams = new TPageParams();
|
||
pageParams.UrlPath = "BJCPXD_DRInfo.aspx";
|
||
pageParams.Title = "导入Excel文件";
|
||
pageParams.AddString("btnRefreshCID", btnRefresh.ClientID);
|
||
OpenDialog(pageParams);
|
||
}
|
||
|
||
protected void btnRefresh_Click(object sender, EventArgs e)
|
||
{
|
||
moduleGV_PageIndexChanging(null, null);
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
}
|