コード例 #1
0
        private string EqualComponents(ScheduleForProcess record, List <ProtocolProcess> equalProtocols)
        {
            var inputComps = record.ComponentsByRecord.FindAll(p => p.Check);

            var equalProtocolsComponents = equalProtocols.FindAll(p => p.Components.Count == inputComps.Count);

            var totalMatches = inputComps.Count;
            var count        = 0;

            foreach (var protocolBd in equalProtocolsComponents)
            {
                var compsBd = protocolBd.Components;

                foreach (var compBd in compsBd)
                {
                    var existsComp = inputComps.Find(p => p.ComponetId == compBd.ComponentId);
                    if (existsComp != null)
                    {
                        count++;
                    }
                    else
                    {
                        return(null);
                    }
                }

                if (count == totalMatches)
                {
                    return(protocolBd.ProtocolId);
                }
            }

            return(null);
        }
コード例 #2
0
        //private string GetGesoId(string locationId)
        //{
        //   return _groupOccupationBl.GetFirstGroupOccupationByLocationId(ref _operationResult, locationId).v_GroupOccupationId;
        //}

        private string ProtocolExist(ScheduleForProcess record, List <ProtocolProcess> protocolsBd)
        {
            var equalProtocols = EqualProtocols(protocolsBd);

            if (equalProtocols.Count == 0)
            {
                return(null);
            }

            return(EqualComponents(record, equalProtocols));
        }
コード例 #3
0
        private string GetPersonId(ScheduleForProcess record)
        {
            var oPersonDto = _pacientBl.GetPersonByNroDocument(ref _operationResult, record.NroDocument);

            if (oPersonDto != null)
            {
                oPersonDto.v_CurrentOccupation = record.CurrentOccupation;
                _pacientBl.UpdatePacient(ref _operationResult, oPersonDto, Globals.ClientSession.GetAsList(), oPersonDto.v_DocNumber, oPersonDto.v_DocNumber);
                return(oPersonDto.v_PersonId);
            }

            return(_pacientBl.AddPacient(ref _operationResult, PopulatePeronsDto(record), Globals.ClientSession.GetAsList()));
        }
コード例 #4
0
        private string GetProtocolId(ScheduleForProcess record)
        {
            var componentsBd = _medicalExamBl.GetAllComponent();
            var protocolsBd  = _protocolBl.GetAllProtocol();

            var protocolId = ProtocolExist(record, protocolsBd);

            if (string.IsNullOrEmpty(protocolId))
            {
                protocolId = CreateProtocol(record, componentsBd);
            }

            return(protocolId);
        }
コード例 #5
0
        private personDto PopulatePeronsDto(ScheduleForProcess record)
        {
            var oPersonDto = new personDto();

            oPersonDto.v_FirstName         = record.FirstName;
            oPersonDto.v_FirstLastName     = record.LastName;
            oPersonDto.v_SecondLastName    = record.LastName;
            oPersonDto.i_DocTypeId         = (int)Document.DNI;
            oPersonDto.v_DocNumber         = record.NroDocument;
            oPersonDto.i_SexTypeId         = record.SexTypeId;
            oPersonDto.d_Birthdate         = record.Birthdate;
            oPersonDto.v_CurrentOccupation = record.CurrentOccupation;

            return(oPersonDto);
        }
コード例 #6
0
        private string CreateProtocol(ScheduleForProcess record, List <ComponentList> componentsBd)
        {
            var oprotocolDto = new protocolDto();

            var organizationIds             = cbOrganization.SelectedValue.ToString().Split('|');
            var organizationInvoiceIds      = cbOrganizationInvoice.SelectedValue.ToString().Split('|');
            var organizationIntermediaryIds = cbIntermediaryOrganization.SelectedValue.ToString().Split('|');

            oprotocolDto.v_Name = "&&&&" + CreateProtocolName(record.Geso);
            oprotocolDto.v_EmployerOrganizationId = organizationIds[0];
            oprotocolDto.v_EmployerLocationId     = organizationIds[1];
            oprotocolDto.i_EsoTypeId              = int.Parse(cbEsoType.SelectedValue.ToString());
            oprotocolDto.v_GroupOccupationId      = record.GesoId;// GetGesoId(organizationInvoiceIds[1]);
            oprotocolDto.v_CustomerOrganizationId = organizationInvoiceIds[0];
            oprotocolDto.v_CustomerLocationId     = organizationInvoiceIds[1];
            oprotocolDto.v_WorkingOrganizationId  = organizationIntermediaryIds[0];
            oprotocolDto.v_WorkingLocationId      = cbIntermediaryOrganization.SelectedValue.ToString() != "-1" ? organizationIntermediaryIds[1] : "-1";
            oprotocolDto.i_MasterServiceId        = (int)MasterService.Eso;
            oprotocolDto.v_CostCenter             = "";
            oprotocolDto.i_MasterServiceTypeId    = (int)ServiceType.Empresarial;
            oprotocolDto.i_HasVigency             = Convert.ToInt32(true);
            oprotocolDto.i_ValidInDays            = null;
            oprotocolDto.i_IsActive       = Convert.ToInt32(true);
            oprotocolDto.v_NombreVendedor = "";

            var inputComps = record.ComponentsByRecord.FindAll(p => p.Check);

            var protocolcomponentListDto = new List <protocolcomponentDto>();

            foreach (var item in inputComps)
            {
                var protocolComponent = new protocolcomponentDto();
                protocolComponent.v_ComponentId      = item.ComponetId;
                protocolComponent.r_Price            = componentsBd.Find(p => p.v_ComponentId == item.ComponetId).r_BasePrice;
                protocolComponent.i_OperatorId       = -1;
                protocolComponent.i_Age              = 0;
                protocolComponent.i_GenderId         = 3;
                protocolComponent.i_IsAdditional     = 0;
                protocolComponent.i_IsConditionalId  = 0;
                protocolComponent.i_GrupoEtarioId    = -1;
                protocolComponent.i_IsConditionalIMC = 0;
                protocolComponent.r_Imc              = (decimal?)0.00f;

                protocolcomponentListDto.Add(protocolComponent);
            }

            return(_protocolBl.AddProtocol(ref _operationResult, oprotocolDto, protocolcomponentListDto, Globals.ClientSession.GetAsList()));
        }
コード例 #7
0
        private void ReadRecords()
        {
            _scheduleForProcess = new List <ScheduleForProcess>();

            foreach (var row in grdSchedule.Rows)
            {
                var oScheduleForProcess = new ScheduleForProcess();

                var componentsByRecord = new List <ComponentsByRecord>();
                foreach (var cell in grdSchedule.Rows[row.Index].Cells)
                {
                    var oComponentsByRecord = new ComponentsByRecord();

                    var columnKey = cell.Column.Key;

                    if (columnKey == "NroDocument")
                    {
                        oScheduleForProcess.NroDocument = cell.Value.ToString();
                    }
                    else if (columnKey == "FirstName")
                    {
                        oScheduleForProcess.FirstName = cell.Value.ToString();
                    }
                    else if (columnKey == "LastName")
                    {
                        oScheduleForProcess.LastName = cell.Value.ToString();
                    }
                    else if (columnKey == "SecondLastName")
                    {
                        oScheduleForProcess.SecondLastName = cell.Value.ToString();
                    }
                    else if (columnKey == "Birthdate")
                    {
                        oScheduleForProcess.Birthdate = DateTime.Parse(cell.Value.ToString());
                    }
                    else if (columnKey == "SexTypeId")
                    {
                        oScheduleForProcess.SexTypeId = int.Parse(cell.Value.ToString());
                    }
                    else if (columnKey == "CurrentOccupation")
                    {
                        oScheduleForProcess.CurrentOccupation = cell.Value.ToString();
                    }
                    else if (columnKey == "GesoId")
                    {
                        oScheduleForProcess.GesoId = cell.Value.ToString();
                    }
                    else if (columnKey == "Geso")
                    {
                        oScheduleForProcess.Geso = cell.Value.ToString();
                    }
                    else if (columnKey == "Select" || columnKey == "Clone")
                    {
                    }
                    else
                    {
                        oComponentsByRecord.CategoryName = cell.Column.GroupResolved.Key;
                        oComponentsByRecord.ComponetId   = cell.Column.Key;
                        oComponentsByRecord.Check        = bool.Parse(cell.Value.ToString());
                        componentsByRecord.Add(oComponentsByRecord);
                    }

                    oScheduleForProcess.ComponentsByRecord = componentsByRecord;
                }
                _scheduleForProcess.Add(oScheduleForProcess);
            }

            if (_scheduleForProcess.Count == 0)
            {
                MessageBox.Show(@"Ningún registro leido", @"INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }