/*************** SECCIÓN DE BARRENOS **********************/
        public TransactionResult createBarrenoLineaBitacora(Barreno barreno)
        {
            SqlConnection connection = null;

            using (connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Coz_Operaciones_DB"].ConnectionString))
            {
                try
                {
                    connection.Open();
                    SqlCommand command = new SqlCommand("sp_createBarreno", connection);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("cantidad", barreno.cantidad));
                    command.Parameters.Add(new SqlParameter("longitud", barreno.longitud));
                    command.Parameters.Add(new SqlParameter("metros", barreno.metros));
                    command.Parameters.Add(new SqlParameter("linea_id", barreno.linea.id));
                    command.Parameters.Add(new SqlParameter("bitacora_id", barreno.bitacora.id));
                    command.ExecuteNonQuery();
                    return(TransactionResult.CREATED);
                }
                catch (SqlException ex)
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (ex.Number == 2627)
                    {
                        return(TransactionResult.EXISTS);
                    }
                    return(TransactionResult.NOT_PERMITTED);
                }
                catch
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    return(TransactionResult.ERROR);
                }
            }
        }
Exemplo n.º 2
0
 public static BarrenoVo objectToVo(Barreno obj)
 {
     return(new BarrenoVo
     {
     });
 }