public override void Insert(CountryRow value) { var _sqlStr = "DECLARE " + Database.CreateSqlParameterName(CountryRow_Base.country_id_PropName) + " int " + "SET " + Database.CreateSqlParameterName(CountryRow_Base.country_id_PropName) + " = COALESCE((SELECT MAX(" + CountryRow_Base.country_id_DbName + ") FROM Country) + 1, 1) " + "INSERT INTO [dbo].[Country] (" + "[" + CountryRow_Base.country_id_DbName + "], " + "[" + CountryRow_Base.name_DbName + "], " + "[" + CountryRow_Base.country_code_DbName + "], " + "[" + CountryRow_Base.status_DbName + "], " + "[" + CountryRow_Base.version_DbName + "]" + ") VALUES (" + Database.CreateSqlParameterName(CountryRow_Base.country_id_PropName) + ", " + Database.CreateSqlParameterName(CountryRow_Base.name_PropName) + ", " + Database.CreateSqlParameterName(CountryRow_Base.country_code_PropName) + ", " + Database.CreateSqlParameterName(CountryRow_Base.status_PropName) + ", " + Database.CreateSqlParameterName(CountryRow_Base.version_PropName) + ") " + " SELECT " + Database.CreateSqlParameterName(CountryRow_Base.country_id_PropName); var _cmd = Database.CreateCommand(_sqlStr); AddParameter(_cmd, CountryRow_Base.name_PropName, value.Name); AddParameter(_cmd, CountryRow_Base.country_code_PropName, value.Country_code); AddParameter(_cmd, CountryRow_Base.status_PropName, value.Status); AddParameter(_cmd, CountryRow_Base.version_PropName, value.Version); value.Country_id = (int)_cmd.ExecuteScalar(); }
public bool IsNameChanged(CountryRow pOriginal) { return(Name != pOriginal.Name); }