public void UpdAdulto(ref OperationResult objOperationResult, adultoDto objAdultDto, List <string> ClientSession) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); var objEntitySource = (from a in dbContext.adulto where a.v_AdultoId == objAdultDto.v_AdultoId select a).FirstOrDefault(); objAdultDto.d_UpdateDate = DateTime.Now; objAdultDto.i_UpdateUserId = Int32.Parse(ClientSession[2]); var objStrongEntity = adultoAssembler.ToEntity(objAdultDto); dbContext.adulto.ApplyCurrentValues(objStrongEntity); objOperationResult.Success = 1; dbContext.SaveChanges(); LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "AD / UPD", "v_AdultoId=" + objAdultDto.v_AdultoId, Success.Ok, null); return; } catch (Exception ex) { objOperationResult.Success = 0; objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "AD / UPD", "v_AdultoId=" + objAdultDto.v_AdultoId, Success.Failed, objOperationResult.ExceptionMessage); return; } }
public string AddAdultoMayor(ref OperationResult objOperationResult, adultomayorDto objAdultMayDto, List <string> ClientSession) { string NewId0 = null; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); adultomayor objEntity = adultomayorAssembler.ToEntity(objAdultMayDto); objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; int intNodeId = int.Parse(ClientSession[0]); NewId0 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 355), "AM");; objEntity.v_AdultoMayorId = NewId0; dbContext.AddToadultomayor(objEntity); dbContext.SaveChanges(); objOperationResult.Success = 1; LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "AM", "v_AdultoMayorId=" + NewId0.ToString(), Success.Ok, null); } catch (Exception ex) { objOperationResult.Success = 0; objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "AM", "v_AdultoMayorId=" + NewId0.ToString(), Success.Failed, objOperationResult.ExceptionMessage); } return(NewId0); }
public void AddGES(ref OperationResult pobjOperationResult, gesDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); ges objEntity = gesAssembler.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, 12), "OE");; objEntity.v_GesId = NewId; dbContext.AddToges(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "GES", "v_GesId=" + 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, "GES", "v_GesId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void DeleteGES(ref OperationResult pobjOperationResult, string pstrGesId, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.ges where a.v_GesId == pstrGesId 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, "GES", "", 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, "GES", "", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void AddSystemParameter(ref OperationResult pobjOperationResult, systemparameterDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); systemparameter objEntity = systemparameterAssembler.ToEntity(pobjDtoEntity); objEntity.d_InsertDate = DateTime.Now; objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]); objEntity.i_IsDeleted = 0; dbContext.AddTosystemparameter(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "PARÁMETRO", "GroupId=" + objEntity.i_GroupId.ToString() + " / Descripción = " + objEntity.v_Value1, Success.Ok, null); return; } catch (Exception ex) { pobjOperationResult.Success = 0; pobjOperationResult.ExceptionMessage = ex.Message; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "PARÁMETRO", "GroupId=" + pobjDtoEntity.i_GroupId.ToString() + " / Descripción = " + pobjDtoEntity.v_Value1, Success.Failed, ex.Message); return; } }
public string AddMedicalExamFieldValues(ref OperationResult pobjOperationResult, List <ComponentFieldValuesRestrictionList> ComponentFieldValuesRestrictionList, List <ComponentFieldValuesRecommendationList> ComponentFieldValuesRecommendationList, componentfieldvaluesDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); componentfieldvalues objEntity = componentfieldvaluesAssembler.ToEntity(pobjDtoEntity); componentfieldvaluesrestrictionDto objcomponentfieldvaluesrestrictionDto = new componentfieldvaluesrestrictionDto(); componentfieldvaluesrecommendationDto objcomponentfieldvaluesrecommendationDto = new componentfieldvaluesrecommendationDto(); 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, 19), "MV"); objEntity.v_ComponentFieldValuesId = NewId; dbContext.AddTocomponentfieldvalues(objEntity); dbContext.SaveChanges(); if (ComponentFieldValuesRestrictionList != null) { for (int i = 0; i < ComponentFieldValuesRestrictionList.Count; i++) { objcomponentfieldvaluesrestrictionDto.v_ComponentFieldValuesId = NewId; objcomponentfieldvaluesrestrictionDto.v_MasterRecommendationRestricctionId = ComponentFieldValuesRestrictionList[i].v_MasterRecommendationRestricctionId; AddRestriction(ref pobjOperationResult, objcomponentfieldvaluesrestrictionDto, ClientSession); } } if (ComponentFieldValuesRecommendationList != null) { for (int i = 0; i < ComponentFieldValuesRecommendationList.Count; i++) { objcomponentfieldvaluesrecommendationDto.v_ComponentFieldValuesId = NewId; objcomponentfieldvaluesrecommendationDto.v_ComponentFieldValuesRecommendationId = ComponentFieldValuesRecommendationList[i].v_MasterRecommendationRestricctionId; AddRecommendation(ref pobjOperationResult, objcomponentfieldvaluesrecommendationDto, ClientSession); } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO CAMPO VALOR", "v_MedicalExamFieldValuesId=" + 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 VALOR", "v_MedicalExamFieldValuesId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return(null); } }
public void UpdateMedicalExam(ref OperationResult pobjOperationResult, bool pbIsChangeName, componentDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region Validar Nombre de componente if (pobjDtoEntity != null && pbIsChangeName == true) { OperationResult objOperationResult6 = new OperationResult(); string strfilterExpression1 = string.Format("v_Name==\"{0}\"&&i_Isdeleted==0", pobjDtoEntity.v_Name); var _recordCount1 = GetMedicalExamCount(ref objOperationResult6, strfilterExpression1); if (_recordCount1 != 0) { pobjOperationResult.ErrorMessage = "El nombre del componente ya existe"; return; } } #endregion // Obtener la entidad fuente var objEntitySource = (from a in dbContext.component where a.v_ComponentId == pobjDtoEntity.v_ComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); component objEntity = componentAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.component.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO", "v_MedicalExamId=" + objEntity.v_ComponentId.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", "v_MedicalExamId=" + pobjDtoEntity.v_ComponentId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
private void AddWarehouse(ref OperationResult pobjOperationResult, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseList, List <string> ClientSession) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); nodeorganizationlocationwarehouseprofile objnodeorganizationlocationwarehouseprofile = null; // Grabar almacén foreach (var item in pobjWarehouseList) { var objEntitySource = (from a in dbContext.nodeorganizationlocationwarehouseprofile where a.i_NodeId == item.i_NodeId && a.v_OrganizationId == item.v_OrganizationId && a.v_LocationId == item.v_LocationId && a.v_WarehouseId == item.v_WarehouseId select a).FirstOrDefault(); if (objEntitySource != null) { objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource.i_IsDeleted = 0; // Guardar los cambios dbContext.SaveChanges(); } else { objnodeorganizationlocationwarehouseprofile = nodeorganizationlocationwarehouseprofileAssembler.ToEntity(item); objnodeorganizationlocationwarehouseprofile.d_InsertDate = DateTime.Now; objnodeorganizationlocationwarehouseprofile.i_InsertUserId = int.Parse(ClientSession[2]); objnodeorganizationlocationwarehouseprofile.i_IsDeleted = 0; dbContext.AddTonodeorganizationlocationwarehouseprofile(objnodeorganizationlocationwarehouseprofile); dbContext.SaveChanges(); } } pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "", "", 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, "", "", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public string[] AddMultimediaFileComponent(ref OperationResult pobjOperationResult, FileInfoDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string[] IDs = new string[2]; var multimediaFileId = string.Empty; var serviceComponentMultimediaId = string.Empty; try { multimediafileDto multimediaFile = new multimediafileDto(); multimediaFile.v_PersonId = pobjDtoEntity.PersonId; multimediaFile.v_FileName = pobjDtoEntity.FileName; multimediaFile.b_File = pobjDtoEntity.ByteArrayFile; multimediaFile.b_ThumbnailFile = pobjDtoEntity.ThumbnailFile; // Grabar MultimediaFile multimediaFileId = AddMultimediaFile(ref pobjOperationResult, multimediaFile, ClientSession, SiNo.NO); if (pobjOperationResult.Success == 0) { return(null); } servicecomponentmultimediaDto serviceComponentMultimedia = new servicecomponentmultimediaDto(); serviceComponentMultimedia.v_ServiceComponentId = pobjDtoEntity.ServiceComponentId; serviceComponentMultimedia.v_MultimediaFileId = multimediaFileId; serviceComponentMultimedia.v_Comment = pobjDtoEntity.Description; // Grabar MultimediaFileComponent serviceComponentMultimediaId = AddServiceComponentMultimedia(ref pobjOperationResult, serviceComponentMultimedia, ClientSession, SiNo.NO); if (pobjOperationResult.Success == 0) { return(null); } IDs[0] = multimediaFileId; IDs[1] = serviceComponentMultimediaId; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "MULTIMEDIA FILE", null, 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, "MULTIMEDIA FILE", null, Success.Failed, pobjOperationResult.ExceptionMessage); } return(IDs); }
public bool UpdateComponentFields(ref OperationResult pobjOperationResult, componentfieldsDto pobjDtoEntity, string pstrTextLableOld, string pstrTextLableNew, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); if (pstrTextLableOld.ToUpper().Trim() != pstrTextLableNew.ToUpper().Trim()) { 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() == pstrTextLableNew.ToUpper() && b.v_ComponentId == pobjDtoEntity.v_ComponentId && b.v_Group == pobjDtoEntity.v_Group select a).ToList(); if (query1.Count > 0) { pobjOperationResult.ErrorMessage = "Nombre del componente duplicado"; return(false); } } // Obtener la entidad fuente var objEntitySource = (from a in dbContext.componentfields where a.v_ComponentFieldId == pobjDtoEntity.v_ComponentFieldId && a.v_ComponentId == pobjDtoEntity.v_ComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); componentfields objEntity = componentfieldsAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.componentfields.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "CAMPOS DEL COMPONENTE", "v_ComponentId=" + objEntity.v_ComponentId + "v_ComponentFieldId= " + objEntity.v_ComponentFieldId, Success.Ok, null); return(true); } 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, "CAMPOS DEL COMPONENTE", "v_ComponentId= No generado ,v_ComponentFieldId= No generado ", Success.Failed, pobjOperationResult.ExceptionMessage); return(false); } }
public void UpdateMedicalExamField(ref OperationResult pobjOperationResult, componentfieldDto pobjDtoEntity, string pstComponentId, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente componentfield var objEntitySource = (from a in dbContext.componentfield where a.v_ComponentFieldId == pobjDtoEntity.v_ComponentFieldId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); componentfield objEntity = componentfieldAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.componentfield.ApplyCurrentValues(objEntity); dbContext.componentfield.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); // Obtener la entidad fuente componentfields var objEntitySource1 = (from a in dbContext.componentfields where a.v_ComponentFieldId == pobjDtoEntity.v_ComponentFieldId && a.v_ComponentId == pstComponentId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EXAMEN MÉDICO CAMPO", "v_MedicalExamFieldsId=" + objEntity.v_ComponentFieldId.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", "v_MedicalExamFieldsId=" + pobjDtoEntity.v_ComponentFieldId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public string AddTicket(ref OperationResult objOperationResult, ticketDto objticketDto, List <ticketdetalleDto> pobjticketdetalleDto, List <string> ClientSession) { string NewId0 = null; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); ticket objEntity = ticketAssembler.ToEntity(objticketDto); 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]); NewId0 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 345), "TK");; objEntity.v_TicketId = NewId0; dbContext.AddToticket(objEntity); dbContext.SaveChanges(); foreach (var item in pobjticketdetalleDto) { ticketdetalle objEntity1 = ticketdetalleAssembler.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, 346), "KD"); objEntity1.v_TicketDetalleId = NewId1; objEntity1.v_TicketId = NewId0; dbContext.AddToticketdetalle(objEntity1); dbContext.SaveChanges(); } objOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "TK", "v_TicketId=" + NewId0.ToString(), Success.Ok, null); } catch (Exception ex) { objOperationResult.Success = 0; objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "TK", "v_TicketId=" + NewId0.ToString(), Success.Failed, objOperationResult.ExceptionMessage); } return(NewId0); }
public void AddMedicalExam(ref OperationResult pobjOperationResult, componentDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); component objEntity = componentAssembler.ToEntity(pobjDtoEntity); //var query = from A in dbContext.component var Result = (from A in dbContext.component where A.i_IsDeleted == 0 && A.v_Name == pobjDtoEntity.v_Name select A).FirstOrDefault(); if (Result != null) { pobjOperationResult.ErrorMessage = "El nombre ya se encuentra registrado"; pobjOperationResult.Success = 0; return; } 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, 17), "ME"); objEntity.v_ComponentId = NewId; dbContext.AddTocomponent(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "EXAMEN MÉDICO", "v_MedicalExamId=" + 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, "EXAMEN MÉDICO", "v_MedicalExamId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void UpdateNodeOrganizationLoactionWarehouse(ref OperationResult pobjOperationResult, NodeOrganizationLoactionWarehouseList pobjNodeOrgLocationWarehouse, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseListAdd, List <nodeorganizationlocationwarehouseprofileDto> pobjWarehouseListDel, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region Warehouse -> Add / Del // Eliminar Almacenes if (pobjWarehouseListDel != null) { OperationResult objOperationResult1 = new OperationResult(); DeleteWarehouse(ref objOperationResult1, pobjWarehouseListDel, ClientSession); } // Graba almacenes if (pobjWarehouseListAdd != null) { OperationResult objOperationResult3 = new OperationResult(); if (IsWarehouseAssignedToNode(ref objOperationResult3, pobjWarehouseListAdd)) { pobjOperationResult = objOperationResult3; return; } OperationResult objOperationResult2 = new OperationResult(); AddWarehouse(ref objOperationResult2, pobjWarehouseListAdd, ClientSession); } #endregion pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "EMPRESA / SEDE / ALMACÉN", "v_OrganizationId=" + pobjNodeOrgLocationWarehouse.v_OrganizationId, 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=" + pobjNodeOrgLocationWarehouse.v_OrganizationId, Success.Failed, pobjOperationResult.ExceptionMessage); } }
public void UpdateMasterRecommendationRestricction(ref OperationResult pobjOperationResult, masterrecommendationrestricctionDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.masterrecommendationrestricction where a.v_MasterRecommendationRestricctionId == pobjDtoEntity.v_MasterRecommendationRestricctionId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.v_Name = pobjDtoEntity.v_Name; pobjDtoEntity.i_TypifyingId = objEntitySource.i_TypifyingId; pobjDtoEntity.i_IsDeleted = 1; pobjDtoEntity.i_InsertUserId = objEntitySource.i_InsertUserId; pobjDtoEntity.d_InsertDate = objEntitySource.d_InsertDate; pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); masterrecommendationrestricction objEntity = masterrecommendationrestricctionAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.masterrecommendationrestricction.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "RECOMENDACIÓN / RESTRICCIÓN", "v_MasterRecommendationRestricctionId=" + objEntity.v_MasterRecommendationRestricctionId.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, "RECOMENDACIÓN / RESTRICCIÓN", "v_MasterRecommendationRestricctionId=" + pobjDtoEntity.v_MasterRecommendationRestricctionId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void UpdateMultimediaFileComponent(ref OperationResult pobjOperationResult, FileInfoDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { multimediafileDto multimediaFile = new multimediafileDto(); multimediaFile.v_MultimediaFileId = pobjDtoEntity.MultimediaFileId; multimediaFile.v_FileName = pobjDtoEntity.FileName; multimediaFile.b_File = pobjDtoEntity.ByteArrayFile; multimediaFile.b_ThumbnailFile = pobjDtoEntity.ThumbnailFile; // Actualizar MultimediaFile UpdateMultimediaFile(ref pobjOperationResult, multimediaFile, ClientSession, SiNo.NO); if (pobjOperationResult.Success == 0) { return; } servicecomponentmultimediaDto serviceComponentMultimedia = new servicecomponentmultimediaDto(); serviceComponentMultimedia.v_ServiceComponentMultimediaId = pobjDtoEntity.ServiceComponentMultimediaId; serviceComponentMultimedia.v_Comment = pobjDtoEntity.Description; // Actualizar MultimediaFileComponent UpdateServiceComponentMultimedia(ref pobjOperationResult, serviceComponentMultimedia, ClientSession, SiNo.NO); if (pobjOperationResult.Success == 0) { return; } // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "MULTIMEDIA FILE", null, 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, "MULTIMEDIA FILE", null, Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
private void UpdateMultimediaFile(ref OperationResult pobjOperationResult, multimediafileDto pobjDtoEntity, List <string> ClientSession, SiNo ExecLog) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.multimediafile where a.v_MultimediaFileId == pobjDtoEntity.v_MultimediaFileId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySource.v_FileName = pobjDtoEntity.v_FileName; if (pobjDtoEntity.b_File != null) { objEntitySource.b_File = pobjDtoEntity.b_File; } objEntitySource.b_ThumbnailFile = pobjDtoEntity.b_ThumbnailFile; objEntitySource.d_UpdateDate = DateTime.Now; objEntitySource.i_UpdateUserId = Int32.Parse(ClientSession[2]); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; if (ExecLog == SiNo.SI) { // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "MULTIMEDIA FILE", "v_MultimediaFileId=" + pobjDtoEntity.v_MultimediaFileId, 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, "MULTIMEDIA FILE", "v_MultimediaFileId=" + pobjDtoEntity.v_MultimediaFileId, Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
private string AddServiceComponentMultimedia(ref OperationResult pobjOperationResult, servicecomponentmultimediaDto pobjDtoEntity, List <string> ClientSession, SiNo ExecLog) { //mon.IsActive = true; string NewId = "(No generado)"; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); servicecomponentmultimedia objEntity = servicecomponentmultimediaAssembler.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, 46), "FC"); objEntity.v_ServiceComponentMultimediaId = NewId; dbContext.AddToservicecomponentmultimedia(objEntity); dbContext.SaveChanges(); pobjOperationResult.Success = 1; if (ExecLog == SiNo.SI) { // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "SERVICE COMPONENT MULTIMEDIA", "v_ServiceComponentMultimediaId=" + NewId.ToString(), 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, "SERVICE COMPONENT MULTIMEDIA", "v_ServiceComponentMultimediaId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); } return(NewId); }
//public List<authorizedpersonDto> GetAuthorizedPersonAccess(ref OperationResult pobjOperationResult, string pstrNameOrOrganitation) //{ // //mon.IsActive = true; // try // { // SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // authorizedpersonDto objDtoEntity = null; // var objEntity = (from A in dbContext.authorizedperson // where ((A.v_FirstName + " " + A.v_FirstLastName + " " + A.v_SecondLastName).Contains(pstrNameOrOrganitation)) || A.v_OrganitationName.Contains(pstrNameOrOrganitation) // select A); // List<AuthorizedPersonList> objData = objEntity.ToList(); // pobjOperationResult.Success = 1; // return objData; // pobjOperationResult.Success = 1; // return objDtoEntity; // } // catch (Exception ex) // { // pobjOperationResult.Success = 0; // pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); // return null; // } //} public void UpdateAuthorizedPerson(ref OperationResult pobjOperationResult, authorizedpersonDto pobjDtoEntity, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); // Obtener la entidad fuente var objEntitySource = (from a in dbContext.authorizedperson where a.v_AuthorizedPersonId == pobjDtoEntity.v_AuthorizedPersonId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados pobjDtoEntity.d_UpdateDate = DateTime.Now; pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]); authorizedperson objEntity = authorizedpersonAssembler.ToEntity(pobjDtoEntity); // Copiar los valores desde la entidad actualizada a la Entidad Fuente dbContext.authorizedperson.ApplyCurrentValues(objEntity); // Guardar los cambios dbContext.SaveChanges(); pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "PERSONAS AUTORIZADAS", "v_AuthorizedPersonId=" + objEntity.v_AuthorizedPersonId.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, "PERSONAS AUTORIZADAS", "v_AuthorizedPersonId=" + pobjDtoEntity.v_AuthorizedPersonId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
public void DeleteServiceOrder(ref OperationResult pobjOperationResult, string v_ServiceOrderId, List <string> ClientSession) { //mon.IsActive = true; try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region Service Order // Obtener la entidad fuente var objEntitySource = (from a in dbContext.serviceorder where a.v_ServiceOrderId == v_ServiceOrderId 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; #endregion #region Service Order Detail var Lista = (from a in dbContext.serviceorderdetail where a.v_ServiceOrderId == v_ServiceOrderId select a).ToList(); // Obtener la entidad fuente foreach (var item in Lista) { var objEntitySourceDetail = (from a in dbContext.serviceorderdetail where a.v_ServiceOrderDetailId == item.v_ServiceOrderDetailId select a).FirstOrDefault(); // Crear la entidad con los datos actualizados objEntitySourceDetail.d_UpdateDate = DateTime.Now; objEntitySourceDetail.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySourceDetail.i_IsDeleted = 1; dbContext.SaveChanges(); } #endregion // Guardar los cambios pobjOperationResult.Success = 1; // Llenar entidad Log LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ELIMINACION, "ORDEN DE SERVICIO", "", 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, "ORDEN DE SERVICIO", "", Success.Failed, pobjOperationResult.ExceptionMessage); return; } }
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 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 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 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 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 void UpdateTicket(ref OperationResult _pobjOperationResult, ticketDto objticketDto, List <ticketdetalleDto> _ticketdetalleDTOAdd, List <ticketdetalleDto> _ticketdetalleDTOUpdate, List <ticketdetalleDto> _ticketdetalleDTODelete, List <string> ClientSession) { try { SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel(); #region Actualizar ticket var objEntitySource = (from a in dbContext.ticket where a.v_TicketId == objticketDto.v_TicketId select a).FirstOrDefault(); objticketDto.d_UpdateDate = DateTime.Now; if (objEntitySource.d_InsertDate == null || objEntitySource.i_InsertUserId == null) { objticketDto.d_InsertDate = DateTime.Now; objticketDto.i_InsertUserId = Int32.Parse(ClientSession[2]); } else { objticketDto.d_InsertDate = objEntitySource.d_InsertDate; objticketDto.i_InsertUserId = objEntitySource.i_InsertUserId; } objticketDto.i_UpdateUserId = Int32.Parse(ClientSession[2]); objticketDto.i_IsDeleted = 0; ticket objStrongEntity = ticketAssembler.ToEntity(objticketDto); dbContext.ticket.ApplyCurrentValues(objStrongEntity); dbContext.SaveChanges(); #endregion int intNodeId = int.Parse(ClientSession[0]); #region add detalle foreach (var item in _ticketdetalleDTOAdd) { ticketdetalle objEntity1 = ticketdetalleAssembler.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, 346), "KD"); objEntity1.v_TicketDetalleId = NewId1; objEntity1.v_TicketId = objticketDto.v_TicketId; dbContext.AddToticketdetalle(objEntity1); dbContext.SaveChanges(); } #endregion #region upd detalle if (_ticketdetalleDTOUpdate != null) { foreach (var item in _ticketdetalleDTOUpdate) { var updatedetalleticket = (from a in dbContext.ticketdetalle where a.v_TicketDetalleId == item.v_TicketDetalleId select a).FirstOrDefault(); //objEntitySource1.v_ComponentId = item.v_ComponentId; updatedetalleticket.d_Cantidad = item.d_Cantidad; updatedetalleticket.i_EsDespachado = item.i_EsDespachado; updatedetalleticket.d_SaldoAseguradora = item.d_SaldoAseguradora; updatedetalleticket.d_SaldoPaciente = item.d_SaldoPaciente; updatedetalleticket.i_IsDeleted = 0; updatedetalleticket.d_UpdateDate = DateTime.Now; updatedetalleticket.i_UpdateUserId = Int32.Parse(ClientSession[2]); dbContext.SaveChanges(); } } #endregion #region del detalle if (_ticketdetalleDTODelete != null) { foreach (var item in _ticketdetalleDTODelete) { var objEntitySource1 = (from a in dbContext.ticketdetalle where a.v_TicketDetalleId == item.v_TicketDetalleId select a).FirstOrDefault(); objEntitySource1.d_UpdateDate = DateTime.Now; objEntitySource1.i_UpdateUserId = Int32.Parse(ClientSession[2]); objEntitySource1.i_IsDeleted = 1; dbContext.SaveChanges(); } } #endregion //dbContext.SaveChanges(); _pobjOperationResult.Success = 1; LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "TICKET / DETALLE", "v_TicketId=" + objticketDto.v_TicketId.ToString(), Success.Ok, null); return; } catch (Exception ex) { _pobjOperationResult.Success = 0; _pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex); LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "TICKET / DETALLE", "v_TicketId=" + objticketDto.v_TicketId.ToString(), Success.Failed, _pobjOperationResult.ExceptionMessage); return; } }
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; } }