/// <summary> /// Converts this instance of <see cref="medico"/> to an instance of <see cref="medicoDto"/>. /// </summary> /// <param name="entity"><see cref="medico"/> to convert.</param> public static medicoDto ToDTO(this medico entity) { if (entity == null) { return(null); } var dto = new medicoDto(); dto.v_MedicoId = entity.v_MedicoId; dto.i_MasterServiceId = entity.i_MasterServiceId; dto.i_SystemUserId = entity.i_SystemUserId; dto.i_MasterServiceTypeId = entity.i_MasterServiceTypeId; dto.r_Clinica = entity.r_Clinica; dto.r_Medico = entity.r_Medico; dto.i_CategoryId = entity.i_CategoryId; dto.r_Price = entity.r_Price; dto.v_EmployerOrganizationId = entity.v_EmployerOrganizationId; dto.v_CustomerOrganizationId = entity.v_CustomerOrganizationId; dto.v_WorkingOrganizationId = entity.v_WorkingOrganizationId; dto.i_IsDeleted = entity.i_IsDeleted; dto.i_InsertUserId = entity.i_InsertUserId; dto.d_InsertDate = entity.d_InsertDate; dto.i_UpdateUserId = entity.i_UpdateUserId; dto.d_UpdateDate = entity.d_UpdateDate; entity.OnDTO(dto); return(dto); }
/// <summary> /// Converts this instance of <see cref="medicoDto"/> to an instance of <see cref="medico"/>. /// </summary> /// <param name="dto"><see cref="medicoDto"/> to convert.</param> public static medico ToEntity(this medicoDto dto) { if (dto == null) { return(null); } var entity = new medico(); entity.v_MedicoId = dto.v_MedicoId; entity.i_MasterServiceId = dto.i_MasterServiceId; entity.i_SystemUserId = dto.i_SystemUserId; entity.i_MasterServiceTypeId = dto.i_MasterServiceTypeId; entity.r_Clinica = dto.r_Clinica; entity.r_Medico = dto.r_Medico; entity.i_CategoryId = dto.i_CategoryId; entity.r_Price = dto.r_Price; entity.v_EmployerOrganizationId = dto.v_EmployerOrganizationId; entity.v_CustomerOrganizationId = dto.v_CustomerOrganizationId; entity.v_WorkingOrganizationId = dto.v_WorkingOrganizationId; entity.i_IsDeleted = dto.i_IsDeleted; entity.i_InsertUserId = dto.i_InsertUserId; entity.d_InsertDate = dto.d_InsertDate; entity.i_UpdateUserId = dto.i_UpdateUserId; entity.d_UpdateDate = dto.d_UpdateDate; dto.OnEntity(entity); return(entity); }
private void btnGrabar_Click(object sender, EventArgs e) { if (uvPacient.Validate(true, false).IsValid) { OperationResult objOperationResult = new OperationResult(); medicoDto OmedicoDto = new medicoDto(); OmedicoDto.i_SystemUserId = int.Parse(ddlUsuario.SelectedValue.ToString()); OmedicoDto.i_MasterServiceTypeId = int.Parse(ddlServiceTypeId.SelectedValue.ToString()); OmedicoDto.i_MasterServiceId = int.Parse(ddlMasterServiceId.SelectedValue.ToString()); OmedicoDto.r_Clinica = decimal.Parse(txtClinica.Text); OmedicoDto.r_Medico = decimal.Parse(txtMedico.Text); if (_mode == "New") { oHospitalizacionBL.AddMedico(ref objOperationResult, OmedicoDto, Globals.ClientSession.GetAsList()); } else { OmedicoDto.v_MedicoId = _medicoId; OmedicoDto.v_ComentaryUpdate = GetChanges(); oHospitalizacionBL.UpdateMedico(ref objOperationResult, OmedicoDto, Globals.ClientSession.GetAsList()); } DialogResult = DialogResult.OK; } }
public bool SaveChange(List <SpecialistConfiguration> list, List <string> clientSession) { try { using (var ts = new TransactionScope()) { OperationResult objOperationResult = new OperationResult(); var dbContext = new SigesoftEntitiesModel(); var queryable = dbContext.medico.Where(p => p.i_MasterServiceId == (int)MasterService.Eso && p.i_MasterServiceTypeId == (int)ServiceType.Empresarial).ToList(); foreach (var rem in queryable) { dbContext.medico.DeleteObject(rem); } //var x = queryable.RemoveAll(p => p.i_MasterServiceId == (int)MasterService.Eso && p.i_MasterServiceTypeId == (int)ServiceType.Empresarial); foreach (var item in list) { var omedicoDto = new medicoDto(); omedicoDto.i_MasterServiceId = (int)MasterService.Eso; omedicoDto.i_SystemUserId = int.Parse(item.i_SystemUserId); omedicoDto.i_MasterServiceTypeId = (int)ServiceType.Empresarial; omedicoDto.i_CategoryId = int.Parse(item.i_CategoryId); omedicoDto.r_Price = decimal.Parse(item.Price.ToString()); omedicoDto.v_CustomerOrganizationId = item.v_CustomerOrganizationId; omedicoDto.v_EmployerOrganizationId = item.v_EmployerOrganizationId; omedicoDto.v_WorkingOrganizationId = item.v_WorkingOrganizationId; oHospitalizacionBL.AddMedico(ref objOperationResult, omedicoDto, clientSession); } dbContext.SaveChanges(); ts.Complete(); return(true); } } catch (Exception) { return(false); } }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="medico"/> converted from <see cref="medicoDto"/>.</param> static partial void OnEntity(this medicoDto dto, medico entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="medicoDto"/> converted from <see cref="medico"/>.</param> static partial void OnDTO(this medico entity, medicoDto dto);