Ejemplo n.º 1
0
    protected void txtCustomerNumber_TextChanged(object sender, EventArgs e)
    {
        if (txtCustomerNumber.Text.Trim() != "")
        {
            string strCustNo     = txtCustomerNumber.Text;
            int    strCnt        = 0;
            bool   textIsNumeric = true;
            try
            {
                int.Parse(strCustNo);
            }
            catch
            {
                textIsNumeric = false;
            }
            if ((strCustNo != "") && !textIsNumeric)
            {
                if (isNumeric(strCustNo.Remove(strCustNo.Length - 1, 1), System.Globalization.NumberStyles.Integer) == false)
                {
                    strCnt = Convert.ToInt32(cntCustName(strCustNo));
                }
                else
                {
                    strCnt = Convert.ToInt32(cntCustNo(strCustNo));
                }
                int maxRowCount = customerDetail.GetSQLWarningRowCount();

                if (strCnt < maxRowCount)
                {
                    ScriptManager.RegisterClientScriptBlock(txtCustomerNumber, txtCustomerNumber.GetType(), "Customer", "LoadCustomerLookup('" + PFC.SOE.Securitylayer.Cryptor.Encrypt(strCustNo) + "');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(txtCustomerNumber, txtCustomerNumber.GetType(), "Customer", "alert('Maximum row exceeds for this search.please enter additional data.');", true);
                }
            }
            else
            {
                if (!customerDetail.IsValidCustomer(txtCustomerNumber.Text))
                {
                    utility.DisplayMessage(MessageType.Failure, invalidMessage, lblMessage);
                    hidCustNo.Value        = "";
                    txtCustomerNumber.Text = "";
                }
                else
                {
                    hidCustNo.Value = customerDetail.CustomerNumber;
                }
            }

            pnlStatusMessage.Update();
            pnlPendingQuoteEntry.Update();
        }
        else
        {
            utility.DisplayMessage(MessageType.Failure, "", lblMessage);
            hidCustNo.Value = "";
        }
        ScriptManager.RegisterClientScriptBlock(txtCustomerNumber, txtCustomerNumber.GetType(), "tab", "document.getElementById(\"ddlOrderType\").focus();", true);
    }