Exemplo n.º 1
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            Brand objBrand = new Brand();
            DataSet ds;
            objBrand.BrandName = txtBrandName.Text.Trim();
            if (objBrand.BrandName!=String.Empty)
            {
                objBrand.SearchBrands();
                ds = objBrand.DsCategories;
            }
            else
            {
                ds = new BrandsDAO().GetAllBrands();
            }

            if (ds!=null && ds.Tables[0].Rows.Count>0)
            {
                gvBrands.DataSource = ds;
                gvBrands.DataBind();
                trGrid.Visible = true;
                trNoRecords.Visible = false;
            }
            else
            {
                trNoRecords.Visible = true;
                trGrid.Visible = false;
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }