private void txtPERIOD_Blur() { radPICK_SELECT1.Enabled = false; radPICK_SELECT2.Enabled = false; SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); string Item_Name = SLP_VIRTUAL_CODE.TextBox_Name.Text; if (Item_Name != "" && Item_Name != "查無資料" && txtPERIOD.Text != "") { //檢核重複 if (Session[SessionIDName] != "" && Session[SessionIDName] != null) { DataTable DetailDt = (DataTable)Session[SessionIDName]; DataRow[] ddrs = DetailDt.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "'"); if (ddrs.Length > 0) { ErrorMsgLabel.Text = "品號、期別資料已存在,請重新輸入"; //Focus(txtPERIOD.ClientID); hidPERIOD.Value = txtPERIOD.Text; return; } } } if (SLP_VIRTUAL_CODE.Text != "") { try { if(txtPERIOD.Text!="") if (ChkPUR04Dup()) { ErrorMsgLabel.Text = "品號" + SLP_VIRTUAL_CODE.Text + "、期別" + txtPERIOD.Text + "、門市進貨日" + txtPLAN_ACCEPT_DATE.Text + "已有相同品號存在,請確認"; return; } string Msg = ""; ViewState["NoPeriod"] = "1"; //預設會存在該期別 string v_PLAN_ACCEPT_DATE = txtPLAN_ACCEPT_DATE.Text; string v_ITEM = SLP_VIRTUAL_CODE.Text; string v_PERIOD = txtPERIOD.Text; ParameterList.Clear(); ParameterList.Add(v_ITEM); ParameterList.Add(v_PERIOD); PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB); if (SLP_VIRTUAL_CODE.Text.Length > 6) { if (!BCO.QueryPeriod(ParameterList)) { ViewState["NoPeriod"] = "0"; //期別不存在於該品號 throw new Exception("期別不存在於該品號"); } } else { BCO.CheckItemData(ParameterList, out Msg); if (Msg != "") { ViewState["NoPeriod"] = "0"; //期別不存在於該品號 throw new Exception(Msg); } } getQTY_Data(); radPICK_SELECT1.Enabled = true; radPICK_SELECT2.Enabled = true; } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } if (SLP_VIRTUAL_CODE.Text == "" || txtPERIOD.Text == "") { lblONWAY_QTY.Text = ""; lblONHD_QTY.Text = ""; lblDIS_QTY.Text = ""; lblDIFF_QTY.Text = ""; } hidPERIOD.Value = txtPERIOD.Text; }
private bool checkDetailData(DataTable dt) { string iDray = ""; string iDray_PERIOD = ""; string Msg = ""; bool checkFlag = true; try { foreach (DataRow dr in dt.Rows) if (dr["ITEM"].ToString() == "") throw new Exception("品號、期別資料重複,請確認"); for (Int32 i = 0; i < dt.Rows.Count; i++) { iDray = dt.Rows[i]["VIRTUAL_CODE"].ToString(); iDray_PERIOD = dt.Rows[i]["PERIOD"].ToString(); if (dt.Rows[i]["ISDEL"].ToString() == "" || dt.Rows[i]["ISDEL"].ToString() == "0") { if (iDray == null || iDray == "") { ErrorMsgLabel.Text = " 品號資料不可空白,請確認"; checkFlag = false; break; } if (iDray_PERIOD == null || iDray_PERIOD == "") { ErrorMsgLabel.Text = iDray + " 期別資料不可空白,請確認"; checkFlag = false; break; } PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB); ParameterList.Clear(); ParameterList.Add(iDray); ParameterList.Add(null); BCO.CheckItemData(ParameterList, out Msg); if (Msg != "") { ErrorMsgLabel.Text = iDray + " " + Msg + ",請確認"; checkFlag = false; break; } ParameterList.Clear(); ParameterList.Add(iDray); ParameterList.Add(iDray_PERIOD); BCO.CheckItemData(ParameterList, out Msg); if (Msg != "") { ErrorMsgLabel.Text = iDray + " " + Msg + ",請確認"; checkFlag = false; break; } } } return checkFlag; } catch (Exception ex) { return checkFlag; ErrorMsgLabel.Text = ex.Message; } }
private void txtPERIOD_Blur() { SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); string Item_Name = ((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)SLP_VIRTUAL_CODE).FindControl("TextBoxName")).Text; if (Item_Name != "" && Item_Name != "查無資料" && txtPERIOD.Text != "" && txtPURCHASE_NO.Text.Trim() != "") { //檢核重複 DataTable DetailDt = (DataTable)Session[SessionIDName]; DataRow[] ddrs = DetailDt.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "' and PURCHASE_NO = '" + txtPURCHASE_NO.Text + "'"); if (ddrs.Length > 0) { ErrorMsgLabel.Text = "品號、期別、採購單號資料已存在,請重新輸入"; //Focus(((TextBox)SLP_PERIOD.FindControl("TextBoxCode")).ClientID); return; } } if (SLP_VIRTUAL_CODE.Text != "") { try { string Msg = ""; ViewState["NoPeriod"] = "1"; //預設會存在該期別 ParameterList.Clear(); ParameterList.Add(SLP_VIRTUAL_CODE.Text); ParameterList.Add(txtPERIOD.Text); PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB); if (SLP_VIRTUAL_CODE.Text.Length > 6) { if (!BCO.QueryPeriod(ParameterList)) { //Focus(txtPERIOD.ClientID); ViewState["NoPeriod"] = "0"; //期別不存在於該品號 throw new Exception("期別不存在於該品號"); } } else { BCO.CheckItemData(ParameterList, out Msg); if (Msg != "") { ViewState["NoPeriod"] = "0"; //期別不存在於該品號 throw new Exception(Msg); } } getQTY_Data(); //if (ErrorMsgLabel.Text == "此品號、期別無未結採購單號資料,請重新輸入") // Focus(((TextBox)SLP_PERIOD.FindControl("TextBoxCode")).ClientID); //else // Focus(txtPURCHASE_NO.ClientID); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } if (SLP_VIRTUAL_CODE.Text == "" || txtPERIOD.Text == "") { txtPURCHASE_NO.Text = ""; SLP_PURCHASE_QTY.Text = ""; txtMSG.Text = ""; } }