ATMLDataAccessLibrary.db.daos.DocumentDAO.HasAsset C# (CSharp) Метод

HasAsset() публичный Метод

public HasAsset ( String type, String number, String uuid ) : System.Boolean
type String
number String
uuid String
Результат System.Boolean
        public Boolean HasAsset(String type, String number, String uuid)
        {
            int count = 0;
            string sql = builSelectSQLStatement(AssetIdentificationBean._TABLE_NAME,
                new[] { "count(*) as _count" },
                new[]
                {
                    AssetIdentificationBean._ASSET_NUMBER,
                    //AssetIdentificationBean._ASSET_TYPE,
                    AssetIdentificationBean._UUID
                });
            OleDbParameter[] parameters = { new OleDbParameter(AssetIdentificationBean._ASSET_NUMBER, number),
                                            //new OleDbParameter(AssetIdentificationBean._ASSET_TYPE, type),
                                            new OleDbParameter(AssetIdentificationBean._UUID, Guid.Parse(uuid))
                                          };

            OleDbDataReader reader = ExecuteSqlQuery(sql, parameters);
            if (reader != null)
            {
                if (reader.Read())
                {
                    count = (int) reader["_count"];
                }
                reader.Close();
                reader.Dispose();
            }
            return count > 0;
        }

Usage Example

 public AssetIdentificationBean DetermineDataState()
 {
     var dao = new DocumentDAO();
     if (dao.HasAsset(assetType, assetNumber, uuid.ToString() ) )
         DataState = eDataState.DS_EDIT;
     else
         DataState = eDataState.DS_ADD;
     return this;
 }
All Usage Examples Of ATMLDataAccessLibrary.db.daos.DocumentDAO::HasAsset