Ejemplo n.º 1
0
        public void DbCommandProcedure(ProcedureTO to)
        {
            using (var connection = CreateDbConnection())
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "FXUSER." + to.Name;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();

                    foreach (var item in to.Parameters)
                    {
                        switch (item.Direction)
                        {
                        case ProcedureParameterDirection.In:
                            command.AddInputParameter(item.Name, item.Value, item.Type);
                            break;

                        case ProcedureParameterDirection.Out:
                            command.AddOutputParameter(item.Name, item.Type);
                            break;
                        }
                    }
                    command.ExecuteNonQuery();
                }
            }
        }
Ejemplo n.º 2
0
        protected ResultTO DbCommandProcedure(ProcedureTO to)
        {
            var resultTO = new ResultTO();

            using (var connection = CreateDbConnection())
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "FXUSER." + to.Name;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();

                    foreach (var item in to.Parameters)
                    {
                        switch (item.Direction)
                        {
                        case ProcedureParameterDirection.In:
                            command.AddInputParameter(item.Name, item.Value, item.Type);
                            break;

                        case ProcedureParameterDirection.Out:
                            command.AddOutputParameter(item.Name, item.Type);
                            break;
                        }
                    }
                    command.ExecuteNonQuery();

                    resultTO.Message = command.Parameters[to.Parameters
                                                          .Where(i => i.Direction == ProcedureParameterDirection.Out)
                                                          .FirstOrDefault().Name].Value.ToString();

                    resultTO.Result = (resultTO.Message == "OK") ? Result.Pass : Result.Fail;
                }
            }
            return(resultTO);
        }
Ejemplo n.º 3
0
 public ResultTO Execute(ProcedureTO procedure)
 {
     return(base.DbCommandProcedure(procedure));
 }