コード例 #1
0
ファイル: VAM031.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private string ChkMonthClose(string sYM, string sFUN)
    {
        #region
        try
        {
            string sResult = "";
            
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage();

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return sResult;
            }

            #endregion

            
            DateTime dateA;
            if (sYM.Length!=6)
            {
                sResult = "年月格式有誤,請重新輸入";
            }
            else if (DateTime.TryParse(sYM.Substring(0,4)+"/"+sYM.Substring(4,2) +"/01", out dateA) == false)
            {
                sResult = "年月格式有誤,請重新輸入";
            }
            else
            {
                //2009/10/19因為測試方便,先將下方檢核MARK起來
                if (Convert.ToDateTime(sYM.Substring(0, 4) + "/" + sYM.Substring(4, 2) + "/10").AddMonths(1) < System.DateTime.Now)
                {
                    //if (sFUN == "SET")
                    //    sResult = "超過月結日期期限,請重新輸入";
                    //else
                    //    sResult = sYM + "月資料已處理完成或是超過解除期限,勿再處理!!";
                }
                else
                {
                    string sType = "";
                    if (this.rdoCntType1.Checked)
                    {
                        sType = "1";
                    }
                    else
                    {
                        sType = "2";
                    }
                    #region 取得資料
                    BCO.CheckVendorMonthCloseYN bco = new BCO.CheckVendorMonthCloseYN(ConntionDB);

                    sResult = bco.VendorMonthCloseYN(sYM,null,sType,1);
                    #endregion
                }
            }

            

            return sResult;
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            return "";
        }
        #endregion
    }
コード例 #2
0
ファイル: VAM031.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    protected void btnUnSetTrace_Click(object sender, EventArgs e)
    {
        try
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            this.ErrorMsgLabel.Text = "";

            DateTime dateA;
            string sResult;

            sResult = "";

            if (this.SLP_YearMonth2.Text.Length != 6)
            {
                sResult = "年月格式有誤,請重新輸入";
            }
            else if (DateTime.TryParse(this.SLP_YearMonth2.Text.Substring(0, 4) + "/" + this.SLP_YearMonth2.Text.Substring(4, 2) + "/01", out dateA) == false)
            {
                sResult = "年月格式有誤,請重新輸入";
            }


            if (sResult != "")
            {
                this.ErrorMsgLabel.Text = sResult;
                return;
            }


            BCO.CheckVendorMonthCloseYN bco = new BCO.CheckVendorMonthCloseYN(ConntionDB);

            sResult = bco.VendorMonthCloseYN(this.SLP_YearMonth2.Text,this.SLP_VendorBase1.Text, "1", 3);

            if (sResult.Length > 1)
            {
                sb.Append(sResult + "<br/>");
            }
            else if (sResult == "N")
            {
                sb.Append("查無月結資料,請重新輸入解除年月<br/>");
                this.SetClinetFocus(((TextBox)((ASP.wui_slp_slp_numberupdown_ascx)this.SLP_YearMonth2.FindControl("SLP_NumberUpDown1")).FindControl("TextBoxCode")).ClientID);
            }
            if (sb.ToString() != "")
            {
                this.ErrorMsgLabel.Text = sb.ToString();
                this.SetClinetFocus(((TextBox)((ASP.wui_slp_slp_numberupdown_ascx)this.SLP_YearMonth2.FindControl("SLP_NumberUpDown1")).FindControl("TextBoxCode")).ClientID);
                return;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "if (confirm('是否確定執行補收解除?')){this.disabled=true;"
                + "__doPostBack('UnCloseMonthTrace','');}", true);
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            this.btnUnSetTrace.Enabled = true;            
        }
    }