Ejemplo n.º 1
0
    //設定鈕
    protected void btnSetup_Click(object sender, EventArgs e)
    {
        try
        {
            if (VerifyFormData(SLP_AcceptDate.Text))
            {
                int result = 0;
                //凍結畫面上的控制項
                SetPageStatus(false);

                CGRModel.MaintainAcceptDate BCO = new PIC.VDS2G.LGT.CGR.MaintainAcceptDate(ConntionDB);
                ParameterList.Clear();

                ParameterList.Add(this.SLP_P_Date.StartDate);
                if (this.SLP_P_Date.EndDate.Length == 0)
                {
                    ParameterList.Add(this.SLP_P_Date.StartDate);
                }
                else
                {
                    ParameterList.Add(this.SLP_P_Date.EndDate);
                }
                ParameterList.Add(this.SLP_AcceptDate.Text);

                result = BCO.CGR04_SetReAcceptDate(ParameterList, DBT);

                if (result != 0)
                {
                    switch (result)
                    {
                        case 1:
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR041.aspx", "alert('所指定之處理日期區間無資料');", true);
                            break;
                        case 2:
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR041.aspx", "alert('所指定區間內之資料有部份已被設定');", true);
                            break;
                        case 3:
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR041.aspx", "alert('此門市進貨日已被設定過,請先解除再重新設定');", true);
                            break;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "SetupComplete", "alert('設定完成');", true);
                }

                //畫面上的控制項解凍
                SetPageStatus(true);


            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }