Пример #1
0
        public Framework.DataServices.Model.EntityBaseData Load(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Boloes.Regra entryData = (Model.Boloes.Regra)entry;


            DataTable table = base.ExecuteFill(CommandType.StoredProcedure, base._commandSelect, true, currentUser,
                                               base.Parameters.Create("@RegraID", DbType.Int64, entryData.RegraID),
                                               base.Parameters.Create("@NomeBolao", DbType.String, entryData.Bolao.Nome),
                                               base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                               );

            int rowsFound = Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value);

            if (rowsFound == 0)
            {
                return(null);
            }
            //throw new Exception("There is no item found in database with this ID.");

            errorNumber      = base.ExecutionStatus.ErrorNumber;
            errorDescription = base.ExecutionStatus.ErrorDescription;



            return(Util.BolaoRegras.ConvertToObject(table.Rows[0]));
        }
Пример #2
0
        public bool Delete(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Boloes.Regra entryData = (Model.Boloes.Regra)entry;

            base.ExecuteNonQuery(CommandType.StoredProcedure, base._commandDelete, true, currentUser,
                                 base.Parameters.Create("@RegraID", DbType.Int64, entryData.RegraID),
                                 base.Parameters.Create("@NomeBolao", DbType.String, entryData.Bolao.Nome),
                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );

            errorNumber      = base.ExecutionStatus.ErrorNumber;
            errorDescription = base.ExecutionStatus.ErrorDescription;

            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) >= 1 ? true : false);
        }