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; namespace GThinking.N_XLXSBJ { public partial class CPWLMLList : SingleGridBase { CPWLML entity = new CPWLML(); #region 页面事件 protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860045; this.UMName = "产品物料材料用量汇总"; this.CurMaster = Master; this.PageWidth = 900; this.PageHeight = 600; this.ModuleGV = grdGrid; this.CurEntity = entity; this.sURLTarget = "CPWLMLInfo.aspx"; this.Master.EnableQueryBtn = false; base.DataKeyNames = new string[] { "XLXSCPWLML_CPWLMLID" }; base.InitPage(); if (!IsPostBack) { entity.GridDataBind(grdGrid, tSession); } } #endregion #region 模板继承事件 protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkPageParam.AddString("XLXSCPWLML_CPWLMLID", grdGrid.DataKeys[e.Row.RowIndex]["XLXSCPWLML_CPWLMLID"].ToString().Trim()); } base.moduleGV_RowDataBound(sender, e); } protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e) { entity.EntityTable.QuerySelSql = GetQuerySql(); grdGrid.SelectedIndex = -1; base.moduleGV_PageIndexChanging(sender, e); } protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone) { TContextDatabases.GetDatabase("DBERP").ExecSQL("delete from XLXSCPWLMX where XLXSCPWLMX_CPWLMLID = '" + grdGrid.DataKeys[this.grdGrid.SelectedIndex]["XLXSCPWLML_CPWLMLID"].ToString().Trim() + "'"); entity.Param.Add("XLXSCPWLML_CPWLMLID", grdGrid.DataKeys[this.grdGrid.SelectedIndex]["XLXSCPWLML_CPWLMLID"].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 = GetQuerySql(); entity.GridDataBind(grdGrid, tSession); grdGrid.SelectedIndex = -1; return true; } #endregion #region 自定义函数 private string GetQuerySql() { string sSQL = " select XLXSCPWLML_CPWLMLID,XLXSCPWLML_CPWLMLMC,XLXSCPWLML_BZ,XLXSCPWLML_WHR,XLXSCPWLML_WHRID,XLXSCPWLML_WHSJ from XLXSCPWLML "; return sSQL; } #endregion } }