Exemple #1
0
        protected bool validData()
        {
            bool result = true;

            if (txtDep.Text == "")
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('查詢明細表時,部門編號不能為空!');", true);
                txtDep.Focus();
                result = false;
            }

            if (DateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(DateStart.Value.Trim()) == false)
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('批準日期格式不正確!');", true);
                DateStart.Focus();
                result = false;
            }
            else
            {
                if (DateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(DateEnd.Value.Trim()) == false)
                {
                    StrHlp.WebMessageBox(this.Page, "批準日期格式錯誤!");
                    DateEnd.Focus();
                    result = false;
                }
            }


            return(result);
        }
Exemple #2
0
        private bool Validation()
        {
            bool result = true;

            if (result && (txtName.Text == null || txtName.Text.Trim() == string.Empty))
            {
                result = false;
                txtName.Focus();
                ClassLibrary.JMessages.Error("لطفاً عنوان را وارد کنید.", "");
            }

            if (result && DateStart.Date != DateTime.MinValue && !DateStart.IsValidDate())
            {
                result = false;
                DateStart.Focus();
                ClassLibrary.JMessages.Error("تاریخ آغاز معتبر نیست", "");
            }

            if (result && DateEnd.Date != DateTime.MinValue && !DateEnd.IsValidDate())
            {
                result = false;
                DateEnd.Focus();
                ClassLibrary.JMessages.Error("تاریخ پایان معتبر نیست", "");
            }

            if (DateEnd.Date != DateTime.MinValue && DateStart.Date > DateEnd.Date)
            {
                ClassLibrary.JMessages.Error("لطفا تاریخ شروع و پایان را بصورت صحیح وارد کنید", "خطا");
                return(false);
            }
            return(result);
        }