public List <TicketDetalleList> GetTicketDetails(ref OperationResult _pobjOperationResult, string _tickId) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var objEntity = (from A in dbContext.hospitalizacion join C in dbContext.hospitalizacionservice on A.v_HopitalizacionId equals C.v_HopitalizacionId join D in dbContext.service on C.v_ServiceId equals D.v_ServiceId join E in dbContext.ticket on D.v_ServiceId equals E.v_ServiceId join F in dbContext.ticketdetalle on E.v_TicketId equals F.v_TicketId where E.v_TicketId == _tickId && A.i_IsDeleted == 0 && F.i_IsDeleted == 0 select new TicketDetalleList { v_TicketDetalleId = F.v_TicketDetalleId, v_TicketId = F.v_TicketId, d_Cantidad = F.d_Cantidad.Value, v_NombreProducto = F.v_Descripcion, v_CodInterno = F.v_CodInterno, v_IdProductoDetalle = F.v_IdProductoDetalle, d_PrecioVenta = F.d_PrecioVenta.Value, i_RecordStatus = (int)RecordStatus.Grabado, i_RecordType = (int)RecordType.NoTemporal, d_SaldoAseguradora = F.d_SaldoAseguradora, d_SaldoPaciente = F.d_SaldoPaciente }).ToList(); _pobjOperationResult.Success = 1; return(objEntity); } catch (Exception ex) { _pobjOperationResult.Success = 0; _pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public SystemParameterList GetParentNameSystemParameterFamilyMedicAntecedent(ref OperationResult pobjOperationResult, int pintParameterId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = (from A in dbContext.systemparameter where A.i_ParameterId == pintParameterId && A.i_GroupId == 149 && A.i_ParentParameterId != -1 select new SystemParameterList { i_ParentParameterId = A.i_ParentParameterId.Value, }).FirstOrDefault(); var query2 = (from A in dbContext.systemparameter where A.i_ParameterId == query.i_ParentParameterId && A.i_GroupId == 149 select new SystemParameterList { v_Value1 = A.v_Value1, i_ParentParameterId = A.i_ParentParameterId.Value, v_DiseasesName = A.v_Value1 }).FirstOrDefault(); SystemParameterList objData = query2; pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; return(null); } }
public void AddProduct(ref OperationResult pobjOperationResult, productDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); product objEntity = productAssembler.ToEntity(pobjDtoEntity); objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; // Autogeneramos el Pk de la tabla int intNodeId = int.Parse(ClientSession[0]); NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 6), "PI");; objEntity.v_ProductId = NewId; dbContext.AddToproduct(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "PRODUCTO", "v_ProductId=" + NewId.ToString(), Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "PRODUCTO", "v_ProductId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void DeleteAuthorizedPerson(ref OperationResult pobjOperationResult, string pintAuthorizedPersonId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.authorizedperson where a.v_AuthorizedPersonId == pintAuthorizedPersonId select a).FirstOrDefault(); //var registro = (from c in linq.Tabla // where c.id == id // select c).Single(); //linq.Tabla.DeleteOnSubmit(registro); //linq.SubmitChanges(); dbContext.authorizedperson.DeleteObject(objEntitySource); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; // Llenar entidad Log return; } }
public masterrecommendationrestricctionDto GetMasterRecommendationRestricctionByName(string pstrMasterRecommendationRestricctionName) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); masterrecommendationrestricctionDto objDtoEntity = null; var objEntity = (from a in dbContext.masterrecommendationrestricction where a.v_Name == pstrMasterRecommendationRestricctionName select a).FirstOrDefault(); if (objEntity != null) { objDtoEntity = masterrecommendationrestricctionAssembler.ToDTO(objEntity); } return(objDtoEntity); } catch (Exception ex) { return(null); } }
public List <Sigesoft.Node.WinClient.BE.DxFrecuenteList> GetDxFrecuentes(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.dxfrecuente join B in dbContext.dxfrecuentedetalle on A.v_DxFrecuenteId equals B.v_DxFrecuenteId join C in dbContext.diseases on A.v_DiseasesId equals C.v_DiseasesId join D in dbContext.masterrecommendationrestricction on B.v_MasterRecommendationRestricctionId equals D.v_MasterRecommendationRestricctionId where A.i_IsDeleted == 0 select new Sigesoft.Node.WinClient.BE.DxFrecuenteList { v_DxFrecuenteId = A.v_DxFrecuenteId, v_DiseasesId = A.v_DiseasesId, v_DiseasesName = C.v_Name, v_CIE10Id = A.v_CIE10Id, v_DxFrecuenteDetalleId = B.v_DxFrecuenteDetalleId, v_MasterRecommendationRestricctionId = B.v_MasterRecommendationRestricctionId, v_MasterRecommendationRestricctionName = D.v_Name, i_Tipo = D.i_TypifyingId.Value }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } List <Sigesoft.Node.WinClient.BE.DxFrecuenteList> objData = query.ToList(); List <Sigesoft.Node.WinClient.BE.DxFrecuenteList> QueryFinal = new List <Sigesoft.Node.WinClient.BE.DxFrecuenteList>(); //Transformar Data //Agrupar Data para DXS var DxFrecunetes = (objData.GroupBy(g => new { g.v_DiseasesId }) .Select(s => s.First()).ToList()).FindAll(p => p.v_DiseasesName != null); Sigesoft.Node.WinClient.BE.DxFrecuenteList oDxFrecuente; List <Sigesoft.Node.WinClient.BE.DxFrecuenteDetalleList> ListaDxFrecuenteDetalleList; foreach (var Dx in DxFrecunetes) { oDxFrecuente = new Sigesoft.Node.WinClient.BE.DxFrecuenteList(); oDxFrecuente.v_DxFrecuenteId = Dx.v_DxFrecuenteId; oDxFrecuente.v_DiseasesId = Dx.v_DiseasesId; oDxFrecuente.v_DiseasesName = Dx.v_DiseasesName; oDxFrecuente.v_CIE10Id = Dx.v_CIE10Id; var ListaRecomendacionesRestricciones = objData.FindAll(p => p.v_DxFrecuenteId == Dx.v_DxFrecuenteId); ListaDxFrecuenteDetalleList = new List <Sigesoft.Node.WinClient.BE.DxFrecuenteDetalleList>(); Sigesoft.Node.WinClient.BE.DxFrecuenteDetalleList oDxFrecuenteDetalleList; foreach (var item in ListaRecomendacionesRestricciones) { oDxFrecuenteDetalleList = new Sigesoft.Node.WinClient.BE.DxFrecuenteDetalleList(); oDxFrecuenteDetalleList.v_DxFrecuenteDetalleId = item.v_DxFrecuenteDetalleId; oDxFrecuenteDetalleList.v_DxFrecuenteId = item.v_DxFrecuenteId; oDxFrecuenteDetalleList.v_MasterRecommendationRestricctionId = item.v_MasterRecommendationRestricctionId; oDxFrecuenteDetalleList.i_Tipo = item.i_Tipo; if (item.i_Tipo == 1) { oDxFrecuenteDetalleList.v_RecomendacionName = item.v_MasterRecommendationRestricctionName; } else { oDxFrecuenteDetalleList.v_RestriccionName = item.v_MasterRecommendationRestricctionName; } ListaDxFrecuenteDetalleList.Add(oDxFrecuenteDetalleList); } oDxFrecuente.DxFrecuenteDetalle = ListaDxFrecuenteDetalleList; QueryFinal.Add(oDxFrecuente); } pobjOperationResult.Success = 1; return(QueryFinal); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <OrganizationList> GetOrganizationsPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.organization join B in dbContext.systemparameter on new { a = A.i_OrganizationTypeId.Value, b = 103 } equals new { a = B.i_ParameterId, b = B.i_GroupId } //join C in dbContext.datahierarchy on new { a = A.i_SectorTypeId.Value, b = 104 } equals new { a = C.i_ItemId, b = C.i_GroupId } 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 OrganizationList { b_Seleccionar = false, v_OrganizationId = A.v_OrganizationId, i_OrganizationTypeId = (int)A.i_OrganizationTypeId, v_OrganizationTypeIdName = B.v_Value1, i_SectorTypeId = (int)A.i_SectorTypeId, v_EmailContacto = A.v_EmailContacto, v_IdentificationNumber = A.v_IdentificationNumber, v_Name = A.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_SectorName = A.v_SectorName, v_SectorCodigo = A.v_SectorCodigo, v_ContacName = A.v_ContacName + " / " + A.v_Mail, v_Contacto = A.v_Contacto + " / " + A.v_EmailContacto, v_ContactoMedico = A.v_ContactoMedico + " / " + A.v_EmailMedico, v_Address = A.v_Address, v_Observation = A.v_Observation, v_PhoneNumber = A.v_PhoneNumber }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <OrganizationList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <MedicalExamList> GetMedicalExamPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.component 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() join B in dbContext.systemparameter on new { a = A.i_CategoryId.Value, b = 116 } // CATEGORIA DEL EXAMEN equals new { a = B.i_ParameterId, b = B.i_GroupId } into B_join from B in B_join.DefaultIfEmpty() join E in dbContext.systemparameter on new { a = A.i_DiagnosableId.Value, b = 111 } equals new { a = E.i_ParameterId, b = E.i_GroupId } join F in dbContext.systemparameter on new { a = A.i_ComponentTypeId.Value, b = 126 } equals new { a = F.i_ParameterId, b = F.i_GroupId } where A.i_IsDeleted == 0 select new MedicalExamList { v_MedicalExamId = A.v_ComponentId, v_Name = A.v_Name, i_CategoryId = A.i_CategoryId.Value, v_CategoryName = B.v_Value1, v_DiagnosableName = E.v_Value1, v_ComponentTypeName = F.v_Value1, 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.Value, r_BasePrice = A.r_BasePrice, i_ComponentTypeId = A.i_ComponentTypeId, i_UIIndex = A.i_UIIndex.Value, v_IdUnidadProductiva = A.v_IdUnidadProductiva }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <MedicalExamList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
//Devart.Data.PostgreSql.PgSqlMonitor mon = new Devart.Data.PostgreSql.PgSqlMonitor(); public List <MedicalExamFieldValuesList> GetMedicalExamFieldValuesPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.componentfieldvalues join B in dbContext.systemparameter on new { a = A.i_OperatorId.Value, b = 129 } equals new { a = B.i_ParameterId, b = B.i_GroupId } join C in dbContext.systemparameter on new { a = A.i_IsAnormal.Value, b = 111 } equals new { a = C.i_ParameterId, b = C.i_GroupId } //join D in dbContext.diseases on new { A.v_Diseases equals D.v_DiseasesId } join D in dbContext.diseases on new { a = A.v_Diseases } equals new { a = D.v_DiseasesId } into D_join from D in D_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 MedicalExamFieldValuesList { v_MedicalExamFieldValuesId = A.v_ComponentFieldValuesId, v_MedicalExamFieldsId = A.v_ComponentFieldId, v_AnalyzingValue1 = A.v_AnalyzingValue1, v_AnalyzingValue2 = A.v_AnalyzingValue2, i_OperatorId = A.i_OperatorId.Value, v_OperatorName = B.v_Value1, v_IsAnormal = C.v_Value1, v_Cie10Name = D.v_Name + " / " + D.v_CIE10Id, v_LegalStandard = A.v_LegalStandard, 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.Value }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <MedicalExamFieldValuesList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <SupplierList> GetSuppliersPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.supplier join C in dbContext.datahierarchy on A.i_SectorTypeId equals C.i_ItemId 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 C.i_GroupId == 104 select new SupplierList { v_SupplierId = A.v_SupplierId, i_SectorTypeId = (int)A.i_SectorTypeId, v_SectorTypeIdName = C.v_Value1, v_IdentificationNumber = A.v_IdentificationNumber, v_Name = A.v_Name, v_Address = A.v_Address, v_PhoneNumber = A.v_PhoneNumber, v_Mail = A.v_Mail, 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 }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <SupplierList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <GroupOccupationList> GetGroupOccupationPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, string pstrOrganizationId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.groupoccupation join B in dbContext.location on A.v_LocationId equals B.v_LocationId join C in dbContext.organization on B.v_OrganizationId equals C.v_OrganizationId 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 && C.v_OrganizationId == pstrOrganizationId select new GroupOccupationList { v_GroupOccupationId = A.v_GroupOccupationId, v_LocationId = A.v_LocationId, v_LocationName = B.v_Name, v_Name = A.v_Name, v_CreationUser = J1.v_UserName, v_UpdateUser = J2.v_UserName, d_CreationDate = A.d_InsertDate, d_UpdateDate = A.d_UpdateDate }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <GroupOccupationList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <ComponentFieldsList> GetComponentFieldsagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.componentfields join B in dbContext.componentfield on A.v_ComponentFieldId equals B.v_ComponentFieldId 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 ComponentFieldsList { v_ComponentFieldId = A.v_ComponentFieldId, v_ComponentId = A.v_ComponentId, v_Group = A.v_Group, v_TextLabel = B.v_TextLabel, i_RecordStatus = (int)RecordStatus.Grabado, i_RecordType = (int)RecordType.NoTemporal, v_CreationUser = J1.v_UserName, v_UpdateUser = J2.v_UserName, d_CreationDate = A.d_InsertDate, d_UpdateDate = A.d_UpdateDate }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <ComponentFieldsList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public void DeleteMedicalExamFields(ref OperationResult pobjOperationResult, string pstrComponentId, string pstrMedicalExamFieldId, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query1 = (from a in dbContext.componentfields where a.v_ComponentFieldId == pstrMedicalExamFieldId && a.i_IsDeleted == 0 select a).ToList(); if (query1.Count() > 1) { // Obtener la entidad fuente var objEntitySource = (from a in dbContext.componentfields where a.v_ComponentFieldId == pstrMedicalExamFieldId && a.v_ComponentId == pstrComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource.i_IsDeleted = 1; } else { // Obtener la entidad fuente var objEntitySource = (from a in dbContext.componentfields where a.v_ComponentFieldId == pstrMedicalExamFieldId && a.v_ComponentId == pstrComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource.i_IsDeleted = 1; // Obtener la entidad fuente var objEntitySource1 = (from a in dbContext.componentfield where a.v_ComponentFieldId == pstrMedicalExamFieldId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource.i_IsDeleted = 1; } // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ELIMINACION, "EXAMEN MÉDICO CAMPO", "", Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ELIMINACION, "EXAMEN MÉDICO CAMPO", "", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public List <MedicalExamFieldsList> GetMedicalExamFieldsPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.componentfields join B in dbContext.componentfield on A.v_ComponentFieldId equals B.v_ComponentFieldId join C in dbContext.systemparameter on new { a = B.i_IsRequired.Value, b = 111 } equals new { a = C.i_ParameterId, b = C.i_GroupId } 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 MedicalExamFieldsList { v_MedicalExamFieldId = B.v_ComponentFieldId, v_ComponentId = A.v_ComponentId, v_TextLabel = B.v_TextLabel, i_LabelWidth = B.i_LabelWidth.Value, v_DefaultText = B.v_DefaultText, i_ControlId = B.i_ControlId.Value, i_GroupId = B.i_GroupId.Value, i_ItemId = B.i_ItemId.Value, i_ControlWidth = B.i_WidthControl.Value, i_HeightControl = B.i_HeightControl.Value, i_MaxLenght = B.i_MaxLenght.Value, i_IsRequired = B.i_IsRequired.Value, v_IsRequired = C.v_Value1, i_IsCalculate = B.i_IsCalculate.Value, i_Order = B.i_Order.Value, i_MeasurementUnitId = B.i_MeasurementUnitId.Value, r_ValidateValue1 = B.r_ValidateValue1.Value, r_ValidateValue2 = B.r_ValidateValue2.Value, v_Group = A.v_Group, 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.Value, v_ComponentFieldId = B.v_ComponentFieldId }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <MedicalExamFieldsList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <RolCuotaDetalleList> GetRolCuotaDetallePagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.rolcuotadetalle 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 RolCuotaDetalleList { v_RolCuotaDetalleId = A.v_RolCuotaDetalleId, v_RolCuotaId = A.v_RolCuotaId, v_IdProducto = A.v_IdProducto, v_ProductoNombre = A.v_ProductoNombre, i_Cuota = A.i_Cuota, v_CreationUser = J1.v_UserName, v_UpdateUser = J2.v_UserName, d_CreationDate = A.d_InsertDate, d_UpdateDate = A.d_UpdateDate }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <RolCuotaDetalleList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public List <recetadespachoDto> GetRecetaToReport(ref OperationResult pobjOperationResult, string serviceId) { try { using (var dbContext = new SigesoftEntitiesModel()) { pobjOperationResult.Success = 1; var medicamentos = MedicamentoDao.ObtenerContasolMedicamentos(); var FirmaMedicoMedicina = new ServiceBL().ObtenerFirmaMedicoExamen(serviceId, Constants.ATENCION_INTEGRAL_ID, Constants.EXAMEN_FISICO_7C_ID); var consulta = (from r in dbContext.receta join d in dbContext.diagnosticrepository on r.v_DiagnosticRepositoryId equals d.v_DiagnosticRepositoryId into dJoin from d in dJoin.DefaultIfEmpty() join s in dbContext.service on d.v_ServiceId equals s.v_ServiceId into sJoin from s in sJoin.DefaultIfEmpty() join C in dbContext.organization on new { id = "N009-OO000000052" } equals new { id = C.v_OrganizationId } into C_join from C in C_join.DefaultIfEmpty() join p in dbContext.person on s.v_PersonId equals p.v_PersonId into pJoin from p in pJoin.DefaultIfEmpty() where s.v_ServiceId.Equals(serviceId) select new recetadespachoDto { RecetaId = r.i_IdReceta, CantidadRecetada = r.d_Cantidad ?? 0, //Medicamento = m.NombreCompleto, //Presentacion = m.Presentacion, //Ubicacion = m.Ubicacion, NombrePaciente = p.v_FirstLastName + " " + p.v_SecondLastName + " " + p.v_FirstName, FechaFin = r.t_FechaFin ?? DateTime.Now, Duracion = r.v_Duracion, Dosis = r.v_Posologia, NombreMedico = FirmaMedicoMedicina.Value2, RubricaMedico = FirmaMedicoMedicina.Value5, MedicoNroCmp = FirmaMedicoMedicina.Value3, NombreClinica = C.v_Name, DireccionClinica = C.v_Address, LogoClinica = C.b_Image, Despacho = (r.i_Lleva ?? 0) == 1, MedicinaId = r.v_IdProductoDetalle }).ToList(); //consulta = consulta.GroupBy(p => p.RecetaId).Select(p => p.FirstOrDefault()).ToList(); foreach (var item in consulta) { var prod = medicamentos.FirstOrDefault(p => p.IdProductoDetalle.Equals(item.MedicinaId)); if (prod == null) { continue; } item.Medicamento = prod.NombreCompleto; item.Presentacion = prod.Presentacion; item.Ubicacion = prod.Ubicacion; } return(consulta); } } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ErrorMessage = ex.Message; pobjOperationResult.ExceptionMessage = ex.InnerException != null ? ex.InnerException.Message : string.Empty; pobjOperationResult.AdditionalInformation = "RecetaDespachoBl.GetDespacho()"; return(null); } }
public List <DataHierarchyList> GetDataHierarchiesPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, int pintGroupId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.datahierarchy 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() join J4 in dbContext.datahierarchy on new { ItemId = A.i_ParentItemId.Value, groupId = A.i_GroupId } equals new { ItemId = J4.i_ItemId, groupId = J4.i_GroupId } into J4_join from J4 in J4_join.DefaultIfEmpty() where A.i_GroupId == pintGroupId && (A.i_IsDeleted == 0 || A.i_IsDeleted == null) select new DataHierarchyList { i_GroupId = A.i_GroupId, i_ItemId = A.i_ItemId, v_Value1 = A.v_Value1, i_ParentItemId = A.i_ParentItemId.Value, v_ParentItemName = J4.v_Value1, 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 }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } if (!string.IsNullOrEmpty(pstrSortExpression)) { query = query.OrderBy(pstrSortExpression); } if (pintPageIndex.HasValue && pintResultsPerPage.HasValue) { int intStartRowIndex = pintPageIndex.Value * pintResultsPerPage.Value; query = query.Skip(intStartRowIndex); query = query.Take(pintResultsPerPage.Value); } List <DataHierarchyList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; return(null); } }
public void AddComponentFields(ref OperationResult pobjOperationResult, List <componentfieldsDto> pobjcomponentfieldsAdd, List <componentfieldsDto> pobjcomponentfieldsUpdate, List <componentfieldsDto> pobjcomponentfieldsDelete, List <string> ClientSession) { try { OperationResult objOperationResult = new OperationResult(); SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); int intNodeId = int.Parse(ClientSession[0]); #region Add Component Fields foreach (var item in pobjcomponentfieldsAdd) { componentfields objEntity1 = new componentfields(); objEntity1.d_InsertDate = DateTime.Now; objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity1.i_IsDeleted = 0; objEntity1.v_ComponentFieldId = item.v_ComponentFieldId; objEntity1.v_ComponentId = item.v_ComponentId; objEntity1.v_Group = item.v_Group; //Verificar si se encuentra en la BD eliminado var objEntitySource1 = (from a in dbContext.componentfields where a.v_ComponentFieldId == item.v_ComponentFieldId && a.v_ComponentId == item.v_ComponentId select a).FirstOrDefault(); if (objEntitySource1 == null) { dbContext.AddTocomponentfields(objEntity1); } else { objEntitySource1.i_IsDeleted = 0; objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); } } // Guardar los cambios dbContext.SaveChanges(); #endregion #region Update Component Fields if (pobjcomponentfieldsUpdate != null) { // Actualizar Componentes del protocolo foreach (var item in pobjcomponentfieldsUpdate) { // Obtener la entidad fuente var objEntitySource1 = (from a in dbContext.componentfields where a.v_ComponentFieldId == item.v_ComponentFieldId && a.v_ComponentId == item.v_ComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource1.v_Group = item.v_Group; objEntitySource1.i_IsDeleted = 0; objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); } } // Guardar los cambios dbContext.SaveChanges(); #endregion #region Delete Component Fields if (pobjcomponentfieldsDelete != null) { foreach (var item in pobjcomponentfieldsDelete) { // Obtener la entidad fuente var objEntitySource1 = (from a in dbContext.componentfields where a.v_ComponentFieldId == item.v_ComponentFieldId && a.v_ComponentId == item.v_ComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource1.i_IsDeleted = 1; } } // Guardar los cambios dbContext.SaveChanges(); #endregion pobjOperationResult.Success = 1; // Llenar entidad Log //LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "CAMPOS DEL COMPONENTE", "v_ComponentId=" + objEntity1.v_ComponentId + "v_ComponentFieldId= " + objEntity1.v_ComponentFieldId, Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "CAMPOS DEL COMPONENTE", "v_ComponentId= No generado ,v_ComponentFieldId= No generado ", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public List <Sigesoft.Node.WinClient.BE.PersonMedicalHistoryList> GetPersonMedicalHistoryReport(string pstrPersonId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = (from A in dbContext.personmedicalhistory join B in dbContext.systemparameter on new { a = A.v_DiseasesId, b = 147 } equals new { a = B.v_Value1, b = B.i_GroupId } into B_join from B in B_join.DefaultIfEmpty() join C in dbContext.systemparameter on new { a = B.i_ParentParameterId.Value, b = 147 } equals new { a = C.i_ParameterId, b = C.i_GroupId } into C_join from C in C_join.DefaultIfEmpty() join D in dbContext.diseases on A.v_DiseasesId equals D.v_DiseasesId join E in dbContext.systemparameter on new { a = A.i_TypeDiagnosticId.Value, b = 139 } equals new { a = E.i_ParameterId, b = E.i_GroupId } into E_join from E in E_join.DefaultIfEmpty() where (A.i_IsDeleted == 0) && (A.v_PersonId == pstrPersonId) select new Sigesoft.Node.WinClient.BE.PersonMedicalHistoryList { v_PersonMedicalHistoryId = A.v_PersonMedicalHistoryId, v_PersonId = A.v_PersonId, v_DiseasesId = A.v_DiseasesId, v_DiseasesName = D.v_Name, i_TypeDiagnosticId = A.i_TypeDiagnosticId, d_StartDate = A.d_StartDate.Value, v_TreatmentSite = A.v_TreatmentSite, v_GroupName = C.v_Value1, v_TypeDiagnosticName = E.v_Value1, v_DiagnosticDetail = A.v_DiagnosticDetail, i_Answer = A.i_AnswerId.Value, }).ToList(); // add the sequence number on the fly var query1 = new List <Sigesoft.Node.WinClient.BE.PersonMedicalHistoryList>(); query1 = query.Select((x, index) => new Sigesoft.Node.WinClient.BE.PersonMedicalHistoryList { i_Item = index + 1, v_PersonMedicalHistoryId = x.v_PersonMedicalHistoryId, v_PersonId = x.v_PersonId, v_DiseasesId = x.v_DiseasesId, v_DiseasesName = x.v_DiseasesName, i_TypeDiagnosticId = x.i_TypeDiagnosticId, d_StartDate = x.d_StartDate, v_TreatmentSite = x.v_TreatmentSite, v_GroupName = x.v_GroupName, v_TypeDiagnosticName = x.v_TypeDiagnosticName, v_DiagnosticDetail = x.v_DiagnosticDetail, i_Answer = x.i_Answer, }).ToList(); //List<PersonMedicalHistoryList> objData = query.ToList(); return(query1); } catch (Exception ex) { return(null); } }
public string AddMedicalExamFields(ref OperationResult pobjOperationResult, componentfieldDto pobjDtoEntity, componentfieldsDto pobjDtoEntitys, string pstrComponentId, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query1 = (from a in dbContext.componentfield join b in dbContext.componentfields on a.v_ComponentFieldId equals b.v_ComponentFieldId where a.v_TextLabel.ToUpper() == pobjDtoEntity.v_TextLabel.ToUpper() && b.v_ComponentId == pobjDtoEntitys.v_ComponentId && b.v_Group == pobjDtoEntitys.v_Group select a).ToList(); if (query1.Count > 0) { pobjOperationResult.ErrorMessage = "Nombre del componente duplicado"; return("0"); } #region ComponentField componentfield objEntity = componentfieldAssembler.ToEntity(pobjDtoEntity); objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; // Autogeneramos el Pk de la tabla int intNodeId = int.Parse(ClientSession[0]); NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 18), "MF"); objEntity.v_ComponentFieldId = NewId; dbContext.AddTocomponentfield(objEntity); dbContext.SaveChanges(); #endregion #region ComponentFields componentfields objEntitys = componentfieldsAssembler.ToEntity(pobjDtoEntitys); objEntitys.v_ComponentFieldId = NewId; objEntitys.v_ComponentId = pstrComponentId; objEntitys.d_InsertDate = DateTime.Now; objEntitys.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntitys.i_IsDeleted = 0; dbContext.AddTocomponentfields(objEntitys); dbContext.SaveChanges(); #endregion pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO CAMPO", "v_MedicalExamFieldsId=" + NewId.ToString(), Success.Ok, null); return(NewId); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO CAMPO", "v_MedicalExamFieldsId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return("0"); } }
public XmlNatclar DatosXmlNatclar(string serviceId) { var groupUbigeo = 113; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.service join B in dbContext.person on A.v_PersonId equals B.v_PersonId // Ubigeo de la persona ******************************************************* join dep in dbContext.datahierarchy on new { a = B.i_DepartmentId.Value, b = groupUbigeo } equals new { a = dep.i_ItemId, b = dep.i_GroupId } into dep_join from dep in dep_join.DefaultIfEmpty() join prov in dbContext.datahierarchy on new { a = B.i_ProvinceId.Value, b = groupUbigeo } equals new { a = prov.i_ItemId, b = prov.i_GroupId } into prov_join from prov in prov_join.DefaultIfEmpty() join distri in dbContext.datahierarchy on new { a = B.i_DistrictId.Value, b = groupUbigeo } equals new { a = distri.i_ItemId, b = distri.i_GroupId } into distri_join from distri in distri_join.DefaultIfEmpty() //********************************************************************************************* where A.i_IsDeleted == 0 && A.v_ServiceId == serviceId select new XmlNatclar { Hc = B.v_DocNumber, TipoDocumento = B.i_DocTypeId.Value, Dni = B.v_DocNumber, Sexo = B.i_SexTypeId.Value, PrimerApellido = B.v_FirstLastName, SegundoApellido = B.v_SecondLastName, Nombre = B.v_FirstName, EstadoCivil = B.i_MaritalStatusId.Value, FechaNacimientoSigesoft = B.d_Birthdate.Value, ProvinciaNacimiento = prov.v_Value1, DistritoNacimiento = distri.v_Value1, DepartamentoNacimiento = dep.v_Value1, Email = B.v_Mail, ResidenciaActual = B.v_AdressLocation, Direccion = B.v_AdressLocation, IDEstructura = "2", IDCentro = "CX35", IDExamen = serviceId, IDActuacion = "", TipoExamen = A.i_MasterServiceId.Value, IDEstado = B.i_IsDeleted, FechaRegistro = A.d_ServiceDate.Value, FechaUltimaRegla = A.v_FechaUltimoPAP }; var objData = query.FirstOrDefault(); if (objData == null) { return(null); } objData.Examenes = ObtenerExamenesPorServicio(serviceId); return(objData); } catch (Exception ex) { Console.WriteLine(ex); throw; } }
public List <Sigesoft.Node.WinClient.BE.ProtocolComponentList> GetProtocolComponents(ref OperationResult pobjOperationResult, string pstrProtocolId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var objEntity = (from a in dbContext.protocolcomponent join b in dbContext.component on a.v_ComponentId equals b.v_ComponentId join fff in dbContext.systemparameter on new { a = b.i_CategoryId.Value, b = 116 } // CATEGORIA DEL EXAMEN equals new { a = fff.i_ParameterId, b = fff.i_GroupId } into J5_join from fff in J5_join.DefaultIfEmpty() join E in dbContext.systemparameter on new { a = a.i_OperatorId.Value, b = 117 } equals new { a = E.i_ParameterId, b = E.i_GroupId } into J1_join from E in J1_join.DefaultIfEmpty() join H in dbContext.systemparameter on new { a = a.i_GenderId.Value, b = 130 } // Genero condicional equals new { a = H.i_ParameterId, b = H.i_GroupId } into J2_join from H in J2_join.DefaultIfEmpty() join I in dbContext.systemparameter on new { a = b.i_ComponentTypeId.Value, b = 126 } // Tipo componente equals new { a = I.i_ParameterId, b = I.i_GroupId } into J3_join from I in J3_join.DefaultIfEmpty() where a.v_ProtocolId == pstrProtocolId && a.i_IsDeleted == 0 select new Sigesoft.Node.WinClient.BE.ProtocolComponentList { v_ComponentId = a.v_ComponentId, v_ComponentName = b.v_Name, //v_ServiceComponentStatusName = K.v_Value1, v_ProtocolComponentId = a.v_ProtocolComponentId, r_Price = a.r_Price, v_Operator = E.v_Value1, i_Age = a.i_Age, v_Gender = H.v_Value1, i_IsConditionalIMC = a.i_IsConditionalIMC, r_Imc = a.r_Imc, v_IsConditional = a.i_IsConditionalId == 1 ? "Si" : "No", i_isAdditional = a.i_IsAdditional, v_ComponentTypeName = I.v_Value1, i_RecordStatus = (int)RecordStatus.Grabado, i_RecordType = (int)RecordType.NoTemporal, i_GenderId = a.i_GenderId, i_IsConditionalId = a.i_IsConditionalId, i_OperatorId = a.i_OperatorId, i_IsDeleted = a.i_IsDeleted, d_CreationDate = a.d_InsertDate, v_CategoryName = fff.v_Value1, i_CategoryId = b.i_CategoryId }).ToList(); pobjOperationResult.Success = 1; return(objEntity); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public void UpdateMedicalExamFieldValues(ref OperationResult pobjOperationResult, List <componentfieldvaluesrestrictionDto> pobjComponentFieldValuesRestrictionAdd, List <componentfieldvaluesrestrictionDto> pobjComponentFieldValuesRestrictionDelete, List <componentfieldvaluesrecommendationDto> pobjComponentFieldValuesRecommendationAdd, List <componentfieldvaluesrecommendationDto> pobjComponentFieldValuesRecommendationDelete, componentfieldvaluesDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region Actualizar Valor componentfieldvaluesrestrictionDto objcomponentfieldvaluesrestrictionDto = new componentfieldvaluesrestrictionDto(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.componentfieldvalues where a.v_ComponentFieldValuesId == pobjDtoEntity.v_ComponentFieldValuesId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); componentfieldvalues objEntity = componentfieldvaluesAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.componentfieldvalues.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); #endregion #region Crear Restriccion int intNodeId = int.Parse(ClientSession[0]); foreach (var item in pobjComponentFieldValuesRestrictionAdd) { componentfieldvaluesrestriction objEntity1 = componentfieldvaluesrestrictionAssembler.ToEntity(item); objEntity1.d_InsertDate = DateTime.Now; objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity1.i_IsDeleted = 0; var NewId1 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 28), "VR"); objEntity1.v_ComponentFieldValuesRestrictionId = NewId1; objEntity1.v_ComponentFieldValuesId = pobjDtoEntity.v_ComponentFieldValuesId; dbContext.AddTocomponentfieldvaluesrestriction(objEntity1); } // Guardar los cambios dbContext.SaveChanges(); #endregion #region Eliminar Restriccion if (pobjComponentFieldValuesRestrictionDelete != null) { // Eliminar Componentes del protocolo foreach (var item in pobjComponentFieldValuesRestrictionDelete) { // Obtener la entidad fuente var objEntitySource1 = (from a in dbContext.componentfieldvaluesrestriction where a.v_ComponentFieldValuesRestrictionId == item.v_ComponentFieldValuesRestrictionId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource1.i_IsDeleted = 1; } } // Guardar los cambios dbContext.SaveChanges(); #endregion #region Crear Recommendation foreach (var item in pobjComponentFieldValuesRecommendationAdd) { componentfieldvaluesrecommendation objEntity1 = componentfieldvaluesrecommendationAssembler.ToEntity(item); objEntity1.d_InsertDate = DateTime.Now; objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity1.i_IsDeleted = 0; var NewId1 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 31), "VC"); objEntity1.v_ComponentFieldValuesRecommendationId = NewId1; objEntity1.v_ComponentFieldValuesId = pobjDtoEntity.v_ComponentFieldValuesId; dbContext.AddTocomponentfieldvaluesrecommendation(objEntity1); } // Guardar los cambios dbContext.SaveChanges(); #endregion #region Eliminar Recommendation if (pobjComponentFieldValuesRecommendationDelete != null) { // Eliminar Componentes del protocolo foreach (var item in pobjComponentFieldValuesRecommendationDelete) { // Obtener la entidad fuente var objEntitySource1 = (from a in dbContext.componentfieldvaluesrecommendation where a.v_ComponentFieldValuesRecommendationId == item.v_ComponentFieldValuesRecommendationId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource1.i_IsDeleted = 1; } } // Guardar los cambios dbContext.SaveChanges(); #endregion //// Guardar los cambios //dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamId=" + objEntity.v_ComponentFieldValuesId.ToString(), Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamId=" + pobjDtoEntity.v_ComponentFieldValuesId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public string AddProtocol(ref OperationResult pobjOperationResult, protocolDto pobjProtocol, List <protocolcomponentDto> pobjProtocolComponent, List <string> ClientSession) { //mon.IsActive = true; string NewId0 = null; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); protocol objEntity = protocolAssembler.ToEntity(pobjProtocol); int intNodeId = 9; if (pobjProtocol.v_ProtocolId == null) { objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; // Autogeneramos el Pk de la tabla NewId0 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 20), "PR"); objEntity.v_ProtocolId = NewId0; dbContext.AddToprotocol(objEntity); dbContext.SaveChanges(); } else { // Obtener la entidad fuente var objEntitySource = (from a in dbContext.protocol where a.v_ProtocolId == pobjProtocol.v_ProtocolId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjProtocol.i_IsDeleted = 0; pobjProtocol.d_UpdateDate = DateTime.Now; pobjProtocol.i_UpdateUserId = Int32.Parse(ClientSession[2]); var objStrongEntity = protocolAssembler.ToEntity(pobjProtocol); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.protocol.ApplyCurrentValues(objStrongEntity); } // Grabar detalle del protocolo foreach (var item in pobjProtocolComponent) { protocolcomponent objEntity1 = protocolcomponentAssembler.ToEntity(item); objEntity1.d_InsertDate = DateTime.Now; objEntity1.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity1.i_IsDeleted = 0; var NewId1 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 21), "PC"); objEntity1.v_ProtocolComponentId = NewId1; objEntity1.v_ProtocolId = pobjProtocol.v_ProtocolId == null ? NewId0 : pobjProtocol.v_ProtocolId; dbContext.AddToprotocolcomponent(objEntity1); dbContext.SaveChanges(); } pobjOperationResult.Success = 1; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log } return(NewId0); }
public void AddNodeOrganizationLoactionWarehouse(ref OperationResult pobjOperationResult, NodeOrganizationLoactionWarehouseList pobjNodeOrgLocationWarehouse, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseList, List <string> ClientSession) { //mon.IsActive = true; nodeorganizationprofile objNodeorganizationprofile = new nodeorganizationprofile(); nodeorganizationlocationprofile objNodeorganizationlocationprofile = new nodeorganizationlocationprofile(); try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); OperationResult objOperationResult5 = new OperationResult(); if (pobjWarehouseList != null) { if (IsWarehouseAssignedToNode(ref objOperationResult5, pobjWarehouseList)) { pobjOperationResult = objOperationResult5; return; } } var objEntitySource = (from a in dbContext.nodeorganizationlocationprofile join c in dbContext.nodeorganizationlocationprofile on a.i_NodeId equals c.i_NodeId where a.i_NodeId == pobjNodeOrgLocationWarehouse.i_NodeId && a.v_OrganizationId == pobjNodeOrgLocationWarehouse.v_OrganizationId && c.v_LocationId == pobjNodeOrgLocationWarehouse.v_LocationId select a).FirstOrDefault(); if (objEntitySource != null) { // Actualizar registro (dar de alta al registro ya existente "no volver a insertar") OperationResult objOperationResult2 = new OperationResult(); UpdateNodeOrganizationChangeStatusAll(ref objOperationResult2, pobjNodeOrgLocationWarehouse.i_NodeId, pobjNodeOrgLocationWarehouse.v_OrganizationId, pobjNodeOrgLocationWarehouse.v_LocationId, 0, ClientSession); pobjOperationResult = objOperationResult2; } else { var query = (from a in dbContext.nodeorganizationlocationprofile where a.i_NodeId == pobjNodeOrgLocationWarehouse.i_NodeId && a.v_OrganizationId == pobjNodeOrgLocationWarehouse.v_OrganizationId select a).FirstOrDefault(); // Grabar nuevo if (query == null) { #region Nodeorganization // Grabar nodo / empresa objNodeorganizationprofile.d_InsertDate = DateTime.Now; objNodeorganizationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationprofile.i_IsDeleted = 0; objNodeorganizationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; dbContext.AddTonodeorganizationprofile(objNodeorganizationprofile); dbContext.SaveChanges(); #endregion #region Nodeorganizationlocation // Grabar nodo / empresa / sede objNodeorganizationlocationprofile.d_InsertDate = DateTime.Now; objNodeorganizationlocationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationlocationprofile.i_IsDeleted = 0; objNodeorganizationlocationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationlocationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; objNodeorganizationlocationprofile.v_LocationId = pobjNodeOrgLocationWarehouse.v_LocationId; dbContext.AddTonodeorganizationlocationprofile(objNodeorganizationlocationprofile); dbContext.SaveChanges(); #endregion #region Add Warehouse // Graba almacenes OperationResult objOperationResult1 = new OperationResult(); if (pobjWarehouseList != null) { AddWarehouse(ref objOperationResult1, pobjWarehouseList, ClientSession); } #endregion } else { #region Nodeorganizationlocation // Grabar nodo / empresa / sede objNodeorganizationlocationprofile.d_InsertDate = DateTime.Now; objNodeorganizationlocationprofile.i_InsertUserId = Int32.Parse(ClientSession[2]); objNodeorganizationlocationprofile.i_IsDeleted = 0; objNodeorganizationlocationprofile.i_NodeId = pobjNodeOrgLocationWarehouse.i_NodeId; objNodeorganizationlocationprofile.v_OrganizationId = pobjNodeOrgLocationWarehouse.v_OrganizationId; objNodeorganizationlocationprofile.v_LocationId = pobjNodeOrgLocationWarehouse.v_LocationId; dbContext.AddTonodeorganizationlocationprofile(objNodeorganizationlocationprofile); dbContext.SaveChanges(); #endregion #region Add Warehouse // Graba almacenes OperationResult objOperationResult1 = new OperationResult(); if (pobjWarehouseList != null) { AddWarehouse(ref objOperationResult1, pobjWarehouseList, ClientSession); } #endregion } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + objNodeorganizationprofile.v_OrganizationId, Success.Ok, null); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + objNodeorganizationprofile.v_OrganizationId, Success.Failed, pobjOperationResult.ExceptionMessage); } }
public List <Sigesoft.Node.WinClient.BE.ProtocolList> GetProtocolPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.protocol join B in dbContext.organization on A.v_EmployerOrganizationId equals B.v_OrganizationId join C in dbContext.location on A.v_EmployerLocationId equals C.v_LocationId join D in dbContext.groupoccupation on A.v_GroupOccupationId equals D.v_GroupOccupationId join E in dbContext.systemparameter on new { a = A.i_EsoTypeId.Value, b = 118 } equals new { a = E.i_ParameterId, b = E.i_GroupId } into J3_join from E in J3_join.DefaultIfEmpty() join F in dbContext.organization on A.v_CustomerOrganizationId equals F.v_OrganizationId join I in dbContext.location on A.v_CustomerLocationId equals I.v_LocationId join G in dbContext.organization on A.v_WorkingOrganizationId equals G.v_OrganizationId into J4_join from G in J4_join.DefaultIfEmpty() join J in dbContext.location on A.v_WorkingLocationId equals J.v_LocationId into J6_join from J in J6_join.DefaultIfEmpty() join H in dbContext.systemparameter on new { a = A.i_MasterServiceId.Value, b = 119 } equals new { a = H.i_ParameterId, b = H.i_GroupId } into J5_join from H 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 Sigesoft.Node.WinClient.BE.ProtocolList { v_ProtocolId = A.v_ProtocolId, v_Protocol = A.v_Name, v_Organization = B.v_Name + " / " + C.v_Name, v_Location = C.v_Name, v_EsoType = E.v_Value1, v_GroupOccupation = D.v_Name, v_OrganizationInvoice = F.v_Name + " / " + I.v_Name, v_CostCenter = A.v_CostCenter, v_IntermediaryOrganization = G.v_Name + " / " + J.v_Name, i_ServiceTypeId = A.i_MasterServiceTypeId.Value, v_MasterServiceName = H.v_Value1, i_MasterServiceId = A.i_MasterServiceId.Value, v_OrganizationId = F.v_OrganizationId + "|" + I.v_LocationId, i_EsoTypeId = A.i_EsoTypeId, v_WorkingOrganizationId = G.v_OrganizationId, v_OrganizationInvoiceId = F.v_OrganizationId, v_GroupOccupationId = D.v_GroupOccupationId, v_CreationUser = J1.v_UserName, v_UpdateUser = J2.v_UserName, d_CreationDate = A.d_InsertDate, d_UpdateDate = A.d_UpdateDate, v_LocationId = A.v_EmployerLocationId, v_CustomerLocationId = A.v_CustomerLocationId, v_WorkingLocationId = A.v_WorkingLocationId, i_IsActive = A.i_IsActive }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } 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 <Sigesoft.Node.WinClient.BE.ProtocolList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); return(null); } }
public void UpdateNodeOrganizationChangeStatusAll(ref OperationResult pobjOperationResult, int pintNodeId, string pstrOrganizationId, string pstrLocationId, int pintIsDeleted, List <string> ClientSession) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region nodeOrganization // Obtener la entidad fuente var objnodeOrganization = (from a in dbContext.nodeorganizationprofile where a.i_NodeId == pintNodeId && a.v_OrganizationId == pstrOrganizationId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objnodeOrganization.d_UpdateDate = DateTime.Now; objnodeOrganization.i_UpdateUserId = Int32.Parse(ClientSession[2]); objnodeOrganization.i_IsDeleted = pintIsDeleted; // Guardar los cambios dbContext.SaveChanges(); #endregion #region nodeOrganizationLocation // Obtener la entidad fuente var objnodeOrganizationLocation = (from a in dbContext.nodeorganizationlocationprofile where a.i_NodeId == pintNodeId && a.v_OrganizationId == pstrOrganizationId && a.v_LocationId == pstrLocationId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objnodeOrganizationLocation.d_UpdateDate = DateTime.Now; objnodeOrganizationLocation.i_UpdateUserId = Int32.Parse(ClientSession[2]); objnodeOrganizationLocation.i_IsDeleted = pintIsDeleted; // Guardar los cambios dbContext.SaveChanges(); #endregion #region Warehouse // Obtener la entidad fuente var objWarehouse = (from a in dbContext.nodeorganizationlocationwarehouseprofile where a.i_NodeId == pintNodeId && a.v_OrganizationId == pstrOrganizationId && a.v_LocationId == pstrLocationId select a).ToList(); if (objWarehouse != null) { foreach (var item in objWarehouse) { item.d_UpdateDate = DateTime.Now; item.i_UpdateUserId = Int32.Parse(ClientSession[2]); item.i_IsDeleted = pintIsDeleted; } // Guardar los cambios dbContext.SaveChanges(); } #endregion // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + pstrOrganizationId, Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + pstrOrganizationId, Success.Failed, pobjOperationResult.ExceptionMessage); } }
public List <SystemParameterList> GetSystemParametersPagedAndFilteredNew(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, int?pintGroupId) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.systemparameter join B in dbContext.systemparameter on new { a = A.i_ParentParameterId.Value, b = A.i_GroupId } equals new { a = B.i_ParameterId, b = 147 } into B_join from B in B_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() join J3 in dbContext.diseases on new { a = A.v_Value1 } equals new { a = J3.v_DiseasesId } into J3_join from J3 in J3_join.DefaultIfEmpty() where B.i_GroupId == pintGroupId && B.i_IsDeleted == 0 select new SystemParameterList { i_GroupId = A.i_GroupId, i_ParameterId = A.i_ParameterId, i_ParentGroupId = A.i_GroupId, i_ParentParameterId = A.i_ParentParameterId.Value, v_Value1 = A.v_Value1, v_Value2 = A.v_Value2, v_DiseasesName = J3.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, Enfermedad = B.v_Value1, v_DiseaseName = J3.v_Name, SI = false, NO = true, ND = false, i_Answer = 0 }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } if (!string.IsNullOrEmpty(pstrSortExpression)) { query = query.OrderBy(pstrSortExpression); } if (pintPageIndex.HasValue && pintResultsPerPage.HasValue) { int intStartRowIndex = pintPageIndex.Value * pintResultsPerPage.Value; query = query.Skip(intStartRowIndex); query = query.Take(pintResultsPerPage.Value); } List <SystemParameterList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; return(null); } }
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); } }
//Devart.Data.PostgreSql.PgSqlMonitor mon = new Devart.Data.PostgreSql.PgSqlMonitor(); public List <LogList> GetLogsPagedAndFiltered(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, DateTime?pdatBeginDate, DateTime?pdatEndDate) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var query = from A in dbContext.log join B in dbContext.node on A.i_NodeLogId equals B.i_NodeId join C in dbContext.organization on A.v_OrganizationId equals C.v_OrganizationId into C_join from C in C_join.DefaultIfEmpty() join D in dbContext.systemuser on A.i_SystemUserId equals D.i_SystemUserId into D_join from D in D_join.DefaultIfEmpty() join J1 in dbContext.systemparameter on new { a = 102, b = A.i_EventTypeId.Value } equals new { a = J1.i_GroupId, b = J1.i_ParameterId } join J2 in dbContext.systemparameter on new { a = 111, b = A.i_Success.Value } equals new { a = J2.i_GroupId, b = J2.i_ParameterId } select new LogList { v_LogId = A.v_LogId, i_EventTypeId = A.i_EventTypeId.Value, v_EventTypeName = J1.v_Value1, i_NodeId = A.i_NodeLogId.Value, v_NodeName = B.v_Description, v_OrganizationId = A.v_OrganizationId, v_OrganizationName = C.v_Name, i_SystemUserId = A.i_SystemUserId.Value, v_SystemUserName = D.v_UserName, d_Date = A.d_Date.Value, v_ProcessEntity = A.v_ProcessEntity, v_ElementItem = A.v_ElementItem, i_Success = A.i_Success.Value, v_SuccessName = J2.v_Value1, v_ErrorException = A.v_ErrorException }; if (!string.IsNullOrEmpty(pstrFilterExpression)) { query = query.Where(pstrFilterExpression); } if (pdatBeginDate.HasValue && pdatEndDate.HasValue) { query = query.Where("d_Date >= @0 && d_Date <= @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 <LogList> objData = query.ToList(); pobjOperationResult.Success = 1; return(objData); } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; return(null); } }