public static async Task <Response <InformeResponse> > DeleteTareaMecanico(int IdTareaMecanico) { Response <InformeResponse> response; try { await TareaMecanicoData.DeleteTareaMecanico(IdTareaMecanico); 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 Response <InformeResponse> ListTareaMecanico(int IdInforme, int IdTarea) { try { Response <InformeResponse> response; List <TareaMecanicoList> List; List = TareaMecanicoData.ListTareaMecanico(IdInforme, IdTarea); response = new Response <InformeResponse> { EsCorrecto = true, Valor = new InformeResponse { ListTareaMecanico = 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> > InsertTareaMecanico(InformeRequest request) { Response <InformeResponse> response; TareaMecanicosEntity objTareaMecanico; List <TareaMecanicoList> ListExiste; try { objTareaMecanico = request.TareaMecanico; ListExiste = TareaMecanicoData.ListTareaMecanico(objTareaMecanico.IdInforme, objTareaMecanico.IdTarea, objTareaMecanico.CodMecanico); if (ListExiste.Count > 0) { BusinessException.Generar(Constants.YA_EXISTE); } var fechaInicio = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaInicio)).ToShortDateString(); var fechaTermino = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaTermino)).ToShortDateString(); var horaInicio = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaInicio)).ToShortTimeString(); var horaTermino = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaTermino)).ToShortTimeString(); objTareaMecanico.FechaTermino = fechaTermino; objTareaMecanico.FechaInicio = fechaTermino; objTareaMecanico.HoraInicio = horaInicio; objTareaMecanico.HoraTermino = horaTermino; await TareaMecanicoData.InsertTareaMecanico(objTareaMecanico); 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> > UpdateTareaMecanico(InformeRequest request) { Response <InformeResponse> response; TareaMecanicosEntity objTareaMecanico; try { objTareaMecanico = request.TareaMecanico; var fechaInicio = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaInicio)).ToShortDateString(); var fechaTermino = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaTermino)).ToShortDateString(); var horaInicio = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaInicio)).ToShortTimeString(); var horaTermino = Convert.ToDateTime(Functions.ValidarDatetime(objTareaMecanico.FechaTermino)).ToShortTimeString(); objTareaMecanico.FechaTermino = fechaTermino; objTareaMecanico.FechaInicio = fechaTermino; objTareaMecanico.HoraInicio = horaInicio; objTareaMecanico.HoraTermino = horaTermino; await TareaMecanicoData.UpdateTareaMecanico(objTareaMecanico); 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)); } }