Example #1
0
        protected virtual void SetChargeStatusAction()
        {
            EEstado[] estados = new EEstado[3] {
                EEstado.Pendiente, EEstado.Charged, EEstado.Devuelto
            };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(estados));
            try
            {
                Datos.RaiseListChangedEvents = false;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ComboBoxSource item = form.Selected as ComboBoxSource;

                    _entity.EstadoCobro = item.Oid;
                    EstadoCobro_TB.Text = _entity.EstadoCobroLabel;
                }
            }
            finally
            {
                Datos.RaiseListChangedEvents = true;
            }
        }
Example #2
0
        /// <summary>
        /// metodo que cambia el estado del paquete e invoca a informar estado
        /// </summary>
        public void MockCicloDeVida()
        {
            while (this.Estado != EEstado.Entregado)
            {
                System.Threading.Thread.Sleep(500);

                if (this.Estado == EEstado.Ingresando)
                {
                    this.Estado = EEstado.EnViaje;
                }
                else
                {
                    this.Estado = EEstado.Entregado;
                }

                InformaEstado.Invoke(new object { }, EventArgs.Empty);
            }

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception e)
            {
                SQLError.Invoke(e.Message);
            }
        }
        public void CambiarEstado()
        {
            while (this.estado != EEstado.Entregado)
            {
                try
                {
                    //c. Informar el estado a través de InformarEstado. EventArgs no tendrá ningún dato extra.
                    this.InformarEstado.Invoke(this, null);
                    Thread.Sleep(3000);
                    switch (this.estado)
                    {
                    case EEstado.Ingresado:
                        this.estado = EEstado.EnViaje;
                        break;

                    case EEstado.EnViaje:
                        this.estado = EEstado.Entregado;
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
        /// <summary>
        /// Metodo para cambiar el estado del producto en el momento que se ejecuta el hilo.
        /// </summary>
        public void CambiarEstado()
        {
            while (this.estado != Producto.EEstado.Fabricado)
            {
                switch (this.estado)
                {
                case Producto.EEstado.SinComenzar:
                    this.estado = Producto.EEstado.RecolectandoIngredientes;
                    this.InformaEstado(this, EventArgs.Empty);
                    break;

                case Producto.EEstado.RecolectandoIngredientes:
                    Thread.Sleep(1000);
                    this.estado = Producto.EEstado.Elaborando;
                    this.InformaEstado(this, EventArgs.Empty);
                    break;

                case Producto.EEstado.Elaborando:
                    Thread.Sleep(1000);
                    this.estado = Producto.EEstado.Empaquetando;
                    this.InformaEstado(this, EventArgs.Empty);
                    break;

                case Producto.EEstado.Empaquetando:
                    Thread.Sleep(1000);
                    this.estado = Producto.EEstado.Fabricado;
                    this.InformaEstado(this, EventArgs.Empty);
                    break;

                default:
                    break;
                }
            }
            this.estado = EEstado.SinComenzar;
        }
Example #5
0
        /// <summary>
        /// Metodo que sera llamado ejecutado en el hilo y sera el encargado de actualizar el estado de la venta.
        /// El cambio de estado es una simulacion, automaticamente se cambia al siguiente estado luego de 3 segundos.
        /// Cuando la venta se cambia de estado, el evento CambioEstado (delegado) es llamado y se realizaran las actualizaciones
        /// en la interfaz grafica y base de datos asi como logs.
        /// Se le envia al evento la venta.
        /// </summary>
        /// <returns></returns>
        public void ProcesarVenta()
        {
            try
            {
                Thread.Sleep(1000);
                this.CambioEstado(this, EventArgs.Empty);
                while (this.estado != EEstado.Finalizada)
                {
                    if (this.estado == EEstado.Iniciada)
                    {
                        Thread.Sleep(3000);
                        this.estado = EEstado.Procesando;
                    }
                    else
                    {
                        Thread.Sleep(3000);
                        this.estado = EEstado.Finalizada;
                    }

                    this.CambioEstado(this, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
        public void MockCicloCajero()
        {
            while (this.estado != EEstado.Atendido)
            {
                switch (this.estado)
                {
                case EEstado.Ingresado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Cobrado;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                case EEstado.Cobrado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Atendido;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                default:
                    break;
                }
            }
            try
            {
                // this, referencia a la instancia.
                InformaCajero.Invoke(this);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Example #7
0
 protected void ChangeStates(EEstado estado)
 {
     foreach (DataGridViewRow row in LineaRegistros_DGW.Rows)
     {
         ChangeState(row, estado);
     }
 }
Example #8
0
        /// <summary>
        /// Hará que el paquete cambie de estado
        /// </summary>
        public void MockCicloDeVida()
        {
            //Recorremos los estados del paquete con un while
            while (this.estado != EEstado.Entregado)
            {
                Thread.Sleep(4000);//Genera una demora de 4 segundos

                if (this.Estado != EEstado.Entregado && this.Estado != EEstado.EnViaje)
                {
                    this.Estado = EEstado.EnViaje;
                }

                else if (this.Estado != EEstado.Entregado && this.Estado == EEstado.EnViaje)
                {
                    this.estado = EEstado.Entregado;
                }

                this.InformaEstado.Invoke(null, null);

                if (this.estado == EEstado.Entregado)
                {
                    try
                    {
                        PaqueteDAO.Insertar(this);
                    }

                    catch (Exception)
                    {
                    }
                }
            }
        }
Example #9
0
        public void MockCicloDeVida()
        {
            bool ok = false;

            while (!ok)
            {
                Thread.Sleep(10000);
                if (this._estado == EEstado.Ingresado)
                {
                    this._estado = EEstado.EnViaje;
                }
                else if (this._estado == EEstado.EnViaje)
                {
                    this._estado = EEstado.Entregado;
                }
                else if (this._estado == EEstado.Entregado)
                {
                    try
                    {
                        PaqueteDAO.Insertar(this);
                    }
                    catch (Exception e)
                    {
                        InformaEstado(e, null);
                    }
                    finally
                    {
                        ok = true;
                    }
                }
                InformaEstado(this, null);
            }
        }
Example #10
0
        /// <summary>
        /// Hace que el paquete cambie de estado y llama a funcion que agrega sus datos en la base de datos
        /// </summary>
        public void MockCicloDeVida()
        {
            while (this.estado != EEstado.Entregado)
            {
                Thread.Sleep(4000);

                switch (this.estado)
                {
                case EEstado.Ingresado:
                {
                    this.estado = EEstado.EnViaje;
                }
                break;

                case EEstado.EnViaje:
                {
                    this.estado = EEstado.Entregado;
                }
                break;
                }

                this.InformaEstado(this, new EventArgs());
            }

            PaqueteDAO.Insertar(this);
        }
Example #11
0
        /// <summary>
        /// Simula el ciclo de vida de un paquete, cambiado su estado desde el inicio del viaje hasta entregado,
        /// lanzando un evento ante cada cambio e insertandolo en la base de datos al finalizar.
        /// </summary>
        public void MockCicloDeVida()
        {
            while (this.estado != EEstado.Entregado)
            {
                Thread.Sleep(4000);
                switch (this.estado)
                {
                case EEstado.Ingresado:
                    this.estado = EEstado.EnViaje;
                    break;

                case EEstado.EnViaje:
                    this.estado = EEstado.Entregado;
                    break;
                }

                this.InformaEstado.Invoke(this.estado, EventArgs.Empty);
            }

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception ex)
            {
                throw new Exception("Error al Insertar", ex);
            }
        }
Example #12
0
        public static string ESTADO_CONDITION(EEstado estado, string tableAlias)
        {
            string query = string.Empty;

            switch (estado)
            {
            case EEstado.Todos:
                break;

            case EEstado.NoAnulado:
                query += " AND " + tableAlias + ".\"ESTADO\" != " + (long)EEstado.Anulado;
                break;

            case EEstado.NoOculto:
                query += " AND " + tableAlias + ".\"ESTADO\" != " + (long)EEstado.Oculto;
                break;

            default:
                query += " AND " + tableAlias + ".\"ESTADO\" = " + (long)estado;
                break;
            }

            return(@"" +
                   query);
        }
        /// <summary>
        /// Hace que el paquete cambie de forma
        /// </summary>
        public void MockCicloDeVida()
        {
            do
            {
                Thread.Sleep(4000);


                if (this.estado == EEstado.Ingresado)
                {
                    this.estado = EEstado.EnViaje;
                }
                else if (this.estado == EEstado.EnViaje)
                {
                    this.estado = EEstado.Entregado;
                }

                this.InformaEstado(this.estado, EventArgs.Empty);
            } while (this.estado != EEstado.Entregado);

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Example #14
0
        /// <summary>
        /// MockCicloDeVida hará que el paquete cambie de estado de la siguiente forma:
        //a.Colocar una demora de 4 segundos.
        //b.Pasar al siguiente estado.
        //c.Informar el estado a través de InformarEstado. EventArgs no tendrá ningún dato extra.
        //d.Repetir las acciones desde el punto A hasta que el estado sea Entregado.
        //e.Finalmente guardar los datos del paquete en la base de datos
        /// </summary
        public void MockCicloDeVida()
        {
            do
            {
                Thread.Sleep(4000);                   //a

                if (this.estado == EEstado.Ingresado) //b
                {
                    this.estado = EEstado.EnViaje;
                }
                else if (this.estado == EEstado.EnViaje)
                {
                    this.estado = EEstado.Entregado;
                }

                this.InformaEstado(this.estado, new EventArgs()); //c
            } while (this.estado != EEstado.Entregado);           //d
            try
            {
                PaqueteDAO.Insertar(this); //e
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #15
0
 public Paquete(string direccionEntrega, string trackingId)
 {
     this.estado = EEstado.Ingresado;
     // this.Event1 += InformaEstado;
     this.direccionEntrega = direccionEntrega;
     this.trackingID       = trackingId;
 }
Example #16
0
        /// <summary>
        ///     Cambia el estado del paquete cada hasta que este sea entregado y lo guarda en la base de datos.
        /// </summary>
        public void MockCicloDeVida()
        {
            do
            {
                if (this.estado == EEstado.Ingresado)
                {
                    Thread.Sleep(4000);
                    this.estado = EEstado.EnViaje;
                }
                else if (this.estado == EEstado.EnViaje)
                {
                    Thread.Sleep(4000);
                    this.estado = EEstado.Entregado;
                }

                this.InfornmarEstado.Invoke(this, EventArgs.Empty);
            } while (this.estado != EEstado.Entregado);

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception)
            {
                throw new Exception("Error! Al momento de guardar en la base de datos");
            }
        }
Example #17
0
        /// <summary>
        /// Lista a sequnece de cargo
        /// </summary>
        /// <returns>Um inteiro, número da sequence</returns>
        private int Sequence()
        {
            try
            {
                //Abre conexão
                conn.Open();
                //Sql da consulta
                sql = "select ";
                //Executa consulta
                conn.ExecuteReader(sql);

                EEstado estado = ConvertList(conn)[0];

                int sequence = estado.IsnEstado;

                //Retorna Item
                return(sequence);
            }
            catch (Exception e)
            {
                //Exceção
                throw e;
            }
            finally
            {
                //Fecha conexão
                conn.Close();
            }
        }
Example #18
0
        /// <summary>
        /// Altera um novo estado
        /// </summary>
        /// <param name="usuario">Recebe a entidade estado como parametro</param>
        /// <returns>Altera corretamente retorna true</returns>
        public bool Alterar(EEstado estado)
        {
            try
            {
                //Abre conexão
                conn.Open();

                //Lista de parametros
                Object[] param = new Object[4];
                param[0] = Sequence();
                param[1] = estado.DscEstado;
                param[2] = estado.DscSigla;
                param[3] = estado.FlgAtivo;

                //Sql do Update
                string sql = "Update into tb_estado set dsc_estado = '{1}', flg_ativo = '{3}', dsc_sigla = '{2}' where isn_estado = {0})";
                //Comando executado
                conn.ExecuteNonQuery(sql, param);
                //retorno
                return(true);
            }
            catch (Exception e)
            {
                //Execeção retorna false
                //*******************Temos que melhorar o tratamento de exceções************
                return(false);
            }
            finally
            {
                //Conexão fechada
                conn.Close();
            }
        }
Example #19
0
        /// <summary>
        /// Genera el ciclo de vida del paquete, cambiando su estado cada 10 segundos
        /// Al llegar al estado entregado, se guarda el paquete en la base de datos especificada en PaqueteDAO
        /// </summary>
        public void MockCicloDeVida()
        {
            do
            {
                Thread.Sleep(10000);
                if (this.estado == EEstado.Ingresado)
                {
                    this.estado = EEstado.EnViaje;
                }
                else
                {
                    this.estado = EEstado.Entregado;
                }
                InformaEstado(this, EventArgs.Empty);
            } while (this.estado != EEstado.Entregado);

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #20
0
        public void SetRowColorIM(DataGridViewRow row, EEstado estado)
        {
            switch (estado)
            {
            case EEstado.Abierto:
                row.DefaultCellStyle.ForeColor = AbiertoStyleIM.ForeColor;
                row.DefaultCellStyle.BackColor = AbiertoStyleIM.BackColor;
                break;

            case EEstado.Anulado:
                row.DefaultCellStyle = AnuladoStyleIM;
                break;
            }

            if (estado != EEstado.Anulado)
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (cell.ReadOnly)
                    {
                        Face.ControlTools.Instance.ApplyStyle(cell, CellStyle.ReadOnly);
                    }
                }
            }
        }
Example #21
0
        protected void ChangeStateAction(EEstado estado)
        {
            if (_entity.EEstado == EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case EEstado.Anulado:
            {
                if (_entity.EEstado == EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(Library.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
            }
            break;
            }

            _entity.EEstado = estado;
        }
Example #22
0
        public void MockCicloDeVida()
        {
            try
            {
                do
                {
                    switch (estado)
                    {
                    case EEstado.Ingresado:
                        Thread.Sleep(4000);
                        estado = EEstado.EnViaje;
                        InformarEstado(this, new EventArgs());
                        break;

                    case EEstado.EnViaje:
                        Thread.Sleep(4000);
                        estado = EEstado.Entregado;
                        InformarEstado(this, new EventArgs());
                        break;
                    }
                } while (estado != EEstado.Entregado);

                PaqueteDAO.Insertar(this);
            }
            catch (Exception ex)
            {
                Notifica.Send(ex.Message, ETipoExcepcion.sql);
                throw ex;
            }
        }
        public static bool GrabarInventario(string codigo, EEstado estado, DateTime fechaInicioReal)
        {
            bool actualizado = false;

            try
            {
                using (var cnn = SQLConexion.Conectar())
                {
                    cnn.Open();
                    var query = new SqlCommand("usp_GrabarInventario", cnn);
                    query.CommandType = CommandType.StoredProcedure;
                    query.Parameters.Add(new SqlParameter("@Codigo", codigo));
                    query.Parameters.Add(new SqlParameter("@Estado", string.Format("{0}", estado)));
                    query.Parameters.Add(new SqlParameter("@FechaInicio", fechaInicioReal));
                    query.ExecuteNonQuery();
                    actualizado = true;
                }
            }
            catch (ArgumentException e)
            {
                throw new Exception(e.Message);
            }

            return(actualizado);
        }
Example #24
0
        /// <summary>
        /// Retorna la cantidad de certificados aceptados o rechazados
        /// </summary>
        /// <param name="listaCertificados"></param>
        /// <param name="estado"></param>
        /// <returns></returns>
        private int ObtenerCantidadCertificados(ArrayList listaCertificados, EEstado estado)
        {
            int cantidad = 0;

            try
            {
                if (estado == EEstado.aceptado)
                {
                    foreach (CertificadosRecProcesados certificadoRecProcesado in listaCertificados)
                    {
                        if (certificadoRecProcesado.Aprobado)
                        {
                            cantidad++;
                        }
                    }
                }
                else if (estado == EEstado.rechazado)
                {
                    foreach (CertificadosRecProcesados certificadoRecProcesado in listaCertificados)
                    {
                        if (!certificadoRecProcesado.Aprobado)
                        {
                            cantidad++;
                        }
                    }
                }
            }
            catch (Exception)
            {
                //SAPbouiCOM.Framework.Application.SBO_Application.MessageBox("RespuestaConsultaCFE/Error: " + ex.ToString());
            }

            return(cantidad);
        }
Example #25
0
        public static Traspaso ChangeEstado(long oid, EEstado estado)
        {
            Traspaso item = null;

            try
            {
                item = Traspaso.Get(oid, false);
                TraspasoInfo oldItem = item.GetInfo(false);

                EntityBase.CheckChangeState(item.EEstado, estado);

                item.BeginEdit();
                item.EEstado = estado;

                if (estado == EEstado.Anulado)
                {
                    BankLine.EditItem(item, oldItem, item.SessionCode);
                }

                item.ApplyEdit();
                item.Save();
            }
            finally
            {
                if (item != null)
                {
                    item.CloseSession();
                }
            }

            return(item);
        }
        public static bool GrabarInventario(string codigo, EEstado estado, DateTime fechaInicioReal)
        {
            bool actualizado = false;

            try
            {
                using (var cnn = SQLConexion.Conectar())
                {
                    cnn.Open();
                    var query = new SqlCommand("usp_GrabarInventario", cnn);
                    query.CommandType = CommandType.StoredProcedure;
                    query.Parameters.Add(new SqlParameter("@Codigo", codigo));
                    query.Parameters.Add(new SqlParameter("@Estado", string.Format("{0}" ,estado)));
                    query.Parameters.Add(new SqlParameter("@FechaInicio", fechaInicioReal));
                    query.ExecuteNonQuery();
                    actualizado = true;
                }
            }
            catch (ArgumentException e)
            {
                throw new Exception(e.Message);
            }

            return actualizado;
        }
Example #27
0
        public void EliminarEstado(EEstado eEstado)
        {
            List <SqlParameter> parametros = new List <SqlParameter>();

            parametros.Add(new SqlParameter("@id", eEstado.Idestado));
            ADatos.EliminarRegistro("Delete from TEstados where IdEstado=@id", parametros);
        }
 public void GrabaInventario(string codigoInventario, EEstado estado, DateTime fechaInicio)
 {
     if (!string.IsNullOrEmpty(codigoInventario))
     {
         InventarioBL.GrabarInventario(codigoInventario, estado, fechaInicio);
     }
     ObtenerInventario(codigoInventario);
 }
 public static bool GrabarInventario(string codigo, EEstado estado, DateTime fechaInicio)
 {
     return InventarioDAL.GrabarInventario(codigo, estado, fechaInicio);
 }