private void BindListBySearchParameters(StructureListUI structureListUI)
    {
        try
        {
            DataTable dtb = structureListBAL.GetStructureListBySearchParameters(structureListUI);


            if (dtb.Rows.Count > 0 && dtb != null)
            {
                gvData.DataSource = dtb;
                gvData.DataBind();
                divError.Visible = false;
                gvData.Visible   = true;
            }
            else
            {
                divError.Visible = true;
                lblError.Text    = Resources.GlobalResource.msgNoRecordFound;
                gvData.Visible   = false;
            }

            txtSearch.Text = "";
            txtSearch.Focus();
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "BindListBySearchParameters()";
            logExcpUIobj.ResourceName     = "System_Settings_StructureList.CS";
            logExcpUIobj.RecordId         = "All";
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_StructureList : BindListBySearchParameters] An error occured in the processing of Record. Details : [" + exp.ToString() + "]");
        }
    }
Beispiel #2
0
    private void SearchStructureList()
    {
        try
        {
            StructureListUI structureListUI = new StructureListUI();
            structureListUI.Search = txtStructureSearch.Text;
            DataTable dtb = structureListBAL.GetStructureListBySearchParameters(structureListUI);

            if (dtb.Rows.Count > 0 && dtb != null)
            {
                gvStructureSearch.DataSource = dtb;
                gvStructureSearch.DataBind();
                divStructureSearchError.Visible = false;
            }
            else
            {
                divStructureSearchError.Visible = true;
                lblStructureSearchError.Text    = Resources.GlobalResource.msgNoRecordFound;
                gvStructureSearch.Visible       = false;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "SearchStructureList()";
            logExcpUIobj.ResourceName     = "Assets_Asset_AssetForm.CS";
            logExcpUIobj.RecordId         = "All";
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Assets_Asset_AssetForm : SearchStructureList] An error occured in the processing of Record. Details : [" + exp.ToString() + "]");
        }
    }
    public int DeleteStructure(StructureListUI structureListUI)
    {
        int result = 0;

        result = structureListDAL.DeleteStructure(structureListUI);
        return(result);
    }
    public DataTable GetStructureListBySearchParameters(StructureListUI structureListUI)
    {
        DataTable dtb = new DataTable();

        dtb = structureListDAL.GetStructureListBySearchParameters(structureListUI);
        return(dtb);
    }
    public DataTable GetStructureListById(StructureListUI structureListUI)
    {
        DataTable dtb = new DataTable();

        dtb = structureListDAL.GetStructureListById(structureListUI);
        return(dtb);
    }
    public DataTable GetStructureListBySearchParameters(StructureListUI structureListUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

        //Boolean result = false;
        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SqlCommand sqlCmd = new SqlCommand("SP_Structure_SelectBySearchParameters", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@Search", SqlDbType.NVarChar);
                sqlCmd.Parameters["@Search"].Value = structureListUI.Search;

                using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd))
                {
                    adapter.Fill(ds);
                }
            }
            if (ds.Tables.Count > 0)
            {
                dtbl = ds.Tables[0];
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "GetStructureListBySearchParameters()";
            logExcpUIobj.ResourceName     = "StructureListDAL.CS";
            logExcpUIobj.RecordId         = "Search = " + structureListUI.Search;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[StructureListDAL : GetStructureListBySearchParameters] An error occured in the processing of Record Search = " + structureListUI.Search + " . Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
    public int DeleteStructure(StructureListUI structureListUI)
    {
        int result = 0;

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SupportCon.Open();
                SqlCommand sqlCmd = new SqlCommand("SP_Structure_Delete", SupportCon);

                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@tbl_StructureId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_StructureId"].Value = structureListUI.Tbl_StructureId;

                result = sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                SupportCon.Close();
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "DeleteStructure()";
            logExcpUIobj.ResourceName     = "StructureListDAL.CS";
            logExcpUIobj.RecordId         = structureListUI.Tbl_StructureId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[StructureListDAL : DeleteStructure] An error occured in the processing of Record Id : " + structureListUI.Tbl_StructureId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }