Exemple #1
0
        public static Result NewWarningResult(CoreException w)
        {
            Result result1 = NewResult(0x13);

            result1._mainString = w.GetMessage();
            result1._subString  = w.GetSqlState();
            result1._errorCode  = w.GetErrorCode();
            return(result1);
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
 public static void ThrowError(CoreException e)
 {
     throw new UtlException(e.GetMessage(), e.GetSqlState(), e.GetErrorCode(), e);
 }
Exemple #5
0
 public static UtlException GetException(CoreException e)
 {
     return(new UtlException(e.GetMessage(), e.GetSqlState(), e.GetErrorCode(), e));
 }