Пример #1
0
    public void btnSearch_Click(object sender, EventArgs e)
    {
        lblMessage.Text = "";
        pnlMessage.Update();
        ClearCust();

        ReleaseLock();

        string tableName  = "CustomerMaster (NoLock) INNER JOIN CustomerAddress (NoLock) ON pCustMstrID = fCustomerMasterID";
        string columnName = "pCustMstrID, CustNo, CustName, AddrLine1, AddrLine2, City, State, PostCd, Country, PhoneNo, FaxPhoneNo, " +
                            "ContractSchd1, ContractSchd2, ContractSchd3, ContractSchedule4, ContractSchedule5, ContractSchedule6, ContractSchedule7, " +
                            "TargetGrossMarginPct, WebDiscountPct, WebDiscountInd, CustomerDefaultPrice, CustomerPriceInd" +
                            ",TargetCostPlusPct";
        string whereClause = "CustNo = '" + txtCustomer.Text.ToString() + "' AND (Type = 'P' OR Type = '')";

        dtCust = CustContMaint.GetMaintData(tableName, columnName, whereClause);

        if (dtCust != null && dtCust.Rows.Count > 0)
        {
            hidCustId.Value = dtCust.Rows[0]["pCustMstrID"].ToString();
            if (hidSecurity.Value.ToString() == "Full")
            {
                CheckLock();
                if (Session["CustContLock"].ToString() == "L")
                {
                    ClearCust();
                    hidCustId.Value = "";
                    smCustContMaint.SetFocus(txtCustomer);
                    ScriptManager.RegisterClientScriptBlock(pnlCustData, typeof(UpdatePanel), "Script", "alert('Record Locked By " + lockUser.ToString() + "');", true);
                }
                else
                {
                    DispCust();
                }
            }
            else
            {
                DispCust();
            }
        }
        else
        {
            ClearCust();
            hidCustId.Value = "";
            DisplaStatusMessage("Customer Record Not Found", "fail");
            smCustContMaint.SetFocus(txtCustomer);
        }
    }