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);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Page Load Event Handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     Ajax.Utility.RegisterTypeForAjax(typeof(SOFind));
     lblMessage.Text = "";
     if (!IsPostBack)
     {
         //ShipLoc,SoNo,InventoryNo,PORef,Amount,Weight,Type,ShipDate,OrderDate,CustReq,Status,Carrier,CustomerNo
         ViewState["MaxRowCount"] = custDet.GetSQLWarningRowCount();
         BindDropDown();
         BindDataGrid();
         dtpStatusStart.SelectedDate = DateTime.Now.AddDays(-7).ToShortDateString();
         dtpStatusEnd.SelectedDate   = DateTime.Now.ToShortDateString();
     }
     PrintDialogue1.CustomerNo = txtCustomerNumber.Text;
     ExportSoFind(); // Set Print URL to User control
     PrintDialogue1.PageTitle = "SO Find for Customer #" + txtCustomerNumber.Text;
 }
Ejemplo n.º 3
0
    public void BindCustomer()
    {
        try
        {
            int       strCnt     = 0;
            DataTable dtCustomer = new DataTable();
            DataSet   dsCustomer = service.GetCustomerSelect(customer.Replace("'", "''"));
            dtCustomer = dsCustomer.Tables[0];

            // Filter DataTable
            dtCustomer.DefaultView.RowFilter = BindWhereClause();
            strCnt     = dtCustomer.DefaultView.ToTable().Rows.Count;
            dtCustomer = dtCustomer.DefaultView.ToTable();

            int maxRowCount = custDetail.GetSQLWarningRowCount();

            if (strCnt < maxRowCount)
            {
                if (dtCustomer.Rows.Count > 0)
                {
                    if (hidSort.Value.Trim() != "")
                    {
                        dtCustomer.DefaultView.Sort = hidSort.Value;
                    }
                    else
                    {
                        dtCustomer.DefaultView.Sort = "CustName ASC";
                    }

                    dgCustomerList.DataSource = dtCustomer;
                    //dgCustomerList.DataBind();
                    gridPager.InitPager(dgCustomerList, 100);
                    lblMessage.Visible     = false;
                    dgCustomerList.Visible = true;;
                }
                else
                {
                    lblMessage.Text        = "No record found";
                    lblMessage.Visible     = true;
                    dgCustomerList.Visible = false;
                }
            }
            else
            {
                lblMessage.Text        = "Maximum rows exceeded. Please refine your filter with using the parameters above and then click Search.";
                lblMessage.Visible     = true;
                dgCustomerList.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text        = "No record found";
            lblMessage.Visible     = true;
            dgCustomerList.Visible = false;
        }

        pnlCustomerSearch.Update();
    }
Ejemplo n.º 4
0
    /// <summary>ear
    /// Function to load the customer details
    /// </summary>
    public void LoadCustomerDetails()
    {
        string strCustNo = custNumber = txtCustNo.Text;
        int    strCnt    = 0;

        if ((strCustNo != "") && (strCustNo.Contains("%") == true))
        {
            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 = custDet.GetSQLWarningRowCount();


            if (strCnt < maxRowCount)
            {
                ScriptManager.RegisterClientScriptBlock(txtCustNo, txtCustNo.GetType(), "Customer", "LoadCustomerLookup('" + Server.UrlEncode(PFC.SOE.Securitylayer.Cryptor.Encrypt(strCustNo)) + "');", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(txtCustNo, txtCustNo.GetType(), "Customer", "alert('Maximum row exceeds for this search.please enter additional data.');", true);
            }
        }
        else
        {
            if (strCustNo != "")
            {
                #region Code to fill the customer details in the controls

                // Call the webservice to get the customer address detail
                DataSet dsCustomer = orderEntry.GetCustomerDetails(txtCustNo.Text.Trim().Replace("'", ""));

                // Function to clear the value in the label
                ClearLabels();

                if (dsCustomer != null && dsCustomer.Tables[0].Rows.Count != 0)
                {
                    string creditStatus = "";
                    if (dsCustomer.Tables[0].Rows[0]["CustCd"].ToString() != "BT" && dsCustomer.Tables[0].Rows[0]["fBillToNo"].ToString() != "")
                    {
                        creditStatus = orderEntry.GetCreditReview(dsCustomer.Tables[0].Rows[0]["fBillToNo"].ToString().ToString(), dsCustomer.Tables[2].Rows[0]["CreditInd"].ToString().Trim(), "0", "Order");
                        if (creditStatus.ToUpper() == "OK")
                        {
                            hidCust.Value             = txtCustNo.Text;
                            Session["CustomerNumber"] = hidCust.Value.Trim();
                            Session["CustomerDetail"] = dsCustomer;
                            CustPriceCode             = dsCustomer.Tables[0].Rows[0]["Customer Price Code"].ToString().Trim();
                            CustomerName = dsCustomer.Tables[0].Rows[0]["Name"].ToString().Trim();
                            FillCustomerAddress(dsCustomer);
                            lblCusNum.Text     = hidCust.Value.Trim();
                            lblCustNum.Text    = hidCust.Value.Trim();
                            lblChainValue.Text = dsCustomer.Tables[0].Rows[0]["Chain Name"].ToString().Trim();
                            lblBillCustNo.Text = dsCustomer.Tables[0].Rows[0]["fBillToNo"].ToString().Trim();
                            lblShip_Name.Text  = dsCustomer.Tables[0].Rows[0]["Name"].ToString().Trim();
                            lblSold_Name.Text  = dsCustomer.Tables[0].Rows[0]["Name"].ToString().Trim();
                            lblSoDate.Text     = DateTime.Now.ToShortDateString();
                            // Code to bind the location details
                            DataSet dsLocation = custDet.GetLocationDetails();
                            CreditInd = dsCustomer.Tables[2].Rows[0]["CreditInd"].ToString().Trim();
                            InsertHeaderDetail();
                            lblTermDesc.Text = termDesc;
                            SetTermColor();
                            ISBillToCustomer = false;
                            // txtSONumber.ReadOnly = true;
                            txtCustNo.ReadOnly = true;
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(txtCustNo, typeof(TextBox), "invalid", "alert('" + creditStatus + "');", true);
                            return;
                        }
                    }
                    else
                    {
                        ISBillToCustomer = true;
                        ScriptManager.RegisterClientScriptBlock(txtCustNo, typeof(TextBox), "invalid", "alert('Bill To Only Customer could not process order');document.getElementById('" + txtCustNo.ClientID + "').value='';document.getElementById('" + txtCustNo.ClientID + "').focus();document.getElementById('" + txtCustNo.ClientID + "').select();", true);
                    }
                }
                else
                {
                    hidCust.Value = "";
                    ScriptManager.RegisterClientScriptBlock(txtCustNo, typeof(TextBox), "invalid", "alert('Invalid Customer value');document.getElementById('" + txtCustNo.ClientID + "').value='';document.getElementById('" + txtCustNo.ClientID + "').focus();document.getElementById('" + txtCustNo.ClientID + "').select();", true);
                }
                #endregion
            }
            else
            {
                ClearLabels();
            }
        }
    }
Ejemplo n.º 5
0
    public void BindCustomer()
    {
        try
        {
            int       strCnt     = 0;
            DataTable dtCustomer = new DataTable();
            DataSet   dsCustomer = service.GetCustomerSelect(customer.Replace("'", "''"));
            dtCustomer = dsCustomer.Tables[0];

            // Filter DataTable
            dtCustomer.DefaultView.RowFilter = BindWhereClause();
            strCnt     = dtCustomer.DefaultView.ToTable().Rows.Count;
            dtCustomer = dtCustomer.DefaultView.ToTable();
            //if (isNumeric(customer.Remove(customer.Length - 1, 1), System.Globalization.NumberStyles.Integer) == false)
            //    strCnt = Convert.ToInt32(cntCustName(customer));
            //else
            //    strCnt = Convert.ToInt32(cntCustNo(customer));

            int maxRowCount = custDetail.GetSQLWarningRowCount();

            if (strCnt < maxRowCount)
            {
                if (dtCustomer.Rows.Count > 0)
                {
                    if (hidSort.Value.Trim() != "")
                    {
                        dtCustomer.DefaultView.Sort = hidSort.Value;
                    }
                    else
                    {
                        dtCustomer.DefaultView.Sort = "CustName ASC";
                    }

                    dgCustomerList.DataSource = dtCustomer;
                    dgCustomerList.DataBind();
                    lblMessage.Visible     = false;
                    dgCustomerList.Visible = true;;
                }
                else
                {
                    lblMessage.Text        = "No record found";
                    lblMessage.Visible     = true;
                    dgCustomerList.Visible = false;
                }
            }
            else
            {
                lblMessage.Text        = "Maximum rows exceeded. Please refine your filter with using the parameters above and then click Search.";
                lblMessage.Visible     = true;
                dgCustomerList.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text        = "No record found";
            lblMessage.Visible     = true;
            dgCustomerList.Visible = false;
        }

        pnlCustomerSearch.Update();
    }