Example #1
0
        private void mnuComenzarCircuito_Click(object sender, EventArgs e)
        {
            CalendarBL                  objCalendarBL        = new CalendarBL();
            calendarDto                 objCalendarDto       = new calendarDto();
            ServiceBL                   objServiceBL         = new ServiceBL();
            serviceDto                  objServiceDto        = new serviceDto();
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();

            DateTime FechaAgenda = DateTime.Parse(grdDataCalendar.Selected.Rows[0].Cells[4].Value.ToString());

            if (FechaAgenda.Date != DateTime.Now.Date)
            {
                MessageBox.Show("No se permite Iniciar Circuito con una fecha que no sea la actual.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            DialogResult Result = MessageBox.Show("¿Está seguro de INICIAR CIRCUITO este registro?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                string strCalendarId = grdDataCalendar.Selected.Rows[0].Cells[0].Value.ToString();

                objCalendarBL.CircuitStart(ref objOperationResult, strCalendarId, DateTime.Now, Globals.ClientSession.GetAsList());

                objServiceDto = objServiceBL.GetService(ref objOperationResult, grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString());

                var NewCont = grdDataCalendar.Selected.Rows[0].Cells["i_NewContinuationId"].Value;
                if ((int)NewCont == (int)Common.modality.NuevoServicio)
                {
                    objServiceDto.i_ServiceStatusId = (int)Common.ServiceStatus.Iniciado;
                }
                else if ((int)NewCont == (int)Common.modality.ContinuacionServicio)
                {
                    objServiceDto.i_ServiceStatusId = int.Parse(grdDataCalendar.Selected.Rows[0].Cells["i_ServiceStatusId"].Value.ToString());
                }

                objServiceBL.UpdateService(ref objOperationResult, objServiceDto, Globals.ClientSession.GetAsList());

                _strServicelId = grdDataCalendar.Selected.Rows[0].Cells[5].Value.ToString();

                btnFilter_Click(sender, e);

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _strServicelId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                grdDataCalendar.Rows[_RowIndexgrdDataCalendar].Selected = true;

                MessageBox.Show("Circuito iniciado, paciente disponible para su atención", " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
        private void btnIniciarCircuitoMasivo_Click(object sender, EventArgs e)
        {
            CalendarBL objCalendarBL = new CalendarBL();

            _ListaCalendar = new List <string>();
            foreach (var item in grdDataCalendar.Rows)
            {
                //CheckBox ck = (CheckBox)item.Cells["b_FechaEntrega"].Value;

                if ((bool)item.Cells["b_Seleccionar"].Value)
                {
                    string x = item.Cells["v_CalendarId"].Value.ToString();
                    _ListaCalendar.Add(x);
                }
            }

            if (_ListaCalendar.Count == 0)
            {
                MessageBox.Show("No hay ningún servicio con check, por favor seleccionar uno.", "VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                OperationResult objOperationResult = new OperationResult();
                foreach (var item in _ListaCalendar)
                {
                    //oServiceBL.ActualizarFechaIniciarCircuitoCalendar(item.ToString(), dtpDateTimeStar.Value);
                    objCalendarBL.CircuitStart(ref objOperationResult, item.ToString(), DateTime.Now, Globals.ClientSession.GetAsList());
                }
            }

            //frmPopupFechaEntrega frm = new frmPopupFechaEntrega(_ListaCalendar,"calendar");
            //frm.ShowDialog();
            MessageBox.Show("Se inició correctamente el inicio de circuito", "SISTEMAS!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            btnFilter_Click(sender, e);
        }
        protected void btnSubir_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            CalendarBL      objCalendarBL      = new CalendarBL();
            calendarDto     objCalendarDto     = new calendarDto();
            PacientBL       objPacientBL       = new PacientBL();
            pacientDto      objPacientDto      = new pacientDto();
            PacientList     PacientList        = new PacientList();

            if (dpFechaInicio.SelectedDate.Value < DateTime.Now.Date)
            {
                Alert.ShowInTop("No se permite agendar con una fecha anterior a la actual.", "Error de validación");
                return;
            }

            string CalendarId;
            string PacientId = "";

            StringBuilder sbDatos = new StringBuilder();

            var ListaGrilla = (List <Sigesoft.Node.WinClient.BE.PacientList>)Session["_TempPacientList"];

            foreach (var item in ListaGrilla)
            {
                personDto objPersonDto = new personDto();
                //Validar si el trabajador existe
                objPersonDto = objPacientBL.GetPersonByNroDocument(ref objOperationResult, item.v_DocNumber);
                if (objPersonDto != null)
                {
                    objPersonDto.v_FirstName       = item.v_FirstName.Trim();
                    objPersonDto.v_FirstLastName   = item.v_FirstLastName.Trim();
                    objPersonDto.v_SecondLastName  = item.v_SecondLastName.Trim();
                    objPersonDto.i_DocTypeId       = item.i_DocTypeId;
                    objPersonDto.v_DocNumber       = item.v_DocNumber;
                    objPersonDto.i_SexTypeId       = item.i_SexTypeId;
                    objPersonDto.d_Birthdate       = item.d_Birthdate;
                    objPersonDto.i_LevelOfId       = -1;
                    objPersonDto.i_MaritalStatusId = -1;

                    objPersonDto.i_BloodGroupId           = -1;
                    objPersonDto.i_BloodFactorId          = -1;
                    objPersonDto.i_DepartmentId           = -1;
                    objPersonDto.i_ProvinceId             = -1;
                    objPersonDto.i_DistrictId             = -1;
                    objPersonDto.i_ResidenceInWorkplaceId = 0;
                    objPersonDto.i_TypeOfInsuranceId      = -1;
                    objPersonDto.i_OccupationTypeId       = -1;
                    objPersonDto.i_AltitudeWorkId         = -1;
                    objPersonDto.i_PlaceWorkId            = -1;
                    objPersonDto.i_Relationship           = -1;

                    objPersonDto.v_CurrentOccupation = item.v_CurrentOccupation;
                    objPacientBL.UpdatePacient(ref objOperationResult, objPersonDto, ((ClientSession)Session["objClientSession"]).GetAsList(), objPersonDto.v_DocNumber, objPersonDto.v_DocNumber);
                    PacientId = objPersonDto.v_PersonId;
                }
                else
                {
                    objPersonDto                          = new personDto();
                    objPersonDto.v_FirstName              = item.v_FirstName.Trim();
                    objPersonDto.v_FirstLastName          = item.v_FirstLastName.Trim();
                    objPersonDto.v_SecondLastName         = item.v_SecondLastName.Trim();
                    objPersonDto.i_DocTypeId              = item.i_DocTypeId;
                    objPersonDto.v_DocNumber              = item.v_DocNumber;
                    objPersonDto.i_SexTypeId              = item.i_SexTypeId;
                    objPersonDto.d_Birthdate              = item.d_Birthdate;
                    objPersonDto.i_LevelOfId              = -1;
                    objPersonDto.i_MaritalStatusId        = -1;
                    objPersonDto.i_BloodGroupId           = -1;
                    objPersonDto.i_BloodFactorId          = -1;
                    objPersonDto.i_DepartmentId           = -1;
                    objPersonDto.i_ProvinceId             = -1;
                    objPersonDto.i_DistrictId             = -1;
                    objPersonDto.i_ResidenceInWorkplaceId = 0;
                    objPersonDto.i_TypeOfInsuranceId      = -1;
                    objPersonDto.i_OccupationTypeId       = -1;
                    objPersonDto.i_AltitudeWorkId         = -1;
                    objPersonDto.i_PlaceWorkId            = -1;
                    objPersonDto.i_Relationship           = -1;
                    objPersonDto.v_Deducible              = 0;
                    //objPersonDto.v_Password = item.v_DocNumber;
                    objPersonDto.v_CurrentOccupation = item.v_CurrentOccupation;

                    PacientId = objPacientBL.AddPacient(ref objOperationResult, objPersonDto, ((ClientSession)Session["objClientSession"]).GetAsList());
                }

                var Verificar = objPacientBL.GetBlackList(ref objOperationResult, objPersonDto.v_PersonId);


                if (PacientId != null && Verificar == null)  // Se grabo el paciente y se lo agenda
                {
                    objCalendarDto.v_PersonId         = PacientId;
                    objCalendarDto.d_DateTimeCalendar = dpFechaInicio.SelectedDate.Value;
                    objCalendarDto.i_ServiceTypeId    = (int)ServiceType.Empresarial;
                    objCalendarDto.i_CalendarStatusId = (int)CalendarStatus.Agendado;
                    objCalendarDto.i_ServiceId        = (int)MasterService.Eso;
                    //objCalendarDto.v_ProtocolId = _ProtocolId;
                    //Obtener Id de Protocolo por medio del código del protocolo
                    var ProtocolId = oProtocolBL.ObtenerProtocoloIdPorCodigoProtocolo(ddlProtocoloId.SelectedText);
                    if (ProtocolId == null)
                    {
                        Alert.ShowInTop("El protocolo no existe en el sistema.", "ERRROR!");
                        return;
                    }
                    objCalendarDto.v_ProtocolId        = ProtocolId;
                    objCalendarDto.i_NewContinuationId = (int)modality.NuevoServicio;
                    objCalendarDto.i_LineStatusId      = (int)LineStatus.FueraCircuito;
                    objCalendarDto.i_IsVipId           = (int)SiNo.NO;

                    CalendarId = objPacientBL.AddShedule(ref objOperationResult, objCalendarDto, ((ClientSession)Session["objClientSession"]).GetAsList(), ProtocolId, PacientId, (int)MasterService.Eso, "Nuevo");
                    objCalendarBL.CircuitStart(ref objOperationResult, CalendarId, DateTime.Now, ((ClientSession)Session["objClientSession"]).GetAsList());
                }
                else  // no se grabro el paciente
                {
                    sbDatos.Append("PACIENTE :  ");
                    sbDatos.Append(objPersonDto.v_FirstName + " " + objPersonDto.v_FirstLastName + " " + objPersonDto.v_SecondLastName);
                    sbDatos.Append("  DOCUMENTO :  ");
                    sbDatos.Append(objPersonDto.v_DocNumber);
                    sbDatos.Append("\n");
                }
            }

            //iniciar circuitos


            if (objOperationResult.Success == 1)  // Operación sin error
            {
                Alert.Show("Se agendó correctamente.");

                List <Sigesoft.Node.WinClient.BE.PacientList> _TempPacientList;
                _TempPacientList            = new List <Sigesoft.Node.WinClient.BE.PacientList>();
                Session["_TempPacientList"] = _TempPacientList;
                grdData.DataSource          = _TempPacientList;
                grdData.DataBind();
            }
            else// Operación con error
            {
                Alert.ShowInTop("Error al agendar, por favor comuníquese con su proveedor", "ERROR!");
            }
        }