Exemplo n.º 1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //QuoteNoHidden.Value = "";
         //CommentsPanel.Visible = false;
         //UpdateButton.Visible = false;
         //UpdateUpdatePanel.Update();
         RecallPageMode.Value  = "Recall";
         HeaderTableName.Value = "QuoteHeaderTable";
         DetailTableName.Value = "QuoteDetailTable";
         //DetailSortField.Value = "QuoteNumber";
         ReadOnly.Value = "0";
         if (Request.QueryString["ReadOnly"] != null)
         {
             ReadOnly.Value = "1";
         }
         if (Request.QueryString["Cust"] != null && Request.QueryString["Cust"].ToString().Length > 0)
         {
             //we have been passed a customer so go to town
             CustNoTextBox.Text    = Request.QueryString["Cust"].ToString();
             HeaderTableName.Value = "Cust" + CustNoTextBox.Text + "HeaderTable";
             DetailTableName.Value = "Cust" + CustNoTextBox.Text + "DetailTable";
             WorkCustomerNumber(sender, e);
             if (Request.QueryString["QuoteNo"] != null && Request.QueryString["QuoteNo"].ToString().Length > 0)
             {
                 // Here we are reviewing a single quote
                 RecallPageMode.Value = "Review";
                 //QuoteNoHidden.Value = Request.QueryString["QuoteNo"].ToString();
                 //DetailFilterFieldHidden.Value = "QuoteNumber";
                 //DetailFilterValueHidden.Value = QuoteNoHidden.Value;
                 HeaderTableName.Value = "Quote" + Request.QueryString["QuoteNo"].ToString() + "HeaderTable";
                 DetailTableName.Value = "Quote" + Request.QueryString["QuoteNo"].ToString() + "ReviewTable";
                 //this.Title = "Quote " + QuoteNoHidden.Value + " Review";
                 //DetailGridHeightHidden.Value = "600";
                 //SingleQuoteDetail = true;
                 //CheckAll = false;
                 GetCustQuotes(Request.QueryString["Cust"].ToString());
                 ShowQuotesDetail(Request.QueryString["Cust"].ToString(), Request.QueryString["QuoteNo"].ToString(), null);
                 //if (dt.Rows.Count > 0) ReviewCustNameLabel.Text = dt.Rows[0]["CustomerName"].ToString();
                 //BindPrintDialog();
                 //ECommQuoteRecallScriptManager.SetFocus("POTextBox");
             }
             else
             {
                 GetCustQuotes(Request.QueryString["Cust"].ToString());
             }
         }
         else
         {
             ECommQuoteRecallScriptManager.SetFocus("CustNoTextBox");
         }
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// Function to load the customer details
    /// </summary>
    public void WorkCustomerNumber(object sender, EventArgs e)
    {
        try
        {
            ClearPageMessages();
            string strCustNo = CustNoTextBox.Text;
            int    strCnt    = 0;
            //if ((strCustNo != "") && (strCustNo.Contains("%") == true))
            //{
            //    //strCustNo.Replace("'", "''");
            //    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(CustNoTextBox, CustNoTextBox.GetType(), "Customer", "LoadCustomerLookup('" + Server.UrlEncode(PFC.SOE.Securitylayer.Cryptor.Encrypt(strCustNo)) + "');", true);
            //    else
            //        ScriptManager.RegisterClientScriptBlock(CustNoTextBox, CustNoTextBox.GetType(), "Customer", "alert('Maximum row exceeds for this search.please enter additional data.');", true);
            //}
            bool textIsNumeric = true;
            try
            {
                int.Parse(strCustNo);
            }
            catch
            {
                textIsNumeric = false;
            }

            if ((strCustNo != "") && !textIsNumeric)
            {
                ScriptManager.RegisterClientScriptBlock(CustNoTextBox, CustNoTextBox.GetType(), "Customer", "LoadCustomerLookup('" + Server.UrlEncode(PFC.SOE.Securitylayer.Cryptor.Encrypt(strCustNo)) + "');", 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(strCustNo);
                    if (dsCustomer != null && dsCustomer.Tables[0].Rows.Count != 0)
                    {
                        if (dsCustomer.Tables[0].Columns.Contains("ErrorMessage"))
                        {
                            ScriptManager.RegisterClientScriptBlock(CustNoTextBox, typeof(TextBox), "invalid", "alert('" + dsCustomer.Tables[0].Rows[0]["ErrorMessage"].ToString() + "');", true);
                            ECommQuoteRecallScriptManager.SetFocus("CustNoTextBox");
                            return;
                        }
                        else
                        {
                            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")
                                {
                                    ScriptManager.RegisterClientScriptBlock(CustNoTextBox, typeof(TextBox), "invalid", "alert('" + creditStatus + "');", true);
                                    ECommQuoteRecallScriptManager.SetFocus("CustNoTextBox");
                                    return;
                                }
                            }
                            else
                            {
                                //ISBillToCustomer = true;
                                ScriptManager.RegisterClientScriptBlock(CustNoTextBox, typeof(TextBox), "invalid", "alert('Bill To Only Customer could not process order');document.getElementById('" + CustNoTextBox.ClientID + "').value='';document.getElementById('" + CustNoTextBox.ClientID + "').focus();document.getElementById('" + CustNoTextBox.ClientID + "').select();", true);
                                ECommQuoteRecallScriptManager.SetFocus("CustNoTextBox");
                                return;
                            }
                            Session[HeaderTableName.Value] = null;
                            CustNameLabel.Text             = dsCustomer.Tables[2].Rows[0]["Name"].ToString();
                            HeaderUpdatePanel.Update();
                            GetCustQuotes(CustNoTextBox.Text);
                        }
                    }
                    else
                    {
                        //hidCust.Value = "";
                        ScriptManager.RegisterClientScriptBlock(CustNoTextBox, typeof(TextBox), "invalid", "alert('Invalid Customer value (1)');document.getElementById('" + CustNoTextBox.ClientID + "').value='';document.getElementById('" + CustNoTextBox.ClientID + "').focus();document.getElementById('" + CustNoTextBox.ClientID + "').select();", true);
                    }
                    #endregion
                }
                else
                {
                    //ClearLabels();
                }
            }
        }
        catch (Exception e2)
        {
            ShowPageMessage("WorkCustomerNumber Error " + e2.ToString(), 2);
        }
    }