protected void btnDel_Click(object sender, EventArgs e) { MaintainPurchaseOrder bcop = new MaintainPurchaseOrder(ConntionDB); bool IsAcceptOK = bcop.CheckPurchaseIsACCEPT(this.txtPURCHASE_NO.Text); if (IsAcceptOK) { ErrorMsgLabel.Text = "該筆已有驗收單資料,不可進行刪除!!"; return; } else { //CheckVendorAccountClose BCO_CHECK = new CheckVendorAccountClose(ConntionDB); //if (BCO_CHECK.CheckVendorCloseStaus(txtONWAY_DATE.Text.Replace("/", "")) == "1") //{ // ErrorMsgLabel.Text = "在途日 " + txtONWAY_DATE.Text.Replace("/", "") + " 已日結,不可刪除在途單。"; // return; //} //else //{ try { DataTable dt1 = (DataTable)Session[PageTimeStamp.Value + GridView1.ID]; DataTable dt2 = (DataTable)Session[PageTimeStamp.Value + GridView2.ID]; string strNowDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); MaintainGoodsInTransit BCO = new MaintainGoodsInTransit(ConntionDB); bool bResult = false; //0.Item DataTable //1.Gift DataTable //2.ONWAY_NO //3.UPDATEDATE //4.UPDATEUID //5.OLD_UPDATEDATE //6.OLD_UPDATEUID ParameterList.Clear(); ParameterList.Add(dt1); //0 ParameterList.Add(dt2); //1 ParameterList.Add(txtONWAY_NO.Text); //2 ParameterList.Add(strNowDate); //3 ParameterList.Add(Session["UID"].ToString()); //4 ParameterList.Add(hdfOLD_UPDATEDATE.Value); //5 ParameterList.Add(SLP_UPDATEUID.Text); //6 bResult = BCO.DeleteGoodsInTransit(ParameterList); Response.Redirect("PUR051.aspx?Code=PUR05", false); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } //} } }
//刪除主檔 事件 protected void BtnDelMain_Click(object sender, EventArgs e) { ErrorMsgLabel.Text = ""; if (this.hid_PageStatus.Value == "VIEW") { try { if (this.hiddenIsClose.Value == "1") { //判斷採購單是否有"在途單"內 MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB); bool IsOK = bco.CheckPurchaseIsOnWay(this.tbxPUR_No.Text); if (IsOK) { this.hid_PageStatus.Value = "VIEW"; this.txt_PageStatus.Text = "VIEW"; ErrorMsgLabel.Text = "該採購單有在途單,不可進行刪除!!"; } else { //如驗收單已有資料時,不得刪除資料。 bool IsAcceptOK = bco.CheckPurchaseIsACCEPT(this.tbxPUR_No.Text); if (IsAcceptOK) { this.hid_PageStatus.Value = "VIEW"; this.txt_PageStatus.Text = "VIEW"; ErrorMsgLabel.Text = "該採購單已有驗收單資料,不可進行刪除!!"; } else { ////判斷採購單的採購日是否己日結 //VGIModel.CheckVendorAccountClose dbo = new PIC.VDS2G.LGT.VGI.CheckVendorAccountClose(ConntionDB); //string IsClosed = dbo.CheckVendorCloseStaus(DateTime.Parse(this.PUR_PURDate.Text).ToString("yyyyMMdd")); //if (IsClosed == "1") //{ // ErrorMsgLabel.Text = "該採購單日已日結,不可進行修改!!"; //} //else //{ DataTable dtMasterOLD = (DataTable)ViewState["MasterOLDData"]; DataTable dtDetailOLD = (DataTable)ViewState["DetailOLDData"]; DataTable dtGiftOLD = (DataTable)ViewState["GiftOLDData"]; #region 刪除主檔時,相關動作 bco.DeteleMain_DetailData(this.tbxPUR_No.Text, Session["UID"].ToString(), null); ShowErrorMessage("刪除完成!!"); Response.Redirect("PUR021.aspx?Code=PUR02"); #endregion //} } } } else { ShowErrorMessage("該採購單已結案,不可刪除!!"); } } catch (Exception ex) { this.ErrorMsgLabel.Text = ex.Message; } finally { } } }