/// <summary> /// envio de unidades a heatTR /// </summary> /// <param name="data"></param> /// <returns></returns> // POST: api/HeatTransfers public string Post([FromBody] ProcesoHeatTransfer data) { try { var conectionString = CreadorConection.Creador(CreadorConection.Auditoria).conectionstring(); using (SqlConnection cn = new SqlConnection(conectionString)) { cn.Open(); var command = new SqlCommand("spdIntexIngresoHeat", cn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@corteParam", SqlDbType.NVarChar).Value = data.corte; command.Parameters.Add("@unidadesParam", SqlDbType.Int).Value = data.uniTransferencia; command.ExecuteNonQuery(); return("Ok"); } } catch (Exception ex) { Console.Write(ex.Message); return(ex.Message); } }
/// <summary> /// r3gistro de unidades dañadas en heat transfer /// </summary> /// <param name="data"></param> /// <param name="id"></param> /// <returns></returns> // POST: api/HeatTransfers public string Post([FromBody] ProcesoHeatTransfer data, int id) { try { var conectionString = CreadorConection.Creador(CreadorConection.Auditoria).conectionstring(); using (SqlConnection cn = new SqlConnection(conectionString)) { cn.Open(); var command = new SqlCommand("spdIntexIngresoUnidaesDefecHeat", cn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@corteParam", SqlDbType.NVarChar).Value = data.corte; command.Parameters.Add("@unidadesParam", SqlDbType.Int).Value = data.uniTransferencia; command.Parameters.Add("@unidadesActualizadas", SqlDbType.Int).Direction = ParameterDirection.Output; command.ExecuteNonQuery(); var unidades = Convert.ToInt32(command.Parameters["@unidadesActualizadas"].Value.ToString()); if (unidades < data.uniTransferencia) { return(unidades.ToString()); } return("Ok"); } } catch (Exception ex) { Console.Write(ex.Message); return("error");//ex.Message; } }