Ejemplo n.º 1
0
 public IntercambioDTO(Reglas regla)
 {
     this.idRegla = regla.IdRegla;
     this.lugar   = regla.Lugar;
     this.fecha   = regla.Fecha.Value;
     this.monto   = regla.Monto;
 }
Ejemplo n.º 2
0
        public IHttpActionResult PutReglas(int id, Reglas reglas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reglas.Id)
            {
                return(BadRequest());
            }

            db.Entry(reglas).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReglasExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public EstadoAsistenciaDTO ConsultarInvitacionUsuario(string usuario)
        {
            using (var db = this.dbContext)
            {
                db.Configuration.LazyLoadingEnabled = false;

                Sorteo sorteoUsuario = db.Sorteo
                                       .Include("Participantes")
                                       .Where(s => s.Participantes.IdUsuario == usuario)
                                       .FirstOrDefault();
                if (sorteoUsuario == null)
                {
                    Asistencia asistencia = db.Asistencia.
                                            Where(aa => aa.Participantes.IdUsuario == usuario).FirstOrDefault();

                    Reglas regla = db.Reglas.FirstOrDefault();

                    EstadoAsistenciaDTO estadoAsistencia = new EstadoAsistenciaDTO(regla);
                    estadoAsistencia.confirmacion = asistencia != null ? asistencia.Afirmacion : null;

                    return(estadoAsistencia);
                }
                return(null);
            }
        }
Ejemplo n.º 4
0
 public void QuitarRegla(Regla c)
 {
     Reglas.Remove(c);
     using (var db = new DBContext())
     {
         db.Reglas.Remove(c);               
         db.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public void AgregarRegla(Regla c)
 {
     c.SensorID = SensorID;
     Reglas.Add(c);
     using (var db = new DBContext())
     {
         db.Reglas.Add(c);               
         db.SaveChanges();
     }
 }
Ejemplo n.º 6
0
        private void Inicializar()
        {
            try
            {
                Sesion Sesion = new Sesion();
                Sesion = (Sesion)Session["Sesion" + Session.SessionID];

                CargarComboTipoU();
                CargarComboTipoU_Autoriza1();
                CargarComboTipoU_Autoriza2();
                CargarComboTipoU_Autoriza3();
                CargarEtapasAcciones();
                CargarEtapasAlertas();

                CN_ConfiguracionCobranza confCobranza = new CN_ConfiguracionCobranza();

                List <Acciones>      list_accionesTemp = new List <Acciones>();
                List <Alertas>       list_alertasTemp  = new List <Alertas>();
                List <PeriodoGracia> list_graciaTemp   = new List <PeriodoGracia>();
                Reglas reglas = new Reglas();

                confCobranza.Consultar(ref list_graciaTemp, ref list_accionesTemp, ref list_alertasTemp, sesion.Id_Emp, (new SqlConnectionStringBuilder(sesion.Emp_Cnx)).InitialCatalog, ref reglas, Emp_CnxCob);

                list_acciones   = list_accionesTemp;
                list_respuestas = new List <Comun>();
                list_alertas    = list_alertasTemp;
                list_gracia     = list_graciaTemp;

                TxtPlazo.Value             = (double?)reglas.Plazo;
                cmbAutoriza1.SelectedValue = reglas.Id_Tu1.ToString();
                cmbAutoriza2.SelectedValue = reglas.Id_Tu2.ToString();
                cmbAutoriza3.SelectedValue = reglas.Id_Tu3.ToString();

                txtDias1.DbValue = reglas.Val1;
                txtDias2.DbValue = reglas.Val2;
                txtDias3.DbValue = reglas.Val3;
                txtDias4.DbValue = reglas.Val4;
                txtDias5.DbValue = reglas.Val5;
                txtDias6.DbValue = reglas.Val6;

                CobProceso cobProceso = new CobProceso();
                cobProceso.Id_Emp = Sesion.Id_Emp;
                cobProceso.Id_Cd  = Sesion.Id_Cd_Ver;
                confCobranza.ConsultarCobProceso(ref cobProceso, Emp_CnxCob);
                CheckSvtasAlm.Checked = cobProceso.SvtasAlm;
                CheckEmbAlm.Checked   = cobProceso.EmbAlm;
                CheckEntAlm.Checked   = cobProceso.EntAlm;
                CheckAlmCob.Checked   = cobProceso.AlmCob;
                CheckRevCob.Checked   = cobProceso.RevCob;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        private void Guardar()
        {
            try
            {
                if (!_PermisoModificar)
                {
                    Alerta("No tiene permisos para grabar");
                    return;
                }

                if (!validarEspeciales())
                {
                    return;
                }

                CN_ConfiguracionCobranza confCobranza = new CN_ConfiguracionCobranza();
                int    verificador = 0;
                Reglas reglas      = new Reglas();
                reglas.List_gracia = list_gracia;
                reglas.Plazo       = TxtPlazo.Value;
                reglas.Id_Tu1      = Convert.ToInt32(cmbAutoriza1.SelectedValue);
                reglas.Id_Tu2      = Convert.ToInt32(cmbAutoriza2.SelectedValue);
                reglas.Id_Tu3      = Convert.ToInt32(cmbAutoriza3.SelectedValue);
                reglas.Val1        = txtDias1.Value;
                reglas.Val2        = txtDias2.Value;
                reglas.Val3        = txtDias3.Value;
                reglas.Val4        = txtDias4.Value;
                reglas.Val5        = txtDias5.Value;
                reglas.Val6        = txtDias6.Value;
                CobProceso cobProceso = new CobProceso();
                cobProceso.Id_Emp   = sesion.Id_Emp;
                cobProceso.Id_Cd    = sesion.Id_Cd_Ver;
                cobProceso.SvtasAlm = Convert.ToBoolean(CheckSvtasAlm.Checked);
                cobProceso.EmbAlm   = Convert.ToBoolean(CheckEmbAlm.Checked);
                cobProceso.EntAlm   = Convert.ToBoolean(CheckEntAlm.Checked);
                cobProceso.AlmCob   = Convert.ToBoolean(CheckAlmCob.Checked);
                cobProceso.RevCob   = Convert.ToBoolean(CheckRevCob.Checked);

                confCobranza.Guardar(list_acciones, list_alertas, reglas, cobProceso, sesion.Id_Emp, Emp_CnxCob, ref verificador);

                if (verificador == 1)
                {
                    Alerta("Los cambios se guardaron correctamente");
                }
                else
                {
                    Alerta("Ocurrió un error al intentar guardar los cambios");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        public IHttpActionResult GetReglas(int id)
        {
            Reglas reglas = db.Reglas.Find(id);

            if (reglas == null)
            {
                return(NotFound());
            }

            return(Ok(reglas));
        }
Ejemplo n.º 9
0
        public IHttpActionResult PostReglas(Reglas reglas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Reglas.Add(reglas);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = reglas.Id }, reglas));
        }
Ejemplo n.º 10
0
        public IHttpActionResult DeleteReglas(int id)
        {
            Reglas reglas = db.Reglas.Find(id);

            if (reglas == null)
            {
                return(NotFound());
            }

            db.Reglas.Remove(reglas);
            db.SaveChanges();

            return(Ok(reglas));
        }
Ejemplo n.º 11
0
        private void MostrarMano()
        {
            if (!Reglas.ElJugadorGano(miMazo))
            {
                manoJugador.Children.Clear();
                espacioEntreCartas = 0;

                foreach (Carta carta in miMazo)
                {
                    RenderizarImagen(carta);
                }
            }
            else
            {
                Jugador juadorGanador = new Jugador
                {
                    Nickname     = ObtenerMiNickname(),
                    PuntajeTotal = ObtenerMiPuntaje()
                };

                try
                {
                    PartidaAdmin.AnunciarGanador(miSala, juadorGanador);
                }
                catch (EndpointNotFoundException)
                {
                    new Mensaje
                    {
                        TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                        Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                    }.ShowDialog();
                }
                catch (TimeoutException)
                {
                    new Mensaje
                    {
                        TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                        Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                    }.ShowDialog();
                }
                catch (CommunicationObjectFaultedException)
                {
                    new Mensaje
                    {
                        TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                        Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                    }.ShowDialog();
                }
            }
        }
Ejemplo n.º 12
0
        public bool GuardarRegla(Reglas regla)
        {
            using (var db = this.dbContext)
            {
                db.Configuration.LazyLoadingEnabled = false;
                List <Reglas> reglas = db.Reglas.ToList();

                if (reglas != null && reglas.Count() > 0)
                {
                    return(false);
                }
                else
                {
                    db.Reglas.Add(regla);
                    db.SaveChanges();
                    return(true);
                }
            }
        }
Ejemplo n.º 13
0
 private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     switch (tabControl.SelectedTab.Name)
     {
         case "pagPRENDASAL":
             this.BackColor = Color.Black;
             PRENDASAL = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.PRENDASAL));
             cargarReglas(eNIVEL.PRENDASAL);
             bloquear(eNIVEL.PRENDASAL);
             break;
         case "pagAMIGO":
             this.BackColor = Color.DarkGreen;
             AMIGO = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.AMIGO));
             cargarReglas(eNIVEL.AMIGO);
             bloquear(eNIVEL.AMIGO);
             break;
         case "pagVIP":
             this.BackColor = Color.DarkBlue;
             VIP = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.VIP));
             cargarReglas(eNIVEL.VIP);
             bloquear(eNIVEL.VIP);
             break;
     }
 }
Ejemplo n.º 14
0
 private void ReglasNegocioForm_Load(object sender, EventArgs e)
 {
     permisos();
     this.BackColor = Color.Black;
     PRENDASAL = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.PRENDASAL));
     cargarReglas(eNIVEL.PRENDASAL);
     bloquear(eNIVEL.PRENDASAL);
 }
Ejemplo n.º 15
0
 private void GUARDAR_VIP_Click(object sender, EventArgs e)
 {
     Reglas nuevaR = new Reglas();
     nuevaR = buildREGLA(eNIVEL.VIP);
     string autorizacion = Controles.InputBoxPassword("CODIGO", "CODIGO DE AUTORIZACION");
     if (autorizacion != "" && DBPRENDASAL.md5(autorizacion) == HOME.Instance().USUARIO.PASSWORD)
     {
         nuevaR.FECHA = HOME.Instance().FECHA_SISTEMA;
         nuevaR.COD_EMPLEADO = HOME.Instance().USUARIO.COD_EMPLEADO;
         if (dbPrendasal.actualizarReglas(nuevaR))
         {
             VIP = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.VIP));
             cargarReglas(eNIVEL.VIP);
             bloquear(eNIVEL.VIP);
         }
     }
     else
     {
         MessageBox.Show("CODIGO DE AUTORIZACION INVALIDO", "LISTA VACIA", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Ejemplo n.º 16
0
 private Reglas buildREGLA(eNIVEL nivel)
 {
     Reglas r = new Reglas();
     switch (nivel)
     {
         case eNIVEL.PRENDASAL:
             r.NIVEL = eNIVEL.PRENDASAL;
             r.TASA_MENSUAL = TasaMensual_PRENDASAL.Value;
             r.PLAZO_CONTRATO = (int)PlazoContrato_PRENDASAL.Value;
             r.PLAZO_VENCIDO = (int)PlazoVencido_PRENDASAL.Value;
             r.DESC_COMPRA = DescCompras_PRENDASAL.Value;
             r.DESC_INTERES = DescInteres_PRENDASAL.Value;
             r.PUNTOS_DOLAR = (int)PuntosDolar_PRENDASAL.Value;
             r.PUNTOS_VALOR = PuntosValor_PRENDASAL.Value;
             break;
         case eNIVEL.AMIGO:
             r.NIVEL = eNIVEL.AMIGO;
             r.TASA_MENSUAL = TasaMensual_AMIGO.Value;
             r.PLAZO_CONTRATO = (int)PlazoContrato_AMIGO.Value;
             r.PLAZO_VENCIDO = (int)PlazoVencido_AMIGO.Value;
             r.DESC_COMPRA = DescCompras_AMIGO.Value;
             r.DESC_INTERES = DescInteres_AMIGO.Value;
             r.PUNTOS_DOLAR = (int)PuntosDolar_AMIGO.Value;
             r.PUNTOS_VALOR = PuntosValor_AMIGO.Value;
             break;
         case eNIVEL.VIP:
             r.NIVEL = eNIVEL.VIP;
             r.TASA_MENSUAL = TasaMensual_VIP.Value;
             r.PLAZO_CONTRATO = (int)PlazoContrato_VIP.Value;
             r.PLAZO_VENCIDO = (int)PlazoVencido_VIP.Value;
             r.DESC_COMPRA = DescCompras_VIP.Value;
             r.DESC_INTERES = DescInteres_VIP.Value;
             r.PUNTOS_DOLAR = (int)PuntosDolar_VIP.Value;
             r.PUNTOS_VALOR = PuntosValor_VIP.Value;
             break;
     }
     return r;
 }
Ejemplo n.º 17
0
        private void RenderizarImagen(Carta carta)
        {
            Image imagen = new Image();

            BitmapImage src = new BitmapImage();

            src.BeginInit();
            src.UriSource = new Uri(carta.Rutak__BackingField, UriKind.Relative);
            src.EndInit();

            imagen.Source = src;

            imagen.Stretch             = Stretch.Uniform;
            imagen.Height              = 110;
            imagen.VerticalAlignment   = VerticalAlignment.Bottom;
            imagen.HorizontalAlignment = HorizontalAlignment.Left;
            imagen.Margin              = new Thickness(espacioEntreCartas, 0, 0, 0);

            imagen.MouseLeftButtonUp += (s, ev) =>
            {
                if (EsMiTurno())
                {
                    if (Reglas.EsCartaValida(carta, cartaEnTablero))
                    {
                        try
                        {
                            PartidaAdmin.ColocarCarta(carta, miSala);
                        }
                        catch (EndpointNotFoundException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }
                        catch (TimeoutException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }
                        catch (CommunicationObjectFaultedException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }

                        miMazo.Remove(carta);
                        manoJugador.Children.Remove(imagen);

                        try
                        {
                            PartidaAdmin.ActualizarNumeroDeCartas(miSala, ObtenerMiNickname(), miMazo.Count.ToString());
                            PartidaAdmin.ActualizarPuntaje(miSala, ObtenerMiNickname(), carta.Numerok__BackingField);
                        }
                        catch (EndpointNotFoundException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }
                        catch (TimeoutException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }
                        catch (CommunicationObjectFaultedException)
                        {
                            new Mensaje
                            {
                                TituloMensaje = Properties.Resources.ErrorServidor_TituloContenido,
                                Contenido     = Properties.Resources.ErrorServidor_MensajeContenido
                            }.ShowDialog();
                        }

                        ActualizarMiPuntaje(carta.Numerok__BackingField);
                        MostrarMano();
                    }
                    else
                    {
                        new Mensaje {
                            TituloMensaje = Properties.Resources.Partida_CartaNoPermitidaTitulo,
                            Contenido     = Properties.Resources.Partida_CartaNoPermitidaMensaje
                        }.ShowDialog();
                    }
                }
                else
                {
                    new Mensaje
                    {
                        TituloMensaje = Properties.Resources.Partida_AccionNoPermitidaTitulo,
                        Contenido     = Properties.Resources.Partida_AccionNoPermitidaMensaje
                    }.ShowDialog();
                }
            };

            Grid.SetRow(imagen, 0);
            Grid.SetColumn(imagen, 0);

            manoJugador.Children.Add(imagen);

            espacioEntreCartas += 30;
        }
Ejemplo n.º 18
0
 public void Guardar(List <Acciones> list_acciones, List <Alertas> list_alertas, Reglas reglas, CobProceso cobProceso, int Id_Emp, string Conexion, ref int verificador)
 {
     try
     {
         CD_ConfiguracionCobranza confCobranza = new CD_ConfiguracionCobranza();
         confCobranza.Guardar(list_acciones, list_alertas, reglas, cobProceso, Id_Emp, Conexion, ref verificador);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void Consultar(ref List <PeriodoGracia> list_gracia, ref List <Acciones> list_acciones, ref List <Alertas> list_alertas, int Id_Emp, string db, ref Reglas reglas, string Conexion)
        {
            try
            {
                CD_Datos   CapaDatos  = new CD_Datos(Conexion);
                string[]   Parametros = { "@Id_Emp", "@db" };
                object[]   Valores    = { Id_Emp, db };
                DataSet    ds         = null;
                SqlCommand sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranza_Consultar", ref ds, Parametros, Valores);

                Acciones acciones;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    acciones = new Acciones();

                    acciones.GUID              = Guid.NewGuid().ToString();
                    acciones.Id_Conf           = Convert.ToInt32(dr["Id_Conf"]);
                    acciones.Etapa             = dr["Etapa"].ToString();
                    acciones.EtapaStr          = dr["EtapaStr"].ToString();
                    acciones.Dias              = Convert.ToDouble(dr["Dias"]);
                    acciones.Tipo_Respuesta    = dr["Tipo_Respuesta"].ToString();
                    acciones.Tipo_RespuestaStr = dr["Tipo_RespuestaStr"].ToString();
                    acciones.Pregunta          = dr["Pregunta"].ToString();
                    acciones.Respuestas        = new System.Collections.ArrayList();
                    acciones.RespuestasStr     = "";
                    list_acciones.Add(acciones);
                }

                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    acciones = list_acciones.Where(Acciones => Acciones.Id_Conf == Convert.ToInt32(dr["Id_Conf"])).ToList()[0];
                    acciones.Respuestas.Add(dr["Conf_Respuesta"].ToString());

                    if (acciones.RespuestasStr != "")
                    {
                        acciones.RespuestasStr += ", ";
                    }

                    acciones.RespuestasStr += dr["Conf_Respuesta"].ToString();
                }

                Alertas alertas;
                foreach (DataRow dr in ds.Tables[2].Rows)
                {
                    alertas = new Alertas();

                    alertas.GUID                = Guid.NewGuid().ToString();
                    alertas.Etapa               = dr["Etapa"].ToString();
                    alertas.EtapaStr            = dr["EtapaStr"].ToString();
                    alertas.Dias                = Convert.IsDBNull(dr["Dias"]) ? (Double?)null : Convert.ToDouble(dr["Dias"]);
                    alertas.EnviarA             = Convert.ToInt32(dr["EnviarA"]);
                    alertas.EnviarAStr          = dr["EnviarAStr"].ToString();
                    alertas.SuspenderCredito    = Convert.ToBoolean(dr["SuspenderCredito"]);
                    alertas.SuspenderCreditoStr = dr["SuspenderCreditoStr"].ToString();
                    list_alertas.Add(alertas);
                }

                reglas.Plazo = ds.Tables[3].Select("Id_Regla = 1").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 1")[0]["Reg_Valor"];

                reglas.Id_Tu1 = ds.Tables[3].Select("Id_Regla = 2").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 2")[0]["Reg_Valor"];
                reglas.Id_Tu2 = ds.Tables[3].Select("Id_Regla = 3").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 3")[0]["Reg_Valor"];
                reglas.Id_Tu3 = ds.Tables[3].Select("Id_Regla = 4").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 4")[0]["Reg_Valor"];

                reglas.Val1 = ds.Tables[3].Select("Id_Regla = 5").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 5")[0]["Reg_Valor"];
                reglas.Val2 = ds.Tables[3].Select("Id_Regla = 6").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 6")[0]["Reg_Valor"];
                reglas.Val3 = ds.Tables[3].Select("Id_Regla = 7").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 7")[0]["Reg_Valor"];
                reglas.Val4 = ds.Tables[3].Select("Id_Regla = 8").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 8")[0]["Reg_Valor"];
                reglas.Val5 = ds.Tables[3].Select("Id_Regla = 9").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 9")[0]["Reg_Valor"];
                reglas.Val6 = ds.Tables[3].Select("Id_Regla = 10").Length == 0 ? null : ds.Tables[3].Select("Id_Regla = 10")[0]["Reg_Valor"];

                PeriodoGracia periodogracia;
                foreach (DataRow dr in ds.Tables[4].Rows)
                {
                    periodogracia = new PeriodoGracia();

                    periodogracia.GUID          = dr["Reg_Condicion"].ToString();
                    periodogracia.Reg_Condicion = Convert.ToInt32(dr["Reg_Condicion"]);
                    periodogracia.Reg_Periodo   = Convert.ToInt32(dr["Reg_Periodo"]);
                    list_gracia.Add(periodogracia);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 20
0
 public EstadoAsistenciaDTO(Reglas regla) : base(regla)
 {
 }
Ejemplo n.º 21
0
 public void Notificar()
 {
     Reglas.ForEach(o => o.Notificar( UltimaMedicion ));
 }
Ejemplo n.º 22
0
 public void actualizarParametros()
 {
     switch (NIVEL)
     {
         case eNIVEL.PRENDASAL:
             REGLAS = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.PRENDASAL));
             lbNIVEL.ForeColor = Color.Black;
             break;
         case eNIVEL.AMIGO:
             REGLAS = new Reglas();
             REGLAS.NIVEL = TARJETA.TIPO;
             REGLAS.TASA_MENSUAL = TARJETA.TASA_MENSUAL;
             REGLAS.PLAZO_CONTRATO = TARJETA.PLAZO_CONTRATO;
             REGLAS.PLAZO_VENCIDO = TARJETA.PLAZO_VENCIDO;
             REGLAS.DESC_COMPRA = TARJETA.DESC_COMPRA;
             REGLAS.DESC_INTERES = TARJETA.DESC_INTERES;
             lbNIVEL.ForeColor = Color.DarkGreen;
             break;
         case eNIVEL.VIP:
             REGLAS = new Reglas();
             REGLAS.NIVEL = TARJETA.TIPO;
             REGLAS.TASA_MENSUAL = TARJETA.TASA_MENSUAL;
             REGLAS.PLAZO_CONTRATO = TARJETA.PLAZO_CONTRATO;
             REGLAS.PLAZO_VENCIDO = TARJETA.PLAZO_VENCIDO;
             REGLAS.DESC_COMPRA = TARJETA.DESC_COMPRA;
             REGLAS.DESC_INTERES = TARJETA.DESC_INTERES;
             lbNIVEL.ForeColor = Color.DarkBlue;
             break;
     }
     lbNIVEL.Text = NIVEL.ToString();
     calcularTotales();
 }
        public void Guardar(List <Acciones> list_acciones, List <Alertas> list_alertas, Reglas reglas, CobProceso CobProceso, int Id_Emp, string Conexion, ref int verificador)
        {
            CD_Datos CapaDatos = new CD_Datos(Conexion);

            try
            {
                CapaDatos.StartTrans();

                string[]   Parametros;
                object[]   Valores;
                SqlCommand sqlcmd = default(SqlCommand);

                //ACCIONES
                Parametros = new string[] { "@Id_Emp" };
                Valores    = new object[] { Id_Emp };
                sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaAccion_Eliminar", ref verificador, Parametros, Valores);
                int Id_Accion = 0;

                foreach (Acciones a in list_acciones)
                {
                    Parametros = new string[] { "@Id_Emp", "@Id_Tipo", "@Conf_Caso", "@Conf_Pregunta", "@Conf_Tpregunta" };
                    Valores    = new object[] { Id_Emp, a.Etapa, a.Dias, a.Pregunta, a.Tipo_Respuesta };
                    sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaAccion_Guardar", ref verificador, Parametros, Valores);
                    Id_Accion  = verificador;
                    int contador = 0;
                    foreach (string s in a.Respuestas)
                    {
                        contador++;
                        Parametros = new string[] { "@Id_Emp", "@Id_conf", "@Id_confD", "@Conf_Respuesta" };
                        Valores    = new object[] { Id_Emp, Id_Accion, contador, s };
                        sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaRespuestas_Guardar", ref verificador, Parametros, Valores);
                    }
                }

                //ALERTAS
                Parametros = new string[] { "@Id_Emp" };
                Valores    = new object[] { Id_Emp };
                sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaAlerta_Eliminar", ref verificador, Parametros, Valores);

                foreach (Alertas a in list_alertas)
                {
                    Parametros = new string[] { "@Id_Emp", "@Id_Tipo", "@Conf_Caso", "@Id_Tu", "@Conf_SuspCredito" };
                    Valores    = new object[] { Id_Emp, a.Etapa, a.Dias, a.EnviarA, a.SuspenderCredito };
                    sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaAlerta_Guardar", ref verificador, Parametros, Valores);
                }


                //REGLAS
                Parametros = new string[] { "@Id_Emp", "@Plazo", "@Id_Tu1", "@Id_Tu2", "@Id_Tu3", "@Val1", "@Val2", "@Val3", "@Val4", "@Val5", "@Val6" };
                Valores    = new object[] { Id_Emp, reglas.Plazo == null ? 0 : reglas.Plazo, reglas.Id_Tu1, reglas.Id_Tu2, reglas.Id_Tu3, reglas.Val1, reglas.Val2, reglas.Val3, reglas.Val4, reglas.Val5, reglas.Val6 };
                sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaRegla_Guardar", ref verificador, Parametros, Valores);

                int consecutivo = 1;
                foreach (PeriodoGracia a in reglas.List_gracia)
                {
                    Parametros = new string[] { "@Id_Emp", "@Id_Reg", "@Reg_Condicion", "@Reg_Periodo" };
                    Valores    = new object[] { Id_Emp, consecutivo++, a.Reg_Condicion, a.Reg_Periodo };
                    sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaPeriodoGracia_Insertar", ref verificador, Parametros, Valores);
                }


                //PROCESO
                Parametros = new string[] { "@Id_Emp", "@Id_Cd", "@SvtasAlm", "@EmbAlm", "@EntAlm", "@AlmCob", "@RevCob" };
                Valores    = new object[] { CobProceso.Id_Emp, CobProceso.Id_Cd, CobProceso.SvtasAlm, CobProceso.EmbAlm, CobProceso.EntAlm, CobProceso.AlmCob, CobProceso.RevCob };
                sqlcmd     = CapaDatos.GenerarSqlCommand("spCatConfCobranzaProceso_Guardar", ref verificador, Parametros, Valores);

                CapaDatos.CommitTrans();
                CapaDatos.LimpiarSqlcommand(ref sqlcmd);
            }
            catch (Exception ex)
            {
                CapaDatos.RollBackTrans();
                throw ex;
            }
        }
Ejemplo n.º 24
0
 public void QuitarRegla(int idRegla)
 {
     Reglas.Remove(idRegla);
 }
Ejemplo n.º 25
0
        //CONTROL DE REGLAS DEL NEGOCIO
        public bool actualizarReglas(Reglas regla)
        {
            bool OK = true;
            try
            {

                string sql = "prendasal.SP_SET_REGLAS";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter nivel = cmd.Parameters.Add("nivelR", MySqlDbType.Int32);
                nivel.Direction = ParameterDirection.Input;
                MySqlParameter fecha = cmd.Parameters.Add("fechaR", MySqlDbType.Date);
                fecha.Direction = ParameterDirection.Input;
                MySqlParameter auto = cmd.Parameters.Add("autorizoR", MySqlDbType.VarChar, 15);
                auto.Direction = ParameterDirection.Input;
                MySqlParameter t_mensual = cmd.Parameters.Add("t_mensual", MySqlDbType.Decimal);
                t_mensual.Direction = ParameterDirection.Input;
                MySqlParameter t_15 = cmd.Parameters.Add("t_15", MySqlDbType.Decimal);
                t_15.Direction = ParameterDirection.Input;
                MySqlParameter p_contrato = cmd.Parameters.Add("p_contrato", MySqlDbType.Int32);
                p_contrato.Direction = ParameterDirection.Input;
                MySqlParameter p_vencido = cmd.Parameters.Add("p_vencido", MySqlDbType.Int32);
                p_vencido.Direction = ParameterDirection.Input;
                MySqlParameter descuento_c = cmd.Parameters.Add("descuento_c", MySqlDbType.Decimal);
                descuento_c.Direction = ParameterDirection.Input;
                MySqlParameter descuento_i = cmd.Parameters.Add("descuento_i", MySqlDbType.Decimal);
                descuento_i.Direction = ParameterDirection.Input;
                MySqlParameter puntos_d = cmd.Parameters.Add("puntos_d", MySqlDbType.Int32);
                puntos_d.Direction = ParameterDirection.Input;
                MySqlParameter puntos_v = cmd.Parameters.Add("puntos_v", MySqlDbType.Decimal);
                puntos_v.Direction = ParameterDirection.Input;

                nivel.Value = (int)regla.NIVEL;
                fecha.Value = regla.FECHA.Date.ToString("yyyy-MM-dd"); ;
                auto.Value = regla.COD_EMPLEADO.ToUpper();
                t_mensual.Value = regla.TASA_MENSUAL;
                p_contrato.Value = regla.PLAZO_CONTRATO;
                p_vencido.Value = regla.PLAZO_VENCIDO;
                descuento_c.Value = regla.DESC_COMPRA;
                descuento_i.Value = regla.DESC_INTERES;
                puntos_d.Value = regla.PUNTOS_DOLAR;
                puntos_v.Value = regla.PUNTOS_VALOR;

                cmd.ExecuteNonQuery();
                MessageBox.Show("PARAMETROS DE NEGOCIO ACTUALIZADOS", "OPERACION FINALIZADA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception e)
            {
                OK = false;
                MessageBox.Show(null, e.Message, "ERROR AL ACTUALIZAR PARAMETROS DE NEGOCIO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return OK;
        }
Ejemplo n.º 26
0
 public void Consultar(ref List <PeriodoGracia> list_gracia, ref List <Acciones> list_acciones, ref List <Alertas> list_alertas, int Id_Emp, string db, ref Reglas reglas, string Conexion)
 {
     try
     {
         CD_ConfiguracionCobranza confCobranza = new CD_ConfiguracionCobranza();
         confCobranza.Consultar(ref list_gracia, ref list_acciones, ref list_alertas, Id_Emp, db, ref reglas, Conexion);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 27
0
 public void AgregarRegla(int idRegla)
 {
     Reglas.Add(idRegla);
 }
Ejemplo n.º 28
0
 public void cargarParametros()
 {
     REGLAS = Reglas.ConvertToReglas(dbPrendasal.getReglas(eNIVEL.AMIGO));
     if (REGLAS != null)
     {
         TasaMensual_AMIGO.Value = (decimal) REGLAS.TASA_MENSUAL;
         PlazoContrato_AMIGO.Value = REGLAS.PLAZO_CONTRATO;
         PlazoVencido_AMIGO.Value = REGLAS.PLAZO_VENCIDO;
         DescCompras_AMIGO.Value = (decimal)REGLAS.DESC_COMPRA;
         DescInteres_AMIGO.Value = (decimal)REGLAS.DESC_INTERES;
         PuntosDolar_AMIGO.Value = (decimal)REGLAS.PUNTOS_DOLAR;
         PuntosValor_AMIGO.Value = REGLAS.PUNTOS_VALOR;
     }
 }