コード例 #1
0
 public string ActualizarServicio(decimal id, TR_servicio servicio)
 {
     try
     {
         var resultado = procedimiento.ExisteServicio(id);
         if (resultado == true)
         {
             procedimiento.ActualizarServicio(id, servicio);
             return("OK");
         }
         return("El código ingresado no arrojó resultados");
     }
     catch (NullReferenceException)
     {
         return("Todos los campos deben estar completos");
     }
     catch (InvalidCastException)
     {
         return("El tipo de formato enviado no corresponde");
     }
     catch (DbUpdateException)
     {
         return("El código del servicio ingresado ya se encuentra registrado");
     }
     catch (Exception)
     {
         return("Ha ocurrido un error al momento de registrar");
     }
 }
コード例 #2
0
 public string AgregarServicio(TR_servicio servicio)
 {
     try
     {
         procedimiento.AgregarServicio(servicio);
         return("OK");
     }
     catch (NullReferenceException)
     {
         return("Todos los campos deben estar completos");
     }
     catch (InvalidCastException)
     {
         return("El tipo de formato enviado no corresponde");
     }
     catch (DbUpdateException)
     {
         return("El código del servicio ingresado ya se encuentra registrado");
     }
     catch (Exception)
     {
         return("Ha ocurrido un error al momento de registrar");
     }
 }