Exemplo n.º 1
0
    /// <summary>
    /// 出庫檢查
    /// </summary>
    private bool VerifyALOOutNo()
    {
        string slpdStAcceptDateClientId = "";

        try
        {
            ParameterList.Clear();
            ParameterList.Add(SLP_StAcceptDate.Text.Trim());
            CGDModel.ProcessResetBatchAdj BCO = new CGDModel.ProcessResetBatchAdj(ConntionDB);
            if (!BCO.CheckALOOutNO(ParameterList))
            {
                ErrorMsgLabel.Text = "門市進貨日資料已出庫(或無資料),不可作門市進貨單的異動";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert(' 門市進貨日資料已出庫(或無資料),不可作門市進貨單的異動 ');", true);

                SetClinetFocus(SLP_StAcceptDate.ClientID);
                return false;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            return false;
        }

        return true;
    }
Exemplo n.º 2
0
    /// <summary>
    /// 畫面欄位檢查
    /// </summary>
    private bool VerifyFormData()
    {
        string slpdStAcceptDateClientId = "";
        slpdStAcceptDateClientId = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)slpdStAcceptDate).FindControl("TextBoxCode")).ClientID;

        if (optOperation.SelectedIndex == -1)
        {
            ErrorMsgLabel.Text = "請選擇[作業選項]";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' 請選擇[作業選項] ');", true);

            return false;
        }

        if (slpdStAcceptDate.Text == "")
        {
            ErrorMsgLabel.Text = "[門市進貨日]欄位不得空白";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' [門市進貨日]欄位不得空白 ');", true);

            //SetClinetFocus(slpdStAcceptDateClientId);
            return false;
        }

        //先忽略此條件,以方便UAT測試
        //if (DateTime.Compare(Convert.ToDateTime(slpdStAcceptDate.Text), DateTime.Today) < 0)
        //{
        //    ErrorMsgLabel.Text = "[門市進貨日]不可小於系統日";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' [門市進貨日]不可小於系統日 ');", true);

            //SetClinetFocus(slpdStAcceptDateClientId);
            //return false;
        //}

        ParameterList.Clear();
        ParameterList.Add(slpdStAcceptDate.Text.Trim());
        CGDModel.ProcessResetBatchAdj BCO = new CGDModel.ProcessResetBatchAdj(ConntionDB);
        if (!BCO.CheckALOOutNO(ParameterList))
        {
            ErrorMsgLabel.Text = "門市進貨日資料已出庫(或無資料),不可作門市進貨單的異動";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' 門市進貨日資料已出庫(或無資料),不可作門市進貨單的異動 ');", true);

            //SetClinetFocus(slpdStAcceptDateClientId);
            return false;
        }

        if (txtPickBatch.Text.Trim() == "")
        {
            ErrorMsgLabel.Text = "[理貨批次]欄位不得空白";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' [理貨批次]欄位不得空白 ');", true);

            //SetClinetFocus(txtPickBatch.ClientID);
            return false;
        }

        if ((optOperation.SelectedIndex == 4) && (txtModifiedPickBatch.Text.Trim() == ""))
        {
            ErrorMsgLabel.Text = "[修改後理貨批次]欄位不得空白";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' [修改後理貨批次]欄位不得空白 ');", true);

            //SetClinetFocus(txtModifiedPickBatch.ClientID);
            return false;
        }

        //檢查 dataSet 中的資料是否正確
        DataSet dataSet;
        dataSet = (DataSet)Session[PAGE_DT_01 + PageTimeStamp.Value.ToString()];
        int InputParameterCount = 0;

        foreach (DataRow dr in dataSet.Tables[0].Rows)
        {
            if ((dr["item_no"].ToString().Trim() != "") && (dr["period_no"].ToString().Trim() == ""))
            {
                ErrorMsgLabel.Text = "請輸入[期別]";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' 請輸入[期別] ');", true);

                return false;
            }
            else if ((dr["item_no"].ToString().Trim() != "") && (dr["period_no"].ToString().Trim() != ""))
            {
                if ((optOperation.SelectedIndex >= 2) && (optOperation.SelectedIndex <= 4))
                {
                    if (dr["chain"].ToString().Trim() == "")
                    {
                        ErrorMsgLabel.Text = "請選擇[通路]";
                        //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' 請選擇[通路] ');", true);

                        return false;
                    }
                }
            }
            InputParameterCount = InputParameterCount + 1;
        }

        if (InputParameterCount == 0)
        {
            ErrorMsgLabel.Text = "請至少輸入一組參數";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD081.aspx", "alert(' 請至少輸入一組參數 ');", true);

            return false;
        }

        return true;
    }