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]["GV_DEL"].ToString() == "" || dt.Rows[i]["GV_DEL"].ToString() == "1") { if (iDray == null || iDray == "") { ErrorMsgLabel.Text = " 品號資料不可空白,請確認"; checkFlag = false; break; } if (iDray_PERIOD == null || iDray_PERIOD == "") { ErrorMsgLabel.Text = iDray + " 期別資料不可空白,請確認"; checkFlag = false; break; } PURModel.PUR09_BCO BCO = new PURModel.PUR09_BCO(ConntionDB); 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() { radPICK_SELECT1.Enabled = false; radPICK_SELECT2.Enabled = false; btn_GV_Set.Enabled = false; btn_GV_Find.Enabled = false; string Item_Name = Request.Form[SLP_VIRTUAL_CODE.TextBox_Name.UniqueID]; if (SLP_VIRTUAL_CODE.Text != "") { try { if (SLP_VIRTUAL_CODE.Text.Length < 6) { ErrorMsgLabel.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.PUR09_BCO BCO = new PURModel.PUR09_BCO(ConntionDB); 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); } } if (txtPERIOD.Text != "" && Item_Name != "" && Item_Name != "查無資料" && txtPERIOD.Text != "") { string strCheckMsg = ChkDupData(txtPLAN_ACCEPT_DATE.Text, SLP_VIRTUAL_CODE.Text, txtPERIOD.Text, txtPICK_BATCH.Text, ViewState["DelDataType"].ToString()); if (strCheckMsg != "") { ErrorMsgLabel.Text = strCheckMsg; hidVIRTUAL_CODE.Value = SLP_VIRTUAL_CODE.Text; return; } } getQTY_Data(); AddNewChannel(SLP_VIRTUAL_CODE.Text, txtPERIOD.Text, txtPLAN_ACCEPT_DATE.Text, txtPICK_BATCH.Text, "3", ""); btn_GV_Set.Enabled = true; btn_GV_Find.Enabled = true; 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; }