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 GThinking.N_MISPRO.TableCache; namespace GThinking.N_XLXSBJ { public partial class XSBJYWPZList : SingleGridBase { XSBJYWPZ entity = new XSBJYWPZ(); #region Page类事件继承 protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860062; this.UMName = "销售报价业务配置"; this.CurMaster = Master; this.ModuleGV = grdXSBJYWPZ; this.CurEntity = entity; this.sURLTarget = "XSBJYWPZInfo.aspx"; this.PageHeight = 600; this.PageWidth = 750; base.DataKeyNames = new string[] { "XLXSBJPZ_MDID" }; this.Master.EnableQueryBtn = false; this.Master.EnableNewBtn= false; this.Master.EnableCopyBtn = false; this.Master.EnableDeleteBtn = false; if (DSActiveModule.IsActiveModule(102577006)) btnBJXDBZ.Visible = true; else btnBJXDBZ.Visible = false; base.InitPage(); if (!IsPostBack) { Master_OnStandardQuery(null, null); } } #endregion #region 模板事件 protected override void Master_OnStandardQuery(object sender, EventArgs e) { entity.EntityTable.QuerySelSql = GetSql(); base.Master_OnStandardQuery(sender, e); entity.GridDataBind(grdXSBJYWPZ,tSession); } protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e) { entity.EntityTable.QuerySelSql = GetSql(); base.moduleGV_PageIndexChanging(sender, e); grdXSBJYWPZ.SelectedIndex = -1; } protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //int indexBJFLIDS = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_BJFLIDS")); int indexKHJSLY = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_KHJSLY")); int indexXMJSLY = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_XMJSLY")); int indexCLYLZJFS = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_CLYLZJFS")); int indexZDBMIDS = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_ZDBMIDS")); int indexZDRGHS = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_ZDRGHS")); int indexBMYSLIST = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_BMYSLIST")); int indexWBPPZXSX = grdXSBJYWPZ.Columns.IndexOf(grdXSBJYWPZ.FindColumnByFieldName("XLXSBJPZ_WBPPZXSX")); //if ((e.Row.Cells[indexBJFLIDS].Text.Trim() != "") && (e.Row.Cells[indexBJFLIDS].Text.Trim() != " ")) //{ // e.Row.Cells[indexBJFLIDS].Text = GetBJFLIDS(e.Row.Cells[indexBJFLIDS].Text.Trim()); //} if ((e.Row.Cells[indexKHJSLY].Text.Trim() != "") && (e.Row.Cells[indexKHJSLY].Text.Trim() != " ")) { e.Row.Cells[indexKHJSLY].Text = GetKHJSLY(e.Row.Cells[indexKHJSLY].Text.Trim()); } if ((e.Row.Cells[indexXMJSLY].Text.Trim() != "") && (e.Row.Cells[indexXMJSLY].Text.Trim() != " ")) { e.Row.Cells[indexXMJSLY].Text = GetXMJSLY(e.Row.Cells[indexXMJSLY].Text.Trim()); } if ((e.Row.Cells[indexCLYLZJFS].Text.Trim() != "") && (e.Row.Cells[indexCLYLZJFS].Text.Trim() != " ")) { e.Row.Cells[indexCLYLZJFS].Text = GetCLYLZJFS(e.Row.Cells[indexCLYLZJFS].Text.Trim()); } if ((e.Row.Cells[indexZDBMIDS].Text.Trim() != "") && (e.Row.Cells[indexZDBMIDS].Text.Trim() != " ")) { e.Row.Cells[indexZDBMIDS].Text = GetZDBMIDS(e.Row.Cells[indexZDBMIDS].Text.Trim()); } if ((e.Row.Cells[indexZDRGHS].Text.Trim() != "") && (e.Row.Cells[indexZDRGHS].Text.Trim() != " ")) { e.Row.Cells[indexZDRGHS].Text = GetZDRGHS(e.Row.Cells[indexZDRGHS].Text.Trim()); } if ((e.Row.Cells[indexBMYSLIST].Text.Trim() != "") && (e.Row.Cells[indexBMYSLIST].Text.Trim() != " ")) { e.Row.Cells[indexBMYSLIST].Text = GetBMYSLIST(e.Row.Cells[indexBMYSLIST].Text.Trim()); } if ((e.Row.Cells[indexWBPPZXSX].Text.Trim() != "") && (e.Row.Cells[indexWBPPZXSX].Text.Trim() != " ")) { e.Row.Cells[indexWBPPZXSX].Text = GetWBPPZXSX(e.Row.Cells[indexWBPPZXSX].Text.Trim()); } LinkPageParam.AddString("XLXSBJPZ_MDID", this.grdXSBJYWPZ.DataKeys[e.Row.RowIndex]["XLXSBJPZ_MDID"].ToString().Trim()); } base.moduleGV_RowDataBound(sender, e); } protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone) { entity.Param.Add("XLXSBJPZ_MDID", this.grdXSBJYWPZ.DataKeys[grdXSBJYWPZ.SelectedIndex]["XLXSBJPZ_MDID"].ToString().Trim()); base.BeforeDelete(db, ref ActionIsDone); } protected override bool Master_BeforeDeleteAction(object sender, EventArgs e) { return true; } 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; } entity.EntityTable.QuerySelSql = GetSql(); entity.GridDataBind(grdXSBJYWPZ, tSession); grdXSBJYWPZ.SelectedIndex = -1; return true; } #endregion #region 自定义函数 private string GetSql() { StringBuilder strSQL = new StringBuilder(); strSQL.AppendLine(" select XLXSBJPZ_MDID,XLXSBJPZ_BJFLIDS,XLXSBJPZ_KHJSLY, "); strSQL.AppendLine(" XLXSBJPZ_XMJSLY,ISNULL(XLXSBJPZ_KHBT,'N') as XLXSBJPZ_KHBT,ISNULL(XLXSBJPZ_XMBT,'N') as XLXSBJPZ_XMBT,XLXSBJPZ_CLYLZJFS,ISNULL(XLXSBJPZ_ALMXZBJCL,'N') as XLXSBJPZ_ALMXZBJCL, "); strSQL.AppendLine(" XLXSBJPZ_ZDBMIDS,XLXSBJPZ_ZDRGHS,ISNULL(XLXSBJPZ_SQXMBAGL,'N') as XLXSBJPZ_SQXMBAGL, "); strSQL.AppendLine(" case XLXSBJPZ_XZKHYQ when 'Q' then '报价前维护' else case XLXSBJPZ_XZKHYQ when 'H' then '报价后维护' else ' ' end end as XLXSBJPZ_XZKHYQ, "); strSQL.AppendLine(" case XLXSBJPZ_XZXMYQ when 'Q' then '报价前维护' else case XLXSBJPZ_XZXMYQ when 'H' then '报价后维护' else ' ' end end as XLXSBJPZ_XZXMYQ, "); strSQL.AppendLine(" XLXSBJPZ_BMYSLIST, "); strSQL.AppendLine(" XLXSBJPZ_WBPPZXSX, "); strSQL.AppendLine(" case isnull(XLXSBJPZ_TBJCLID, ' ') when ' ' then ' ' else rtrim(XLXSBJPZ_TBJCLID)||'|'||rtrim(bjcla.XLXSBJCL_BJCLMC) end as TBJCLMC, "); strSQL.AppendLine(" case isnull(XLXSBJPZ_LBJCLID, ' ') when ' ' then ' ' else rtrim(XLXSBJPZ_LBJCLID)||'|'||rtrim(bjclb.XLXSBJCL_BJCLMC) end as LBJCLMC, "); strSQL.AppendLine(" XLXSBJPZ_TBJCLID, XLXSBJPZ_LBJCLID, "); strSQL.AppendLine(" XLXSBJPZ_WHR,XLXSBJPZ_WHRID,XLXSBJPZ_WHSJ "); strSQL.AppendLine(" from XLXSBJPZ "); strSQL.AppendLine(" left join XLXSBJCL bjcla on bjcla.XLXSBJCL_BJCLID = XLXSBJPZ_TBJCLID "); strSQL.AppendLine(" left join XLXSBJCL bjclb on bjclb.XLXSBJCL_BJCLID = XLXSBJPZ_LBJCLID "); strSQL.AppendLine(" where 1=1 order by XLXSBJPZ_MDID "); return strSQL.ToString(); } private string GetBJFLIDS(string sBJFLIDS) { string Result = ""; TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Add(" select XLXSBJFL_BJFLID,XLXSBJFL_BJFLMC from XLXSBJFL "); SQL.Add(" where 1 = 1 and " + CMISproDataBase.GetWhereEqual("XLXSBJFL_BJFLID", sBJFLIDS)); SQL.Add(" order by XLXSBJFL_XSXH,XLXSBJFL_BJFLID "); DataSet ds = dberp.OpenDataSet(SQL); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Result = Result + ds.Tables[0].Rows[i][0].ToString().Trim() + "|" + ds.Tables[0].Rows[i][1].ToString().Trim() + ","; } } Result = Result.TrimEnd(','); return Result; } private string GetKHJSLY(string sKHJSLY) { string Result = ""; if (sKHJSLY.Equals("")) { Result = ""; } else if (sKHJSLY.Equals("KH")) { Result = "客户"; } else if (sKHJSLY.Equals("KHXX")) { Result = "售前客户"; } return Result; } private string GetXMJSLY(string sXMJSLYID) { string Result = ""; if (sXMJSLYID.Equals("")) { Result = ""; } else if (sXMJSLYID.Equals("YXXM")) { Result = "售前项目"; } return Result; } private string GetCLYLZJFS(string sCLYLZJFS) { string Result = ""; if (sCLYLZJFS.Equals("")) { Result = ""; } else { Result = sCLYLZJFS.Replace("0", "0|销售报价单明细无清单触发").Replace("1", "1|销售价格表明细无清单触发").Replace("2", "2|销售报价单明细无清单人为挑选触发").Replace("3", "3|销售报价单明细无表价人为挑选触发"); } return Result; } private string GetZDBMIDS(string sBMIDList) { string Result = ""; TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add(" select BM_BMID, BM_MC from BM where 1=1"); SQL.Add(" and " + CMISproDataBase.GetWhereEqual("BM_BMID", sBMIDList)); DataSet ds= dberp.OpenDataSet(SQL); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Result = Result+ "," + ds.Tables[0].Rows[i][0].ToString().Trim() + "|" + ds.Tables[0].Rows[i][1].ToString().Trim(); } Result = Result.TrimStart(',').TrimEnd(','); return Result; } private string GetZDRGHS(string sGHList) { string Result = ""; TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add(" select RSRYJBXX_GH, RSRYJBXX_RYMC from RSRYJBXX where 1=1"); SQL.Add(" and " + CMISproDataBase.GetWhereEqual("RSRYJBXX_GH", sGHList)); DataSet ds = dberp.OpenDataSet(SQL); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Result = Result + "," + ds.Tables[0].Rows[i][0].ToString().Trim() + "|" + ds.Tables[0].Rows[i][1].ToString().Trim(); } Result = Result.TrimStart(',').TrimEnd(','); return Result; } private string GetBMYSLIST(string sBMYSLIST) { string Result = ""; Result = sBMYSLIST.Replace("XZQHID", "项目所在地简称"); Result = Result.Replace("BJFLTZM", "报价分类特征码"); return Result; } private string GetWBPPZXSX(string sWBPPZXSX) { string Result = ""; if (sWBPPZXSX.Equals("")) { Result = ""; } else if (sWBPPZXSX.Equals("A")) { Result = "线缆销售材料清单"; } else if (sWBPPZXSX.Equals("B")) { Result = "线缆销售价格表"; } else if (sWBPPZXSX.Equals("C")) { Result = "先材料清单再价格表"; } else if (sWBPPZXSX.Equals("D")) { Result = "先价格表再材料清单"; } return Result; } #endregion #region 控件事件 protected void btnBJCPYS_MenuItemClick(object sender, string ItemIndex) { switch (ItemIndex) { case "CPYT": TPageParams pageParams = new TPageParams(); pageParams.UrlPath = "XSBJYWPZ_CPYSList.aspx"; OpenDialog(pageParams); break; } } protected void btnBJXDBZ_MenuItemClick(object sender, string ItemIndex) { TPageParams tpp = new TPageParams(); switch (ItemIndex) { case "XHML": tpp.UrlPath = "../Components/N_XLBJPZ/XDBZSZList.aspx"; tpp.AddString("PPLX", "A"); OpenModuleDialog(102577006, tpp); break; case "BZ": tpp.UrlPath = "../Components/N_XLBJPZ/XDBZSZList.aspx"; tpp.AddString("PPLX", "B"); OpenModuleDialog(102577006, tpp); break; } } protected void btnBJCPWL_Click(object sender, EventArgs e) { TPageParams pageParams = new TPageParams(); pageParams.CallAction = TPageCallAction.pcaBrowse; pageParams.UrlPath = "XSBJYWPZ_BJXDWLList.aspx"; OpenDialog(pageParams); } protected void btnBJCPMRBZDY_Click(object sender, EventArgs e) { TPageParams pageParams = new TPageParams(); pageParams.CallAction = TPageCallAction.pcaBrowse; pageParams.UrlPath = "XSBJYWPZ_MRXHDYList.aspx"; OpenDialog(pageParams); } protected void btnMRJLDW_MenuItemClick(object sender, string ItemIndex) { switch (ItemIndex) { case "JBXHSZ": TPageParams tpp = new TPageParams(); tpp.UrlPath = "../Components/N_XLBJPZ/AJBXHSZJLDWList.aspx"; OpenModuleDialog(102577008, tpp); break; } } protected void btnWGCP_Click(object sender, EventArgs e) { TPageParams pageParams = new TPageParams(); pageParams.CallAction = TPageCallAction.pcaBrowse; pageParams.UrlPath = "../Components/N_XLBJPZ/WGCPList.aspx"; OpenModuleDialog(102577009, pageParams); } #endregion } }