public List <Servicios> DetalleFactura(string nroFactura) { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); try { var query = (from A in dbContext.liquidacion join B in dbContext.service on A.v_NroLiquidacion equals B.v_NroLiquidacion join C in dbContext.person on B.v_PersonId equals C.v_PersonId join E in dbContext.protocol on B.v_ProtocolId equals E.v_ProtocolId join J in dbContext.organization on E.v_EmployerOrganizationId equals J.v_OrganizationId into J_join from J in J_join.DefaultIfEmpty() join J11 in dbContext.organization on E.v_CustomerOrganizationId equals J11.v_OrganizationId into J11_join from J11 in J11_join.DefaultIfEmpty() join J22 in dbContext.organization on E.v_WorkingOrganizationId equals J22.v_OrganizationId into J22_join from J22 in J22_join.DefaultIfEmpty() where A.v_NroFactura == nroFactura select new Servicios { NroLiquidacion = A.v_NroLiquidacion, Trabajador = C.v_FirstName + " " + C.v_FirstLastName + " " + C.v_SecondLastName, ServicioId = B.v_ServiceId, FechaExamen = B.d_ServiceDate.Value, CostoExamen = 0, Compania = J.v_Name, Contratista = J11.v_Name, UsuarioRecepcion = A.v_NroFactura, }).ToList(); var result = (from A in query select new Servicios { NroLiquidacion = A.NroLiquidacion, Trabajador = A.Trabajador, ServicioId = A.ServicioId, FechaExamen = A.FechaExamen, CostoExamen = decimal.Parse(new ServiceBL().GetServiceCost(A.ServicioId)), Compania = A.Compania, Contratista = A.Contratista, UsuarioRecepcion = A.UsuarioRecepcion }).ToList(); return(result); } catch (Exception ex) { throw; } }
public List <CalendarList> GetCalendarsPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, DateTime?pdatBeginDate, DateTime?pdatEndDate) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.calendar join B in dbContext.person on A.v_PersonId equals B.v_PersonId join C in dbContext.systemparameter on new { a = A.i_LineStatusId.Value, b = 120 } equals new { a = C.i_ParameterId, b = C.i_GroupId } join D in dbContext.service on A.v_ServiceId equals D.v_ServiceId join E in dbContext.systemparameter on new { a = A.i_ServiceTypeId.Value, b = 119 } equals new { a = E.i_ParameterId, b = E.i_GroupId } join F in dbContext.systemparameter on new { a = A.i_ServiceId.Value, b = 119 } equals new { a = F.i_ParameterId, b = F.i_GroupId } join G in dbContext.systemparameter on new { a = A.i_NewContinuationId.Value, b = 121 } equals new { a = G.i_ParameterId, b = G.i_GroupId } join H in dbContext.systemparameter on new { a = A.i_CalendarStatusId.Value, b = 122 } equals new { a = H.i_ParameterId, b = H.i_GroupId } join I in dbContext.systemparameter on new { a = A.i_IsVipId.Value, b = 111 } equals new { a = I.i_ParameterId, b = I.i_GroupId } join J in dbContext.protocol on new { a = D.v_ProtocolId } equals new { a = J.v_ProtocolId } into J_join from J in J_join.DefaultIfEmpty() join K in dbContext.systemparameter on new { a = J.i_EsoTypeId.Value, b = 118 } equals new { a = K.i_ParameterId, b = K.i_GroupId } into K_join from K in K_join.DefaultIfEmpty() // Empresa / Sede Cliente ************** join oc in dbContext.organization on new { a = J.v_CustomerOrganizationId } equals new { a = oc.v_OrganizationId } into oc_join from oc in oc_join.DefaultIfEmpty() join lc in dbContext.location on new { a = J.v_CustomerOrganizationId, b = J.v_CustomerLocationId } equals new { a = lc.v_OrganizationId, b = lc.v_LocationId } into lc_join from lc in lc_join.DefaultIfEmpty() // Empresa / Sede Trabajo ******************************************************** join ow in dbContext.organization on new { a = J.v_WorkingOrganizationId } equals new { a = ow.v_OrganizationId } into ow_join from ow in ow_join.DefaultIfEmpty() join lw in dbContext.location on new { a = J.v_WorkingOrganizationId, b = J.v_WorkingLocationId } equals new { a = lw.v_OrganizationId, b = lw.v_LocationId } into lw_join from lw in lw_join.DefaultIfEmpty() //************************************************************************************ join N in dbContext.organization on new { a = D.v_OrganizationId } equals new { a = N.v_OrganizationId } into N_join from N in N_join.DefaultIfEmpty() join O in dbContext.location on new { a = N.v_OrganizationId, b = D.v_LocationId } equals new { a = O.v_OrganizationId, b = O.v_LocationId } into O_join from O in O_join.DefaultIfEmpty() join J3 in dbContext.systemparameter on new { a = D.i_ServiceStatusId.Value, b = 125 } equals new { a = J3.i_ParameterId, b = J3.i_GroupId } into J3_join from J3 in J3_join.DefaultIfEmpty() join J4 in dbContext.systemparameter on new { a = D.i_AptitudeStatusId.Value, b = 124 } equals new { a = J4.i_ParameterId, b = J4.i_GroupId } into J4_join from J4 in J4_join.DefaultIfEmpty() join J5 in dbContext.datahierarchy on new { a = B.i_DocTypeId.Value, b = 106 } equals new { a = J5.i_ItemId, b = J5.i_GroupId } into J5_join from J5 in J5_join.DefaultIfEmpty() join J1 in dbContext.systemuser on new { i_InsertUserId = A.i_InsertUserId.Value } equals new { i_InsertUserId = J1.i_SystemUserId } into J1_join from J1 in J1_join.DefaultIfEmpty() join J2 in dbContext.systemuser on new { i_UpdateUserId = A.i_UpdateUserId.Value } equals new { i_UpdateUserId = J2.i_SystemUserId } into J2_join from J2 in J2_join.DefaultIfEmpty() where A.i_IsDeleted == 0 select new CalendarList { v_CalendarId = A.v_CalendarId, d_DateTimeCalendar = A.d_DateTimeCalendar.Value, v_Pacient = B.v_FirstLastName + " " + B.v_SecondLastName + " " + B.v_FirstName, v_NumberDocument = B.v_DocNumber, v_LineStatusName = C.v_Value1, v_ServiceId = A.v_ServiceId, v_ProtocolId = A.v_ProtocolId, v_ProtocolName = J.v_Name, v_ServiceStatusName = J3.v_Value1, v_AptitudeStatusName = J4.v_Value1, v_ServiceTypeName = E.v_Value1, v_ServiceName = F.v_Value1, v_NewContinuationName = G.v_Value1, v_PersonId = A.v_PersonId, v_CalendarStatusName = H.v_Value1, i_ServiceStatusId = D.i_ServiceStatusId.Value, v_IsVipName = I.v_Value1, i_ServiceId = A.i_ServiceId.Value, i_ServiceTypeId = A.i_ServiceTypeId.Value, i_CalendarStatusId = A.i_CalendarStatusId.Value, i_MasterServiceId = A.i_ServiceId.Value, i_NewContinuationId = A.i_NewContinuationId.Value, i_LineStatusId = A.i_LineStatusId.Value, i_IsVipId = A.i_IsVipId.Value, i_EsoTypeId = J.i_EsoTypeId.Value, v_EsoTypeName = K.v_Value1, v_OrganizationLocationProtocol = oc.v_Name + " / " + lc.v_Name, v_OrganizationLocationService = N.v_Name + " / " + O.v_Name, v_CreationUser = J1.v_UserName, v_UpdateUser = J2.v_UserName, d_CreationDate = A.d_InsertDate, d_UpdateDate = A.d_UpdateDate, i_IsDeleted = A.i_IsDeleted, v_CustomerOrganizationId = oc.v_OrganizationId, v_CustomerLocationId = lc.v_LocationId, v_DocTypeName = J5.v_Value1, v_DocNumber = B.v_DocNumber, i_DocTypeId = B.i_DocTypeId.Value, d_EntryTimeCM = A.d_EntryTimeCM.Value, v_WorkingOrganizationName = ow.v_Name }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } if (pdatBeginDate.HasValue && pdatEndDate.HasValue) { query = query.Where("d_DateTimeCalendar >= @0 && d_DateTimeCalendar <= @1", pdatBeginDate.Value, pdatEndDate.Value); } if (!string.IsNullOrEmpty(pstrSortExpression)) { query = query.OrderBy(pstrSortExpression); } //if (pintPageIndex.HasValue && pintResultsPerPage.HasValue) //{ // int intStartRowIndex = pintPageIndex.Value * pintResultsPerPage.Value; // query = query.Skip(intStartRowIndex); //} if (pintResultsPerPage.HasValue) { query = query.Take(pintResultsPerPage.Value); } List <CalendarList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <TramasList> GettramasPageAndFilteredProcedimientosCirugia(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, DateTime?pdatBeginDate, DateTime?pdatEndDate) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.tramas join C in dbContext.systemuser on A.i_InsertUserId equals C.i_SystemUserId join D in dbContext.person on C.v_PersonId equals D.v_PersonId join E in dbContext.systemuser on new { i_UpdateUserId = A.i_UpdateUserId.Value } equals new { i_UpdateUserId = E.i_SystemUserId } into E_join from E in E_join.DefaultIfEmpty() join F in dbContext.person on new { v_PersonId = E.v_PersonId } equals new { v_PersonId = F.v_PersonId } into F_join from F in F_join.DefaultIfEmpty() join G in dbContext.systemparameter on new { a = A.i_UPS.Value, b = 349 } equals new { a = G.i_ParameterId, b = G.i_GroupId } into G_join // UPS DETAIL from G in G_join.DefaultIfEmpty() join H in dbContext.systemparameter on new { a = A.i_Procedimiento.Value, b = 348 } equals new { a = H.i_ParameterId, b = H.i_GroupId } into H_join // PROCEDIMIENTO DETAIL from H in H_join.DefaultIfEmpty() join I in dbContext.systemparameter on new { a = A.i_Programacion.Value, b = 353 } equals new { a = I.i_ParameterId, b = I.i_GroupId } into I_join // PROGRAMACION DETAIL from I in I_join.DefaultIfEmpty() join J in dbContext.systemparameter on new { a = A.i_TipoCirugia.Value, b = 354 } equals new { a = J.i_ParameterId, b = J.i_GroupId } into J_join // TIPO CIRUJIA DETAIL from J in J_join.DefaultIfEmpty() where A.i_IsDeleted == 0 && A.v_TipoRegistro == "Procedimientos / Cirugía" select new TramasList { v_TramaId = A.v_TramaId, v_TipoRegistro = A.v_TipoRegistro, d_FechaIngreso = A.d_FechaIngreso.Value, i_UPS = A.i_UPS.Value, ups_Detail = G.v_Value1, i_Procedimiento = A.i_Procedimiento, procedimiento_Detail = H.v_Value1, programacion_Detail = I.v_Value1, tipoCirugia_Detail = J.v_Value1, i_HorasProg = A.i_HorasProg, i_HorasEfect = A.i_HorasEfect, i_HorasActo = A.i_HorasActo, d_InsertDate = A.d_InsertDate.Value, d_UpdateDate = A.d_UpdateDate.Value, User_Crea = D.v_FirstName + " " + D.v_FirstLastName + " " + D.v_SecondLastName, User_Act = E.i_SystemUserId == null ? "---" : F.v_FirstName + " " + F.v_FirstLastName + " " + F.v_SecondLastName, }; #region if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } if (pdatBeginDate.HasValue && pdatEndDate.HasValue) { query = query.Where("d_FechaIngreso >= @0 && d_FechaIngreso <= @1", pdatBeginDate.Value, pdatEndDate.Value); } if (!string.IsNullOrEmpty(pstrSortExpression)) { query = query.OrderBy(pstrSortExpression); } if (pintPageIndex.HasValue && pintResultsPerPage.HasValue) { int intStartRowIndex = pintPageIndex.Value * pintResultsPerPage.Value; query = query.Skip(intStartRowIndex); } if (pintResultsPerPage.HasValue) { query = query.Take(pintResultsPerPage.Value); } #endregion List <TramasList> objData = query.ToList(); var tramasdetalle = (from a in objData select new TramasList { v_TramaId = a.v_TramaId, v_TipoRegistro = a.v_TipoRegistro, d_FechaIngreso = a.d_FechaIngreso, i_UPS = a.i_UPS, ups_Detail = a.ups_Detail, i_Procedimiento = a.i_Procedimiento, procedimiento_Detail = a.procedimiento_Detail, programacion_Detail = a.programacion_Detail, tipoCirugia_Detail = a.tipoCirugia_Detail, i_HorasProg = a.i_HorasProg, i_HorasEfect = a.i_HorasEfect, i_HorasActo = a.i_HorasActo, User_Crea = a.User_Crea, User_Act = a.User_Act, d_InsertDate = a.d_InsertDate, d_UpdateDate = a.d_UpdateDate, }).ToList(); pobjOperationResult.Success = 1; return(tramasdetalle); } catch (Exception e) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(e); return(null); //Console.WriteLine(e); //throw; } }
public List <CalendarList> GetPacientInLineByComponentId_ATX(DateTime CurrentDate, List <string> pobjComponentIds, int masterServiceId, int UsuerId) { int isDeleted = (int)SiNo.No; int lineStatus = (int)LineStatus.EnCircuito; int isRequired = (int)SiNo.Si; try { DatabaseContext dbContext = new DatabaseContext(); var query = (from A in dbContext.Calendar join B in dbContext.Person on A.v_PersonId equals B.v_PersonId join C in dbContext.Service on A.v_ServiceId equals C.v_ServiceId join D in dbContext.ServiceComponent on A.v_ServiceId equals D.v_ServiceId where pobjComponentIds.Contains(D.v_ComponentId) //orderby D.v_ServiceComponentId join E in dbContext.SystemParameter on new { a = C.i_ServiceStatusId.Value, b = 125 } equals new { a = E.i_ParameterId, b = E.i_GroupId } join G in dbContext.SystemParameter on new { a = A.i_ServiceTypeId.Value, b = 119 } equals new { a = G.i_ParameterId, b = G.i_GroupId } join H in dbContext.SystemParameter on new { a = A.i_ServiceId.Value, b = 119 } equals new { a = H.i_ParameterId, b = H.i_GroupId } join I in dbContext.SystemParameter on new { a = A.i_IsVipId.Value, b = 111 } equals new { a = I.i_ParameterId, b = I.i_GroupId } join J in dbContext.Protocol on C.v_ProtocolId equals J.v_ProtocolId into J_join from J in J_join.DefaultIfEmpty() join K in dbContext.SystemParameter on new { a = J.i_EsoTypeId.Value, b = 118 } equals new { a = K.i_ParameterId, b = K.i_GroupId } into K_join from K in K_join.DefaultIfEmpty() join L in dbContext.Component on D.v_ComponentId equals L.v_ComponentId into L_join from L in L_join.DefaultIfEmpty() join P in dbContext.SystemParameter on new { a = 116, b = L.i_CategoryId } equals new { a = P.i_GroupId, b = P.i_ParameterId } //into P_join // Empresa / Sede Trabajo ******************************************************** join ow in dbContext.Organization on J.v_WorkingOrganizationId equals ow.v_OrganizationId into ow_join from ow in ow_join.DefaultIfEmpty() join lw in dbContext.Location on new { a = J.v_WorkingOrganizationId, b = J.v_WorkingLocationId } equals new { a = lw.v_OrganizationId, b = lw.v_LocationId } into lw_join from lw in lw_join.DefaultIfEmpty() //************************************************************************************ where A.i_IsDeleted == isDeleted && A.i_LineStatusId == lineStatus && D.i_IsRequiredId == isRequired && C.i_MasterServiceId == masterServiceId && D.i_MedicoTratanteId == UsuerId select new CalendarList { v_CalendarId = A.v_CalendarId, v_PersonId = A.v_PersonId, v_Pacient = B.v_FirstLastName + " " + B.v_SecondLastName + " " + B.v_FirstName, v_ServiceId = A.v_ServiceId, v_ServiceStatusName = E.v_Value1, v_ServiceTypeName = G.v_Value1, v_ServiceName = H.v_Value1, v_EsoTypeName = K.v_Value1, v_ProtocolName = J.v_Name, d_ServiceDate = C.d_ServiceDate.Value, v_ServiceComponentId = D.v_ServiceComponentId, i_IsVipId = A.i_IsVipId.Value, v_IsVipName = I.v_Value1, d_Birthdate = B.d_Birthdate.Value, i_ServiceStatusId = C.i_ServiceStatusId.Value, d_DateTimeCalendar = A.d_DateTimeCalendar.Value, v_DocNumber = B.v_DocNumber, i_CategoryId = L.i_CategoryId, v_ProtocolId = J.v_ProtocolId, i_ServiceId = A.i_ServiceId.Value, v_ComponentId = D.v_ComponentId, v_WorkingOrganizationName = ow.v_Name, Piso = P.v_Value2 }).ToList(); var queryFinal = query.Where(x => x.d_DateTimeCalendar.Value.Date == CurrentDate) .GroupBy(x => x.v_PersonId) .Select(group => group.First()).ToList(); queryFinal.ForEach(x => x.i_Edad = GetEdad(x.d_Birthdate)); List <CalendarList> objData = queryFinal.ToList(); return(objData); } catch (Exception ex) { return(null); } }
public PacientList DevolverDatosPaciente(string pstrServiceId) { try { DatabaseContext dbContext = new DatabaseContext(); var objEntity = (from a in dbContext.Service join b in dbContext.Person on a.v_PersonId equals b.v_PersonId join c in dbContext.SystemParameter on new { a = b.i_SexTypeId.Value, b = 100 } equals new { a = c.i_ParameterId, b = c.i_GroupId } // GENERO join d in dbContext.Protocol on a.v_ProtocolId equals d.v_ProtocolId join E in dbContext.DataHierarchy on new { a = b.i_DepartmentId.Value, b = 113 } equals new { a = E.i_ItemId, b = E.i_GroupId } into E_join from E in E_join.DefaultIfEmpty() join F in dbContext.DataHierarchy on new { a = b.i_ProvinceId.Value, b = 113 } equals new { a = F.i_ItemId, b = F.i_GroupId } into F_join from F in F_join.DefaultIfEmpty() join G in dbContext.DataHierarchy on new { a = b.i_DistrictId.Value, b = 113 } equals new { a = G.i_ItemId, b = G.i_GroupId } into G_join from G in G_join.DefaultIfEmpty() join H in dbContext.Person on a.v_PersonId equals H.v_PersonId into H_join from H in H_join.DefaultIfEmpty() join I in dbContext.DataHierarchy on new { a = H.i_DepartmentId.Value, b = 113 } equals new { a = I.i_ItemId, b = I.i_GroupId } into I_join from I in I_join.DefaultIfEmpty() join J in dbContext.DataHierarchy on new { a = H.i_ProvinceId.Value, b = 113 } equals new { a = J.i_ItemId, b = J.i_GroupId } into J_join from J in J_join.DefaultIfEmpty() join K in dbContext.DataHierarchy on new { a = H.i_DistrictId.Value, b = 113 } equals new { a = K.i_ItemId, b = K.i_GroupId } into K_join from K in K_join.DefaultIfEmpty() join M in dbContext.SystemParameter on new { a = H.i_MaritalStatusId.Value, b = 101 } equals new { a = M.i_ParameterId, b = M.i_GroupId } into M_join from M in M_join.DefaultIfEmpty() join N in dbContext.DataHierarchy on new { a = H.i_LevelOfId.Value, b = 108 } equals new { a = N.i_ItemId, b = N.i_GroupId } into N_join from N in N_join.DefaultIfEmpty() join P in dbContext.SystemParameter on new { a = b.i_BloodGroupId.Value, b = 154 } equals new { a = P.i_ParameterId, b = P.i_GroupId } into P_join from P in P_join.DefaultIfEmpty() join Q in dbContext.SystemParameter on new { a = b.i_BloodFactorId.Value, b = 155 } equals new { a = Q.i_ParameterId, b = Q.i_GroupId } into Q_join from Q in Q_join.DefaultIfEmpty() join r in dbContext.ServiceComponent on a.v_ServiceId equals r.v_ServiceId // Empresa / Sede Cliente ****************************************************** join oc in dbContext.Organization on new { a = d.v_CustomerOrganizationId } equals new { a = oc.v_OrganizationId } into oc_join from oc in oc_join.DefaultIfEmpty() join z in dbContext.Organization on new { a = d.v_EmployerOrganizationId } equals new { a = z.v_OrganizationId } into z_join from z in z_join.DefaultIfEmpty() join lc in dbContext.Location on new { a = d.v_CustomerOrganizationId, b = d.v_CustomerLocationId } equals new { a = lc.v_OrganizationId, b = lc.v_LocationId } into lc_join from lc in lc_join.DefaultIfEmpty() //********************************************************************************** join O in dbContext.SystemParameter on new { a = 134, b = a.i_MacId.Value } equals new { a = O.i_GroupId, b = O.i_ParameterId } into O_join from O in O_join.DefaultIfEmpty() join J4 in dbContext.SystemParameter on new { ItemId = a.i_AptitudeStatusId.Value, groupId = 124 } equals new { ItemId = J4.i_ParameterId, groupId = J4.i_GroupId } into J4_join from J4 in J4_join.DefaultIfEmpty() join su in dbContext.SystemUser on a.i_UpdateUserMedicalAnalystId.Value equals su.i_SystemUserId into su_join from su in su_join.DefaultIfEmpty() join pr in dbContext.Professional on su.v_PersonId equals pr.v_PersonId into pr_join from pr in pr_join.DefaultIfEmpty() join su1 in dbContext.SystemUser on a.i_UpdateUserOccupationalMedicaltId.Value equals su1.i_SystemUserId into su1_join from su1 in su1_join.DefaultIfEmpty() join pr2 in dbContext.Professional on su1.v_PersonId equals pr2.v_PersonId into pr2_join from pr2 in pr2_join.DefaultIfEmpty() where a.v_ServiceId == pstrServiceId && a.i_IsDeleted == 0 select new PacientList { Trabajador = b.v_FirstLastName + " " + b.v_SecondLastName + " " + b.v_FirstName, d_Birthdate = b.d_Birthdate.Value, // v_PersonId = b.v_PersonId, v_FirstLastName = b.v_FirstLastName, v_SecondLastName = b.v_SecondLastName, v_FirstName = b.v_FirstName, v_BirthPlace = b.v_BirthPlace, v_DepartamentName = I.v_Value1, v_ProvinceName = J.v_Value1, v_DistrictName = K.v_Value1, v_AdressLocation = b.v_AdressLocation, GradoInstruccion = N.v_Value1, v_CentroEducativo = b.v_CentroEducativo, v_MaritalStatus = M.v_Value1, v_BloodGroupName = P.v_Value1, v_BloodFactorName = Q.v_Value1, v_IdService = a.v_ServiceId, v_OrganitationName = oc.v_Name, i_NumberLivingChildren = b.i_NumberLivingChildren, FechaCaducidad = a.d_GlobalExpirationDate, FechaActualizacion = a.d_UpdateDate, N_Informe = r.v_ServiceComponentId, v_Religion = b.v_Religion, v_Nacionalidad = b.v_Nacionalidad, v_ResidenciaAnterior = b.v_ResidenciaAnterior, i_DocTypeId = b.i_DocTypeId, v_OwnerName = b.v_OwnerName, v_Employer = z.v_Name, v_ContactName = b.v_ContactName, i_Relationship = b.i_Relationship, v_EmergencyPhone = b.v_EmergencyPhone, // Genero = c.v_Value1, i_SexTypeId = b.i_SexTypeId, v_DocNumber = b.v_DocNumber, v_TelephoneNumber = b.v_TelephoneNumber, Empresa = oc.v_Name, Sede = lc.v_Name, v_CurrentOccupation = b.v_CurrentOccupation, FechaServicio = a.d_ServiceDate.Value, i_MaritalStatusId = b.i_MaritalStatusId, // Antecedentes ginecologicos d_PAP = a.d_PAP.Value, d_Mamografia = a.d_Mamografia.Value, v_CiruGine = a.v_CiruGine, v_Gestapara = a.v_Gestapara, v_Menarquia = a.v_Menarquia, v_Findings = a.v_Findings, d_Fur = a.d_Fur, v_CatemenialRegime = a.v_CatemenialRegime, i_MacId = a.i_MacId, v_Mac = O.v_Value1, v_Story = a.v_Story, Aptitud = J4.v_Value1, b_FirmaAuditor = pr.b_SignatureImage, FirmaTrabajador = b.b_RubricImage, HuellaTrabajador = b.b_FingerPrintImage, FirmaDoctorAuditor = pr2.b_SignatureImage, } ).ToList(); var DatosMedicoMedicinaEvaluador = ObtenerDatosMedicoMedicina(pstrServiceId, Constants.EXAMEN_FISICO_ID, Constants.EXAMEN_FISICO_7C_ID); //var DatosMedicoMedicinaAuditor = ObtenerDatosMedicoMedicinaAuditor(pstrServiceId, Constants.EXAMEN_FISICO_ID, Constants.EXAMEN_FISICO_7C_ID); var result = (from a in objEntity select new PacientList { Trabajador = a.Trabajador, d_Birthdate = a.d_Birthdate, v_ContactName = a.v_ContactName, v_EmergencyPhone = a.v_EmergencyPhone, i_Relationship = a.i_Relationship, // v_PersonId = a.v_PersonId, v_FirstLastName = a.v_FirstLastName, v_SecondLastName = a.v_SecondLastName, v_FirstName = a.v_FirstName, v_BirthPlace = a.v_BirthPlace, v_DepartamentName = a.v_DepartamentName, v_ProvinceName = a.v_ProvinceName, v_DistrictName = a.v_DistrictName, GradoInstruccion = a.GradoInstruccion, v_MaritalStatus = a.v_MaritalStatus, v_BloodGroupName = a.v_BloodGroupName, v_BloodFactorName = a.v_BloodFactorName, v_AdressLocation = a.v_AdressLocation, v_IdService = a.v_IdService, v_OrganitationName = a.v_OrganitationName, i_NumberLivingChildren = a.i_NumberLivingChildren, v_CentroEducativo = a.v_CentroEducativo, FechaCaducidad = a.FechaCaducidad, FechaActualizacion = a.FechaActualizacion, N_Informe = a.N_Informe, v_Religion = a.v_Religion, v_Nacionalidad = a.v_Nacionalidad, v_ResidenciaAnterior = a.v_ResidenciaAnterior, i_DocTypeId = a.i_DocTypeId, v_OwnerName = a.v_OwnerName, v_Employer = a.v_Employer, i_MaritalStatusId = a.i_MaritalStatusId, // Edad = GetEdad(a.d_Birthdate.Value), Genero = a.Genero, i_SexTypeId = a.i_SexTypeId, v_DocNumber = a.v_DocNumber, v_TelephoneNumber = a.v_TelephoneNumber, Empresa = a.Empresa, Sede = a.Sede, v_CurrentOccupation = a.v_CurrentOccupation, FechaServicio = a.FechaServicio, MedicoGrabaMedicina = DatosMedicoMedicinaEvaluador == null ? "" : DatosMedicoMedicinaEvaluador.ApellidosDoctor + " " + DatosMedicoMedicinaEvaluador.NombreDoctor, // Antecedentes ginecologicos d_PAP = a.d_PAP, d_Mamografia = a.d_Mamografia, v_CiruGine = a.v_CiruGine, v_Gestapara = a.v_Gestapara, v_Menarquia = a.v_Menarquia, v_Findings = a.v_Findings, d_Fur = a.d_Fur, v_CatemenialRegime = a.v_CatemenialRegime, i_MacId = a.i_MacId, v_Mac = a.v_Mac, v_Story = a.v_Story, Aptitud = a.Aptitud, b_FirmaEvaluador = DatosMedicoMedicinaEvaluador == null ? null : DatosMedicoMedicinaEvaluador.FirmaMedicoMedicina, b_FirmaAuditor = a.b_FirmaAuditor, FirmaTrabajador = a.FirmaTrabajador, HuellaTrabajador = a.HuellaTrabajador, FirmaDoctorAuditor = a.FirmaDoctorAuditor } ).FirstOrDefault(); return(result); } catch (Exception ex) { return(null); } }
public RegistrationViewDetailsModel GetUserDetailsByRegistrationID(int?RegistrationID) { try { using (var _context = new DatabaseContext()) { //string[] RoleCodes = new string[] { "SuperAdmin", "Manager" }; var queryResult = (from registration in _context.Registration join A in _context.AssignedRoles on registration.RegistrationID equals A.RegistrationID into A_join from A in A_join.DefaultIfEmpty() join AA in _context.Registration on A.AssignToAdmin equals AA.RegistrationID into AA_join from AA in AA_join.DefaultIfEmpty() join role in _context.Role on registration.RoleID equals role.RoleID into RL_join from role in RL_join.DefaultIfEmpty() join department in _context.Departments on registration.DeptId equals department.DeptId into D_join from department in D_join.DefaultIfEmpty() join job in _context.Jobs on registration.JobId equals job.JobId into J_join from job in J_join.DefaultIfEmpty() where registration.RegistrationID == RegistrationID select new RegistrationViewModel() { registration = registration, roles = role, departments = department, jobs = job, ManagerFirstName = AA.FirstName, ManagerLastName = AA.LastName, ManagerMiddleName = AA.MiddleName }).FirstOrDefault(); if (queryResult != null) { var objRegistrationViewDetailsModel = new RegistrationViewDetailsModel() { Birthdate = string.IsNullOrEmpty(queryResult.registration.Birthdate.ToString()) ? "" : Convert.ToDateTime(queryResult.registration.Birthdate, new CultureInfo("es-US", true)).ToString("MM/dd/yyyy"), DateofJoining = string.IsNullOrEmpty(queryResult.registration.DateofJoining.ToString()) ? "" : Convert.ToDateTime(queryResult.registration.DateofJoining, new CultureInfo("es-US", true)).ToString("MM/dd/yyyy"), DateofLeaving = string.IsNullOrEmpty(queryResult.registration.DateofLeaving.ToString()) ? "" : Convert.ToDateTime(queryResult.registration.DateofLeaving, new CultureInfo("es-US", true)).ToString("MM/dd/yyyy"), EmailID = queryResult.registration.EmailID, EmployeeID = queryResult.registration.EmployeeID, Gender = queryResult.registration.Gender, IsActive = Convert.ToBoolean(queryResult.registration.IsActive), Mobileno = queryResult.registration.Mobileno, FirstName = queryResult.registration.FirstName, MiddleName = queryResult.registration.MiddleName, LastName = queryResult.registration.LastName, RegistrationID = queryResult.registration.RegistrationID, RoleID = Convert.ToInt32(queryResult.registration.RoleID), Username = queryResult.registration.Username, WorkEmail = queryResult.registration.WorkEmail, EmergencyContact = queryResult.registration.EmergencyContact, EmergencyContactNumber = queryResult.registration.EmergencyContactNumber, DeptId = Convert.ToInt32(queryResult.registration.DeptId), ManagerId = Convert.ToInt32(queryResult.registration.ManagerId), JobId = Convert.ToInt32(queryResult.registration.JobId), JobTitle = queryResult.jobs == null ? "" : queryResult.jobs.JobTitle, RoleName = queryResult.roles == null ? "" : queryResult.roles.Rolename, DepartmentName = queryResult.departments == null ? "" : queryResult.departments.DepartmentName, ManagerFirstName = queryResult.ManagerFirstName == null ? "" : queryResult.ManagerFirstName, ManagerMiddleName = queryResult.ManagerMiddleName == null ? "" : queryResult.ManagerMiddleName, ManagerLastName = queryResult.ManagerLastName == null ? "" : queryResult.ManagerLastName }; return(objRegistrationViewDetailsModel); } return(new RegistrationViewDetailsModel()); } } catch (Exception ex) { throw ex; } }