Exemple #1
0
    //檢核
    private bool checkDetailData()
    {
        string iDray = "";
        string jDray = "";
        string iDray_Qty = "";
        string jDray_Qty = "";
        string iDray_PERIOD = "";
        string Msg = "";

        bool checkFlag = true;
        SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
        DataTable dt = (DataTable)Session[SessionIDName];

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["ISDEL"] != null)
            {
                if (dr["ISDEL"].ToString() == "0" || dr["ISDEL"].ToString() == "")
                {
                    iDray = dr["VIRTUAL_CODE"].ToString();
                    iDray_PERIOD = dr["PERIOD"].ToString();
                    iDray_Qty = dr["PURCHASE_QTY"].ToString();

                    if (iDray == null || iDray == "")
                    {
                        ErrorMsgLabel.Text = " 品號資料不可空白,請確認";
                        checkFlag = false;
                        break;
                    }

                    if (iDray_PERIOD == null || iDray_PERIOD == "")
                    {
                        ErrorMsgLabel.Text = "品號:" + iDray + " 期別資料不可空白,請確認";
                        checkFlag = false;
                        break;
                    }

                    if (iDray_Qty == "0" || iDray_Qty == "")
                    {
                        ErrorMsgLabel.Text = "品號:" + iDray + " 採購數量需大於0,請確認";
                        checkFlag = false;
                        break;
                    }

                    if (!LengthVaild(dr["MSG"].ToString(), 60))
                    {
                        ErrorMsgLabel.Text = "品號:" + iDray + "「商品訊息」輸入資料大於系統限制,請確認";
                        checkFlag = false;
                        break;
                    }
                    ParameterList.Clear();
                    ParameterList.Add(iDray);
                    ParameterList.Add(null);
                    PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB);
                    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;
    }
Exemple #2
0
 private void txtITEM_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 = "";
             ParameterList.Clear();
             ParameterList.Add(SLP_VIRTUAL_CODE.Text);
             ParameterList.Add(null);
             PURModel.MaintainPurchaseDayGood BCO = new PURModel.MaintainPurchaseDayGood(ConnectionDB);
             BCO.CheckItemData(ParameterList, out Msg);
             if (Msg != "")
             {
                 //Focus(((TextBox)SLP_VIRTUAL_CODE.FindControl("TextBoxCode")).ClientID);
                 throw new Exception(Msg);
             }
             //Focus(((TextBox)SLP_PERIOD.FindControl("TextBoxCode")).ClientID);
             if (txtPERIOD.Text != "")
             {
                 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 = "";
     }
 }