public static Result NewWarningResult(CoreException w) { Result result1 = NewResult(0x13); result1._mainString = w.GetMessage(); result1._subString = w.GetSqlState(); result1._errorCode = w.GetErrorCode(); return(result1); }
public long Update(Books_DTO obj) { long toReturn = 0; using (var sqlConnection = CoreConnection.GetConnection()) { try { toReturn = sqlConnection.Execute("update books set name = @name, pages = @pages, quantity = @quantity, update_date = (select getdate()) where id = @id", obj); } catch (Exception ex) { message = CoreException.GetMessage(ex.Message); } if (toReturn > 0) { message = "Cadastro realizado com sucesso"; } return(toReturn); } }
public long Create(Books_DTO obj) { using (var sqlConnection = CoreConnection.GetConnection()) { long toReturn = 0; try { toReturn = sqlConnection.Execute("Insert into books (name, pages, create_date, update_date,author, quantity) values (@name, @pages, (select getdate()),(select getdate()),@author,@quantity )", obj); } catch (Exception ex) { message = CoreException.GetMessage(ex.Message); } if (toReturn > 0) { message = "Cadastro realizado com sucesso"; } return(toReturn); } }
public static void ThrowError(CoreException e) { throw new UtlException(e.GetMessage(), e.GetSqlState(), e.GetErrorCode(), e); }
public static UtlException GetException(CoreException e) { return(new UtlException(e.GetMessage(), e.GetSqlState(), e.GetErrorCode(), e)); }