public static async Task <Response <InformeResponse> > DeleteInformeTareas(int IdInforme, int IdTarea, int IdTipMan, string AreCodigo) { Response <InformeResponse> response; try { await InformeTareasData.DeleteInformeTareas(IdInforme, IdTarea); await ControlUnidadTipoMantenimientoData.AnularControlUnidadMantenimiento(IdTipMan, AreCodigo); response = new Response <InformeResponse> { EsCorrecto = true, Valor = new InformeResponse { Informe = new InformeEntity() }, Mensaje = "OK", Estado = true, }; return(response); } catch (FaultException <ServiceError> ) { throw; } catch (Exception ex) { return(new Response <InformeResponse>(false, null, Functions.MessageError(ex), false)); } }
public static async Task <Response <InformeResponse> > InsertInformeTareas(InformeRequest request) { Response <InformeResponse> response; InformeTareasEntity objInformeTareas; List <InformeTareasList> objInformeTareasAnteriorActivo; List <InformeTareasList> objInformeTareasAnteriorInactivo; try { objInformeTareas = request.InformeTareas; objInformeTareasAnteriorActivo = InformeTareasData.ListInformeTareas(objInformeTareas.IdInforme, objInformeTareas.IdTarea); objInformeTareasAnteriorInactivo = InformeTareasData.ListInformeTareas(objInformeTareas.IdInforme, objInformeTareas.IdTarea, 0); if (objInformeTareasAnteriorActivo.Count > 0) { BusinessException.Generar(Constants.YA_EXISTE); } else if (objInformeTareasAnteriorInactivo.Count > 0) { await InformeTareasData.DeleteInformeTareas(objInformeTareas.IdInforme, objInformeTareas.IdTarea, 1, objInformeTareas.Observacion); } else { await InformeTareasData.InsertInformeTareas(objInformeTareas); } response = new Response <InformeResponse> { EsCorrecto = true, Valor = new InformeResponse { Informe = new InformeEntity() }, Mensaje = "OK", Estado = true, }; return(response); } catch (Exception ex) { throw; } }