protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.DataItem != null) { PurchasePlanMstr2 m = (PurchasePlanMstr2)e.Row.DataItem; var runShipPlanLogs = TheGenericMgr.FindAllWithCustomQuery <RunPurchasePlanLog2>("select r from RunPurchasePlanLog2 as r where r.BatchNo=?", m.BatchNo); if (runShipPlanLogs == null || runShipPlanLogs.Count == 0) { System.Web.UI.WebControls.LinkButton lbtnShowErrorMsg = e.Row.FindControl("lbtnShowErrorMsg") as System.Web.UI.WebControls.LinkButton; lbtnShowErrorMsg.Visible = false; } if (m.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { System.Web.UI.WebControls.LinkButton lbtSubmit = e.Row.FindControl("lbtSubmit") as System.Web.UI.WebControls.LinkButton; lbtSubmit.Visible = false; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string releaseNo = ((LinkButton)sender).CommandArgument; IList <PurchasePlanMstr2> mstr = TheGenericMgr.FindAllWithCustomQuery <PurchasePlanMstr2>(string.Format(" select m from PurchasePlanMstr2 as m where m.Status='{0}' and ReleaseNo={1} ", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE, releaseNo)); if (mstr != null && mstr.Count > 0) { PurchasePlanMstr2 m = mstr.First(); DateTime dateNow = System.DateTime.Now; m.LastModifyUser = this.CurrentUser.Code; m.LastModifyDate = dateNow; m.ReleaseDate = dateNow; m.ReleaseUser = this.CurrentUser.Code; m.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT; TheGenericMgr.Update(m); ShowSuccessMessage("释放成功。"); } else { ShowErrorMessage("没有需要释放的采购计划。"); } }