Exemple #1
0
    private void SearchAssetDisposalList()
    {
        try
        {
            AssetDisposalListUI assetDisposalListUI = new AssetDisposalListUI();
            assetDisposalListUI.Search = txtAssetDisposalSearch.Text;
            DataTable dtb = assetDisposalListBAL.GetAssetDisposalListSearchParameters(assetDisposalListUI);
            if (dtb.Rows.Count > 0 && dtb != null)
            {
                gvAssetDisposalSearch.DataSource = dtb;
                gvAssetDisposalSearch.DataBind();
                divAssetDisposalSearchError.Visible = false;
                gvAssetDisposalSearch.Visible       = true;
            }
            else
            {
                divAssetDisposalSearchError.Visible = true;
                lblAssetDisposalSearchError.Text    = Resources.GlobalResource.msgNoRecordFound;
                gvAssetDisposalSearch.Visible       = false;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "SearchAssetDisposalList()";
            logExcpUIobj.ResourceName     = "Finance_Asset__Accounting_Disposal_of_Assets_AssetDisposalDetailsForm.CS";
            logExcpUIobj.RecordId         = "All";
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Finance_Asset__Accounting_Disposal_of_Assets_AssetDisposalDetailsForm : SearchAssetDisposalList] An error occured in the processing of Record. Details : [" + exp.ToString() + "]");
        }
    }
    public int DeleteAssetDisposal(AssetDisposalListUI assetDisposalListUI)
    {
        int result = 0;

        result = assetDisposalListDAL.DeleteAssetDisposal(assetDisposalListUI);
        return(result);
    }
    public DataTable GetAssetDisposalListSearchParameters(AssetDisposalListUI assetDisposalListUI)
    {
        DataTable dtb = new DataTable();

        dtb = assetDisposalListDAL.GetAssetDisposalListSearchParameters(assetDisposalListUI);
        return(dtb);
    }
    public DataTable GetAssetDisposalListById(AssetDisposalListUI assetDisposalListUI)
    {
        DataTable dtb = new DataTable();

        dtb = assetDisposalListDAL.GetAssetDisposalListById(assetDisposalListUI);
        return(dtb);
    }
    public DataTable GetAssetDisposalListById(AssetDisposalListUI assetDisposalListUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_AssetDisposalId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_AssetDisposalId"].Value = assetDisposalListUI.Tbl_AssetDisposalId;

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

            log.Error("[AssetDisposalListDAL : GetAssetDisposalListById] An error occured in the processing of Record Id : " + assetDisposalListUI.Tbl_AssetDisposalId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
    public int DeleteAssetDisposal(AssetDisposalListUI assetDisposalListUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_AssetBookSetupId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_AssetBookSetupId"].Value = assetDisposalListUI.Tbl_AssetDisposalId;

                result = sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                SupportCon.Close();
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "DeleteAssetDisposal()";
            logExcpUIobj.ResourceName     = "AssetDisposalListDAL.CS";
            logExcpUIobj.RecordId         = assetDisposalListUI.Tbl_AssetDisposalId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[AssetDisposalListDAL : DeleteAssetDisposal] An error occured in the processing of Record Id : " + assetDisposalListUI.Tbl_AssetDisposalId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }