// 品項載入 protected void btnLoad_Click(object sender, EventArgs e) { PURModel.MaintainPurchaseDayGood PUR = new PURModel.MaintainPurchaseDayGood(ConnectionDB); ErrorMsgLabel.Text = ""; if (txtPLAN_ACCEPT_DATE.Text == "") { ErrorMsgLabel.Text = "預定進貨日不可空白"; return; } if (txtPICK_BATCH.Text == "") { ErrorMsgLabel.Text = "理貨批次不可空白"; return; } string nowDate = DateTime.Now.ToString("yyy/MM/dd"); int v = nowDate.CompareTo(this.txtPLAN_ACCEPT_DATE.Text); if (v > 0) { ErrorMsgLabel.Text = "門市進貨日小於系統日,不可進行品項轉入"; return; } //判斷 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); if (PUR.CheckStAcceptData(ParameterList) == "0") { ErrorMsgLabel.Text = "門市進貨日及批次已轉門市進貨單,不可載入每日預定出貨明細資料 !!"; return; } hid_ButtonStatus.Value = "LOAD"; //抓取本頁初次登記的時間 SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB); DataTable Dt = BCO.QuerySwitch(PURModel.MaintainPurchaseDayGood.QueryType.QueryByLOAD, ParameterList); Session[SessionIDName] = Dt; GridView1.DataSource = Dt; #region 將明細資料放至DetailDt中 detailTmpDt = Dt; #endregion #region 將空白的資料做處理 for (int i = 0; i < Dt.Rows.Count; i++) { for (int j = 0; j < Dt.Columns.Count; j++) { if (Dt.Columns[j].DataType == typeof(System.String)) { if (Dt.Rows[i][j].GetType() == typeof(System.DBNull)) { Dt.Rows[i][j] = ""; } } if (Dt.Columns[j].DataType == typeof(System.Decimal)) { if (Dt.Rows[i][j].GetType() == typeof(System.DBNull)) { Dt.Rows[i][j] = 0; } } } } #endregion #region 使用XML放置到前端資料 DataSet Ds = Dt.DataSet; DetailOLDData.InnerHtml = Ds.GetXml(); #endregion //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { btnPrint.Visible = false; btnExport.Visible = false; btnEdit.Visible = false; ErrorMsgLabel.Text = "查無資料"; } else { btnPrint.Visible = true; btnExport.Visible = true; btnEdit.Visible = true; this.hid_PageStatus.Value = "EDIT"; hidStatus.Value = "2"; //進入編輯狀態 SetPageStatus(); } #region ToolBar設定 if (detailTmpDt == null || (detailTmpDt != null && detailTmpDt.Rows.Count <= 0)) { GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "PUR031.aspx?Code=PUR03", null, WUI_GMToolbarV.ClickAction.LinkURL); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnExport, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnExport, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); } else { GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, false, "PUR031.aspx?Code=PUR03", null, WUI_GMToolbarV.ClickAction.LinkURL); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnExport, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnExport, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); } #endregion }
private void databind() { SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB); DataTable Dt = BCO.QuerySwitch(PURModel.MaintainPurchaseDayGood.QueryType.QueryByFIND, ParameterList); Session[SessionIDName] = Dt; GridView1.DataSource = Dt; #region 將明細資料放至DetailDt中 detailTmpDt = Dt; #endregion #region 將空白的資料做處理 for (int i = 0; i < Dt.Rows.Count; i++) for (int j = 0; j < Dt.Columns.Count; j++) { if (Dt.Columns[j].DataType == typeof(System.String)) if (Dt.Rows[i][j].GetType() == typeof(System.DBNull)) Dt.Rows[i][j] = ""; if (Dt.Columns[j].DataType == typeof(System.Decimal)) if (Dt.Rows[i][j].GetType() == typeof(System.DBNull)) Dt.Rows[i][j] = 0; } #endregion #region 使用XML放置到前端資料 DataSet Ds = Dt.DataSet; DetailOLDData.InnerHtml = Ds.GetXml(); #endregion //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) ErrorMsgLabel.Text = "查無資料"; if (ErrorMsgLabel.Text == "查無資料") hidStatus.Value = "0"; //進入檢視狀態 else hidStatus.Value = "1"; //進入檢視狀態 SetPageStatus(); }
// 列印 protected void btnPrint_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB); DataTable Dt_Print = BCO.QuerySwitch(PURModel.MaintainPurchaseDayGood.QueryType.QueryByPrint, ParameterList); if (Dt_Print.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "PUR031.aspx", "alert(' 查無資料 ');", true); return; } ShowReport(Dt_Print); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { } } }
}//設定各種模式預設值 private void databind_Export() { ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB); DataTable Dt_Export = BCO.QuerySwitch(PURModel.MaintainPurchaseDayGood.QueryType.QueryByExport, ParameterList); GridView2.DataSource = Dt_Export; GridView2.DataBind(); if (Dt_Export == null || (Dt_Export != null && Dt_Export.Rows.Count <= 0)) ErrorMsgLabel.Text = "查無資料"; }