public static Response <InformeResponse> ListInformeTareas(int IdInforme) { try { Response <InformeResponse> response; List <InformeTareasList> List; List = InformeTareasData.ListInformeTareas(IdInforme); response = new Response <InformeResponse> { EsCorrecto = true, Valor = new InformeResponse { ListInformeTareas = List }, Mensaje = "OK", Estado = true, }; return(response); } 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; } }
public static async Task <Response <InformeResponse> > UpdateInformeTareasEstado(int IdInforme, int IdTarea, int Estado) { Response <InformeResponse> response; try { await InformeTareasData.UpdateInformeTareasEstado(IdInforme, IdTarea, Convert.ToByte(Estado)); if (Estado == Constants.EstadosInforme.ANULADO) { var objInformeTarea = InformeTareasData.ListInformeTareas(IdInforme, IdTarea, 99)[0]; var objInforme = InformeData.SelectInforme(IdInforme); await ControlUnidadTipoMantenimientoData.AnularControlUnidadMantenimiento(objInformeTarea.IdTipMan, objInforme.Are_Codigo); } 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)); } }