예제 #1
0
        public bool Update_Validate(ref System.Text.StringBuilder Sb_Msg)
        {
            bool       IsValid = true;
            WebControl Wc;

            Wc = this.Txt_FirstName;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.Txt_FirstName.Text.Trim() != "")
                , "First Name is required. <br />");

            Wc = this.Txt_MiddleName;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.Txt_MiddleName.Text.Trim() != "")
                , "Middle Name is required. <br />");

            Wc = this.Txt_LastName;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.Txt_LastName.Text.Trim() != "")
                , "Last Name is required. <br />");

            Wc = this.EODtp_BirthDate;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.EODtp_BirthDate.SelectedDate == null)
                , "Date of Birth is required. <br />");

            return(IsValid);
        }
예제 #2
0
        bool Save_Validation(System.Text.StringBuilder Sb_Msg)
        {
            bool       IsValid = true;
            WebControl Wc;

            Wc = this.Txt_Name;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.Txt_Name.Text != "")
                , "Rights Name is required. <br />");

            return(IsValid);
        }
        bool Save_Validation(System.Text.StringBuilder Sb_Msg)
        {
            bool       IsValid = true;
            WebControl Wc;

            Wc = this.Txt_Username;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (this.Txt_Username.Text != "")
                , "User Name is required. <br />");

            Wc = this.Txt_Username;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , (!Layer02_Common.CheckSeriesDuplicate("User", "UserName", this.mObj.GetKeys(), this.Txt_Username.Text))
                , "User Name is required. <br />");

            this.Txt_Password.CssClass        = Layer01_Constants_Web.CnsCssTextbox;
            this.Txt_ConfirmPassword.CssClass = Layer01_Constants_Web.CnsCssTextbox;

            if (this.Txt_Password.Text.Trim() != "")
            {
                if (this.Txt_Password.Text != this.Txt_ConfirmPassword.Text)
                {
                    IsValid = false;
                    this.Txt_Password.CssClass        = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                    this.Txt_ConfirmPassword.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                    Sb_Msg.Append("Please confirm your password. <br />");
                }
            }

            return(IsValid);
        }
예제 #4
0
        bool Save_Validation(ref System.Text.StringBuilder Sb_Msg)
        {
            WebControl Wc;
            bool       IsValid = true;

            this.Txt_Code.CssClass = Layer01_Constants_Web.CnsCssTextbox;
            if (this.Txt_Code.Text.Trim() == "")
            {
                this.Txt_Code.Text = Layer02_Common.GetSeriesNo("Customer");
            }

            Wc = this.Txt_Code;
            Layer01_Methods_Web.Save_Validation(
                ref Sb_Msg
                , ref Wc
                , ref IsValid
                , Layer01_Constants_Web.CnsCssTextbox
                , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                , Layer02_Common.CheckSeriesDuplicate("uvw_Customer", "CustomerCode", this.mObj.GetKeys(), this.Txt_Code.Text)
                , "Duplicate Customer ID found. Please change the Customer ID. <br />");

            Int64     LookupClientTypeID = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupClientTypeID"], 0));
            DataTable Dt = Do_Methods_Query.GetQuery("LookupClientType", "", "LookupClientTypeID = " + LookupClientTypeID.ToString());

            if (Dt.Rows.Count > 0)
            {
                DataRow Dr_ClientType = Dt.Rows[0];

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCurrency"], false))
                {
                    Wc = this.Cbo_Currency;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_Currency.SelectedValue) == 0)
                        , "Currency is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_AccountName"], false))
                {
                    Wc = this.Txt_CreditCard_AccountName;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (this.Txt_CreditCard_AccountName.Text == "")
                        , "Account Name is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard"], false))
                {
                    bool Inner_IsValid = true;
                    this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                    this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox;

                    if (this.Txt_CreditCard_Part1.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part2.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part3.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }
                    if (this.Txt_CreditCard_Part4.Text.Trim() == "")
                    {
                        Inner_IsValid = false;
                    }

                    if (!Inner_IsValid)
                    {
                        IsValid = false;
                        this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card is required. <br />");
                    }
                }


                Int32 CreditCardExpiration_Month = 0;
                Int32 CreditCardExpiration_Year  = 0;

                try
                {
                    Int32.TryParse(this.Txt_CreditCardExpiration_Month.Text, out CreditCardExpiration_Month);
                    if (this.Txt_CreditCardExpiration_Year.Text.Trim() != "")
                    {
                        Int32.TryParse("20" + this.Txt_CreditCardExpiration_Year.Text, out CreditCardExpiration_Year);
                    }
                }
                catch { }

                this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox;
                this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox;

                if (!
                    (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" ||
                     this.Txt_CreditCardExpiration_Year.Text.Trim() == ""))
                {
                    DateTime Inner_DateTime;
                    try
                    {
                        Inner_DateTime = new DateTime(CreditCardExpiration_Year, CreditCardExpiration_Month, 1);
                        if (Inner_DateTime < DateTime.Now)
                        {
                            IsValid = false;
                            this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                            this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                            Sb_Msg.Append("Credit Card Date Expiry must be earlier than today. <br />");
                        }
                    }
                    catch
                    {
                        IsValid = false;
                        this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card Date Expiry is incorrect. <br />");
                    }
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_Expiration"], false))
                {
                    if (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" ||
                        this.Txt_CreditCardExpiration_Year.Text.Trim() == "")
                    {
                        IsValid = false;
                        this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        this.Txt_CreditCardExpiration_Year.CssClass  = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight;
                        Sb_Msg.Append("Credit Card Date Expiry is required. <br />");
                    }
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsPaymentTerm"], false))
                {
                    Wc = this.Cbo_PaymentTerm;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_PaymentTerm.SelectedValue) == 0)
                        , "Payment Term is required. <br />");
                }

                if ((bool)Do_Methods.IsNull(Dr_ClientType["IsTaxCode"], false))
                {
                    Wc = this.Cbo_TaxCode;
                    Layer01_Methods_Web.Save_Validation(
                        ref Sb_Msg
                        , ref Wc
                        , ref IsValid
                        , Layer01_Constants_Web.CnsCssTextbox
                        , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight
                        , (Convert.ToInt64(this.Cbo_TaxCode.SelectedValue) == 0)
                        , "Tax Code is required. <br />");
                }
            }

            return(IsValid);
        }