コード例 #1
0
 public CjCRSummary FinalizarTurno(String noEmpleado, CjCRTurno turno)
 {
     string fecha = util.ValidarFecha(turno.Fecha.ToString()).ToString();
     turno.Fecha = Int32.Parse(fecha);
     return TurnosService.FinalizarTurno(noEmpleado, turno,
         TurnosService.GetAuthorization(true));
 }
コード例 #2
0
 public CjCRSummary CancelarTurno(CjCRTurno turno)
 {
     string fecha = util.ValidarFecha(turno.Fecha.ToString()).ToString();
     turno.Fecha = Int32.Parse(fecha);
     return TurnosService.CancelarTurno(turno,
         TurnosService.GetAuthorization(true));
 }
コード例 #3
0
        public CjCRSummary ApropiarTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            CjCRSummary summary = TurnoValidator.Validate(
                turno, CjCRTurnoValidator.ESTADO_VALIDATION);

            if (summary.Complete)
            {
                summary = TurnosLogic.ApropiarTurno(noEmpleado, turno, credential);
            }

            return summary;
        }
コード例 #4
0
        public CjCRSummary AtenderTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            string fecha = util.ValidarFecha("0");
            turno.Fecha = Int32.Parse(fecha);
            CjCRSummary summary = TurnoValidator.Validate(
                turno, CjCRTurnoValidator.ESTADO_VALIDATION);

            if (summary.Complete)
            {
                summary = TurnosLogic.AtenderTurno(noEmpleado, turno, credential);
            }

            return summary;
        }
コード例 #5
0
        public int ApropiarTurno(String noEmpleado, CjCRTurno turno,String origen, CjCRCredential credential)
        {
            int resultCode = CjCRTurnadorStatus.OPERATION_FAIL;

            try
            {
                resultCode = ApropiarTurnoExecute(noEmpleado, turno, origen, credential);
            }
            catch (Exception ex)
            {
                Log.Error(CjCRPropertyUtils.GetFormat("sentence.execution.error", ex.Message));
            }

            return resultCode;
        }
コード例 #6
0
        public CjCRSummary ApropiarTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            String origen = "Apropiar Turno";
            CjCREmpleadoPool empleadoPool = PoolDao.GetPoolByEmpleado(noEmpleado, credential);
            CjCRUnidadNegocio unidadNegocio;
            CjCRSummary summary;
            int status;
            turno.Estado = TurnosDao.GetTurno(turno, credential).Estado;
            if (empleadoPool != null)
            {
                if (empleadoPool.Cualidades.GetIdUnidadNegocio() != turno.IdUnidadNegocio)
                {
                    summary = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_DIFERENTE_NEGOCIO);
                    unidadNegocio = NegocioDao.GetUnidadNegocio(turno.IdUnidadNegocio, credential);

                    summary.Detail = String.Format(summary.Detail, noEmpleado,
                        (unidadNegocio != default(CjCRUnidadNegocio) ? unidadNegocio.Descripcion : ""));

                    return summary;
                }

                if (turno.Estado != CjCRTurnadorStatus.TURNO_ASIGNADO
                        && turno.Estado != CjCRTurnadorStatus.TURNO_POSPUESTO)
                {
                    return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.TURNO_ESTADO_INCORRECTO);
                }

                if (empleadoPool != default(CjCREmpleadoPool)
                    && (empleadoPool.Estado == CjCRTurnadorStatus.ATENCION_DISPONIBLE
                        || empleadoPool.Estado == CjCRTurnadorStatus.ATENCION_NO_DISPONIBLE))
                {
                    status = TurnosDao.ApropiarTurno(noEmpleado, turno,origen, credential);
                    return TurnadorSummaryFactory.Get(status);
                }
                else
                {
                    return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_NO_DISPONIBLE);
                }
            }
            else { return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_INEXISTENTE); }
        }
コード例 #7
0
        public CjCRTurno GetTurno(int fecha, int idUnidadNegocio, int idTurno, CjCRCredential credential)
        {
            CjCRTurno turno = new CjCRTurno();
            CjCREmpleadoPool empleadoPool;

            turno.Fecha = fecha;
            turno.IdUnidadNegocio = idUnidadNegocio;
            turno.IdTurno = idTurno;

            turno = TurnosDao.GetTurno(turno, credential);

            if (turno != default(CjCRTurno) && turno.Empleado != default(CjCREmpleadoPool))
            {
                empleadoPool = PoolDao.GetPoolByEmpleado(turno.Empleado.NoEmpleado, credential);

                if (empleadoPool != default(CjCREmpleadoPool))
                {
                    turno.Empleado = empleadoPool;
                }
            }

            return turno;
        }
コード例 #8
0
 public CjCRSummary AtenderTurno(String noEmpleado, CjCRTurno turno)
 {
     return TurnosService.AtenderTurno(noEmpleado, turno,
         TurnosService.GetAuthorization(true));
 }
コード例 #9
0
        private CjCRSummary SetEstadoTurno(CjCRTurno turno, int sigEstadoTurno, CjCRCredential credential)
        {
            int statusResult = CjCRTurnadorStatus.TURNO_ESTADO_INCORRECTO;
            turno.Estado = TurnosDao.GetTurno(turno, credential).Estado;
            if (EstadosTurnoPool.IsNext(turno.Estado, sigEstadoTurno))
            {
                turno.Estado = sigEstadoTurno;

                statusResult = TurnosDao.SetEstado(turno, credential);
            }

            return TurnadorSummaryFactory.Get(statusResult);
        }
コード例 #10
0
        private int SetEstadoExecute(CjCRTurno turno, CjCRCredential credential)
        {
            Autenticate(credential);

            return AdoTemplate.Execute<Int32>(delegate(DbCommand command)
            {
                int resultCode = CjCRTurnadorStatus.OPERATION_FAIL;
                DbDataReader reader;

                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "PACJCCLUTRHistorico";

                CjCRDaoUtils.AddParamNotNull(command, "@piFecha", turno.Fecha);
                CjCRDaoUtils.AddParamNotNull(command, "@piTurno", turno.IdTurno);
                CjCRDaoUtils.AddParamNotNull(command, "@piUnidadNegocio", turno.IdUnidadNegocio);
                CjCRDaoUtils.AddParamNotNull(command, "@piEstatusTurno", turno.Estado);
                CjCRDaoUtils.AddParamNotNull(command, "@pcUser", credential.User);

                reader = command.ExecuteReader();

                while (reader.Read())
                {
                    resultCode = reader.GetInt32(0);
                }

                return resultCode;
            });
        }
コード例 #11
0
        public CjCRTurno GenerarTurno(CjCRTurno turno, CjCRCredential credential)
        {
            CjCRSummary summary = TurnoValidator.Validate(
                turno, CjCRTurnoValidator.BASIC_VALIDATION);

            if (summary.Complete)
            {
                turno = TurnosLogic.GenerarTurno(turno, credential);
            }

            return turno;
        }
コード例 #12
0
        private int ApropiarTurnoExecute(String noEmpleado, CjCRTurno turno,String origen, CjCRCredential credential)
        {
            Autenticate(credential);

            return AdoTemplate.Execute<Int32>(delegate(DbCommand command)
            {
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "PACJCCLUTRApropiar";

                CjCRDaoUtils.AddParamNotNull(command, "@piFecha", turno.Fecha);
                CjCRDaoUtils.AddParamNotNull(command, "@piTurno", turno.IdTurno);
                CjCRDaoUtils.AddParamNotNull(command, "@piUnidadNegocio", turno.IdUnidadNegocio);
                CjCRDaoUtils.AddParamNotNull(command, "@pcOrigen", origen);
                CjCRDaoUtils.AddParamNotNull(command, "@pcEmpleado", noEmpleado);

                command.ExecuteNonQuery();

                return CjCRTurnadorStatus.OPERATION_COMPLETE;
            });
        }
コード例 #13
0
        private CjCRTurno GenerarTurnoExecute(CjCRTurno turno, CjCRCredential credential)
        {
            Autenticate(credential);

            return AdoTemplate.Execute<CjCRTurno>(delegate(DbCommand command)
            {
                CjCRTurno turnoGenerado = new CjCRTurno();

                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "PACJCCLITRTurno";

                CjCRDaoUtils.AddParamNotNull(command, "@piOrigenTurno", turno.IdOrigen);
                CjCRDaoUtils.AddParamNotNull(command, "@piUndNegocio", turno.IdUnidadNegocio);
                CjCRDaoUtils.AddParamNotNull(command, "@piFilaId", FILA_VIRTUAL);
                CjCRDaoUtils.AddParamNotNull(command, "@piSeguimiento", turno.TurnoSeguimiento);
                CjCRDaoUtils.AddParamNotNull(command, "@pcUser", credential.User);

                CjCRDaoUtils.AddOutputParam(command, "@piTurno", CjCRDaoUtils.INT_SIZE);
                CjCRDaoUtils.AddOutputParam(command, "@piFecha", CjCRDaoUtils.INT_SIZE);

                command.ExecuteNonQuery();

                turnoGenerado.IdTurno = CjCRDaoUtils.GetInt32(command, "@piTurno", -1);
                turnoGenerado.Fecha = CjCRDaoUtils.GetInt32(command, "@piFecha", -1);

                turnoGenerado.IdOrigen = turno.IdOrigen;
                turnoGenerado.IdUnidadNegocio = turno.IdUnidadNegocio;
                turnoGenerado.TurnoSeguimiento = turno.TurnoSeguimiento;

                return turnoGenerado;
            });
        }
コード例 #14
0
        public CjCRSummary PosponerTurno(CjCRTurno turno, CjCRCredential credential)
        {
            turno = TurnosDao.GetTurno(turno, credential);
            CjCRSummary summary = TurnoValidator.Validate(
                turno, CjCRTurnoValidator.ESTADO_VALIDATION);

            if (summary.Complete)
            {
                summary = TurnosLogic.PosponerTurno(turno, credential);
            }

            return summary;
        }
コード例 #15
0
        public CjCRTurno GetTurno(CjCRTurno turno, CjCRCredential credential)
        {
            CjCRTurno turnoGet = default(CjCRTurno);

            try
            {
                turnoGet = GetTurnoExecute(turno, credential);
            }
            catch (Exception ex)
            {
                Log.Error(CjCRPropertyUtils.GetFormat("sentence.execution.error", ex.Message));
            }

            return turnoGet;
        }
コード例 #16
0
        public CjCRTurno GenerarTurno(CjCRTurno turno, CjCRCredential credential)
        {
            turno = TurnosDao.GenerarTurno(turno, credential);

            TurnosTask.CompletarTurnosProcess(credential);
            TurnosTask.CaducarTurnosProcess(turno.IdUnidadNegocio, credential);

            return turno;
        }
コード例 #17
0
        public CjCRSummary FinalizarTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            String origen = "Finaliza Turno";
            CjCREmpleadoPool empPool = PoolDao.GetPoolByEmpleado(noEmpleado, credential);
                CjCREmpleadoPool empleadoPool = new CjCREmpleadoPool();
                empleadoPool = PoolDao.GetPoolByEmpleado(noEmpleado, credential);
                CjCRCualidadList cualidad = new CjCRCualidadList();
                int unidadNegocio = PoolDao.UnidadEmpleado(noEmpleado, credential);
                cualidad.SetIdUnidadNegocio(unidadNegocio);
                empleadoPool.Cualidades = cualidad;
                CjCRTurno turnoAtendido = TurnosDao.GetTurno(turno, credential);

                return SetEstado(noEmpleado, turnoAtendido,
                CjCRTurnadorStatus.ATENCION_NO_DISPONIBLE,
                CjCRTurnadorStatus.TURNO_ATENDIDO,origen, credential);
        }
コード例 #18
0
 public CjCRSummary CancelarTurno(CjCRTurno turno, CjCRCredential credential)
 {
     return SetEstadoTurno(turno, CjCRTurnadorStatus.TURNO_CANCELADO, credential);
 }
コード例 #19
0
        public CjCRSummary AtenderTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            String origen = "Atender Turno";
            CjCRSummary mensaje = new CjCRSummary();
            CjCRSummary mensaje2 = new CjCRSummary();
            CjCREmpleadoPool emp = new CjCREmpleadoPool();
            emp = GetEmpleado(noEmpleado, credential);
            CjCRTurno turnoactual = GetTurno(turno.Fecha, turno.IdUnidadNegocio, turno.IdTurno, credential);

            if (turnoactual.Empleado.NoEmpleado == noEmpleado)
            {
                if (turnoactual.Estado == CjCRTurnadorStatus.TURNO_ASIGNADO)
                {
                    if (emp.Estado == CjCRTurnadorStatus.ATENCION_ASIGNADO)
                    {
                        return ActualizarTurno(noEmpleado, turno, CjCRTurnadorStatus.ATENCION_OCUPADO,
                        CjCRTurnadorStatus.TURNO_EN_ATENCION, origen, credential);
                    }
                    else
                    {
                        mensaje = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_ESTADO_INCORRECTO);
                        return mensaje;
                    }
                }
                else
                {

                    mensaje = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.TURNO_ESTADO_INCORRECTO);

                    return mensaje;

                }
            }
            else
            {
                mensaje =  TurnadorSummaryFactory.Get(CjCRTurnadorStatus.TURNO_ASIGNADO_OTRO_EMPLEADO);

                mensaje.Detail = String.Format(mensaje.Detail, turnoactual.IdTurno,
                       "", turnoactual.Empleado.NoEmpleado);

                return mensaje;
            }
        }
コード例 #20
0
        public CjCRSummary CancelarTurno(CjCRTurno turno, CjCRCredential credential)
        {
            CjCRSummary summary = TurnoValidator.Validate(
                turno, CjCRTurnoValidator.ESTADO_VALIDATION);

            if (summary.Complete)
            {
                summary = TurnosLogic.CancelarTurno(turno, credential);
            }

            return summary;
        }
コード例 #21
0
 public CjCRTurno GenerarTurno(CjCRTurno turno)
 {
     return TurnosService.GenerarTurno(turno,
         TurnosService.GetAuthorization(true));
 }
コード例 #22
0
        public CjCRTurno GetTurnoAsignado(int fecha, int idUnidadNegocio, String noEmpleado,
            CjCRCredential credential)
        {
            List<CjCRTurno> turnos = TurnosDao.GetTurnos(fecha, idUnidadNegocio,
                CjCRTurnadorStatus.TURNO_ASIGNADO, credential);
            CjCRTurno turno = new CjCRTurno();

            foreach (CjCRTurno turnoAsignado in turnos)
            {
                if (turnoAsignado.Empleado.NoEmpleado.Equals(noEmpleado))
                {
                    return turnoAsignado;
                }
            }

            return turno;
        }
コード例 #23
0
        public int SetEstado(CjCRTurno turno, CjCRCredential credential)
        {
            int resultCode = CjCRTurnadorStatus.OPERATION_FAIL;

            try
            {
                resultCode = SetEstadoExecute(turno, credential);
            }
            catch (Exception ex)
            {
                Log.Error(CjCRPropertyUtils.GetFormat("sentence.execution.error", ex.Message));
            }

            return resultCode;
        }
コード例 #24
0
        public CjCRTurno GetTurnoEmpleado(int fecha, String noEmpleado,
            CjCRCredential credential)
        {
            List<CjCRTurno> turnosAtencion = TurnosDao.GetTurnos(fecha, CjCRDaoUtils.INT_NULL, CjCRTurnadorStatus.TURNO_EN_ATENCION, credential);
            List<CjCRTurno> turnosAsignados = TurnosDao.GetTurnos(fecha, CjCRDaoUtils.INT_NULL, CjCRTurnadorStatus.TURNO_ASIGNADO, credential);
            List<CjCRTurno> todosTurnos = new List<CjCRTurno>();
            todosTurnos = turnosAtencion.Union(turnosAsignados).ToList();

            CjCRTurno sinTurno = new CjCRTurno();

            foreach (CjCRTurno turno in todosTurnos)
            {
                if (turno.Empleado.NoEmpleado.Equals(noEmpleado))
                {
                    return turno;
                }
            }

            return sinTurno;
        }
コード例 #25
0
        private CjCRTurno AtenderVirtualExecute(int idUnidadNegocio, String noEmpleado, CjCRCredential credential)
        {
            Autenticate(credential);

            return AdoTemplate.Execute<CjCRTurno>(delegate(DbCommand command)
            {
                CjCRTurno turno = new CjCRTurno();

                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "PACJCCLITRAsignaVirtual";

                CjCRDaoUtils.AddParamNotNull(command, "@pcEmpleado", noEmpleado);
                CjCRDaoUtils.AddParamNotNull(command, "@piUnidadNegocio", idUnidadNegocio);

                CjCRDaoUtils.AddOutputParam(command, "@piTurno", CjCRDaoUtils.INT_SIZE);
                CjCRDaoUtils.AddOutputParam(command, "@piFecha", CjCRDaoUtils.INT_SIZE);
                CjCRDaoUtils.AddOutputParam(command, "@piStatus", CjCRDaoUtils.INT_SIZE);

                command.ExecuteNonQuery();

                turno.IdUnidadNegocio = idUnidadNegocio;
                turno.IdTurno = CjCRDaoUtils.GetInt32(command, "@piTurno", -1);
                turno.Fecha = CjCRDaoUtils.GetInt32(command, "@piFecha", -1);
                turno.Estado = CjCRDaoUtils.GetInt32(command, "@piStatus", -1);

                return turno;
            });
        }
コード例 #26
0
 public CjCRSummary PosponerTurno(CjCRTurno turno, CjCRCredential credential)
 {
     String origen = "Posponer Turno";
     String noEmpleado = (turno.Empleado != default(CjCREmpleadoPool)
         ? turno.Empleado.NoEmpleado : default(String));
     return ActualizarTurno(noEmpleado, turno, CjCRTurnadorStatus.ATENCION_NO_DISPONIBLE,
         CjCRTurnadorStatus.TURNO_POSPUESTO,origen, credential);
 }
コード例 #27
0
        private CjCRTurno GetTurnoExecute(CjCRTurno turno, CjCRCredential credential)
        {
            Autenticate(credential);

            return AdoTemplate.Execute<CjCRTurno>(delegate(DbCommand command)
            {
                CjCRTurno turnoGet = default(CjCRTurno);
                DbDataReader reader;

                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "PACJCCLSTRTurno";
                //-------------------------------------------------------------------->
                CjCRDaoUtils.AddParamNotNull(command, "@piFecha", turno.Fecha);
                CjCRDaoUtils.AddParamNotNull(command, "@piTurno", turno.IdTurno);
                CjCRDaoUtils.AddParamNotNull(command, "@piUndNegocio", turno.IdUnidadNegocio);

                reader = command.ExecuteReader();

                while (reader.Read())
                {
                    turnoGet = TurnoMapper.Get(reader, CjCRTurnoMapper.BASIC_MODEL);
                }

                return turnoGet;
            });
        }
コード例 #28
0
        private CjCRSummary ActualizarTurno(String noEmpleado, CjCRTurno turno, 
            int sigEstadoAtencion, int sigEstadoTurno,String origen, CjCRCredential credential)
        {
            CjCRTurno turnoAsignado = TurnosDao.GetTurno(turno, credential);
            turno = turnoAsignado;
            CjCRSummary summary;

            if (turnoAsignado == default(CjCRTurno))
            {
                return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.OPERATION_FAIL);
            }

            if (turnoAsignado.Empleado == default(CjCREmpleadoPool))
            {
                return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_NO_ASIGNADO);
            }

            if (noEmpleado != default(String))
            {
                if (!turnoAsignado.Empleado.NoEmpleado.Equals(noEmpleado))
                {
                    summary = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.TURNO_ASIGNADO_OTRO_EMPLEADO);

                    summary.Detail = String.Format(summary.Detail, turnoAsignado.IdTurno,
                        turnoAsignado.Empleado.Nombre, turnoAsignado.Empleado.NoEmpleado);

                    return summary;
                }
            }

            return SetEstado(noEmpleado, turnoAsignado,
                sigEstadoAtencion, sigEstadoTurno, origen, credential);
        }
コード例 #29
0
        private CjCRSummary SetEstado(String noEmpleado, CjCRTurno turno,
            int sigEstadoAtencion, int sigEstadoTurno, String origen, CjCRCredential credential)
        {
            CjCREmpleadoPool empleadoPool = PoolDao.GetPoolByEmpleado(noEmpleado, credential);
            CjCRSummary summary = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.OPERATION_FAIL);
            List<CjCRSummary> summaries = new List<CjCRSummary>();
            StringBuilder detail = new StringBuilder();
            bool complete = true;

            if (empleadoPool != default(CjCREmpleadoPool))
            {
                summaries.Add(SetEstadoEmpleado(empleadoPool, sigEstadoAtencion, origen, credential));
                summaries.Add(SetEstadoTurno(turno, sigEstadoTurno, credential));

                foreach (CjCRSummary summaryStatus in summaries)
                {
                    complete = (complete && summaryStatus.Complete);

                    if (!summaryStatus.Complete)
                    {
                        detail.Append(summaryStatus.Detail);
                        detail.Append(", ");
                    }
                }

                if (complete)
                {
                    summary = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.OPERATION_COMPLETE);
                }
                else
                {
                    detail = CjCRStringUtils.TrimCharacter(detail, ',');
                    summary = TurnadorSummaryFactory.Get(CjCRTurnadorStatus.INCOMPLETE_OPERATION,
                        detail.ToString());
                }
            }

            return summary;
        }
コード例 #30
0
        public CjCRSummary FinalizarTurno(String noEmpleado, CjCRTurno turno, CjCRCredential credential)
        {
            CjCREmpleadoPool empPool = PoolDao.GetPoolByEmpleado(noEmpleado, credential);
            if (empPool != default(CjCREmpleadoPool))
            {
                CjCRCualidadList cualidad = new CjCRCualidadList();
                int unidadNegocio = PoolDao.UnidadEmpleado(noEmpleado, credential);
                turno.IdUnidadNegocio = unidadNegocio;
                CjCRSummary summary = TurnoValidator.Validate(
                   turno, CjCRTurnoValidator.ESTADO_VALIDATION);

                if (summary.Complete)
                {
                    summary = TurnosLogic.FinalizarTurno(noEmpleado, turno, credential);
                }

                return summary;
            }
            else
            {
                return TurnadorSummaryFactory.Get(CjCRTurnadorStatus.EMPLEADO_INEXISTENTE);
            }
        }