Пример #1
0
        public void CreateTransicionTest()
        {
            ITramitadorFactory target     = CreateITramitadorFactory(); // TODO: Initialize to an appropriate value
            IFlujograma        flujograma = target.CreateFlujograma();

            flujograma.Nombre  = "Flujograma pruebas";
            flujograma.Entidad = "Entidad pruebas";
            IEstado origen = target.CreateEstado(flujograma); // TODO: Initialize to an appropriate value

            origen.Nombre = "Descorigen";
            origen.Estado = 1;
            IEstado destino = target.CreateEstado(flujograma); // TODO: Initialize to an appropriate value

            destino.Nombre        = "DesDestino";
            destino.EsEstadoFinal = true;
            destino.Estado        = 2;
            ITransicion expected = null; // TODO: Initialize to an appropriate value
            ITransicion actual;

            actual = target.CreateTransicion(origen, destino);
            Assert.IsNotNull(origen);
            Assert.IsNotNull(destino);
            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Origen);
            Assert.IsNotNull(actual.Destino);
            Assert.AreEqual <IEstado>(actual.Origen, origen);
            Assert.AreEqual <IEstado>(actual.Destino, destino);
            Assert.AreEqual <int>(actual.Descripcion.Length, 0);
        }
Пример #2
0
        public void CreateTransicionTest2()
        {
            ITramitadorFactory target      = CreateITramitadorFactory(); // TODO: Initialize to an appropriate value
            IFlujograma        flujograma1 = target.CreateFlujograma();

            flujograma1.Nombre  = "Flujograma pruebas 1";
            flujograma1.Entidad = "Entidad pruebas 1";
            IFlujograma flujograma2 = target.CreateFlujograma();

            flujograma2.Nombre  = "Flujograma pruebas 2";
            flujograma2.Entidad = "Entidad pruebas 2";
            IEstado origen = target.CreateEstado(flujograma1); // TODO: Initialize to an appropriate value

            origen.Nombre = "Descorigen";
            origen.Estado = 1;
            IEstado destino = target.CreateEstado(flujograma2); // TODO: Initialize to an appropriate value

            destino.Nombre        = "DesDestino";
            destino.EsEstadoFinal = true;
            destino.Estado        = 2;
            ITransicion expected = null; // TODO: Initialize to an appropriate value
            ITransicion actual;

            try
            {
                actual = target.CreateTransicion(origen, destino);
                Assert.Fail("Debería haber elevado una excepcion Tramitador.NoMismoFlujogramaException");
            }
            catch (Tramitador.NoMismoFlujogramaException)
            {
            }
        }
Пример #3
0
        public CCaldera()
        {
            this.temperatura = 20;
            this.combustible = 60;
            this.alarma      = new CEstadoAlarma(this);
            this.reposo      = new CReposo(this);
            this.calentando  = new CEstadoCalentando(this);

            this.estado = calentando;
        }
Пример #4
0
        public IEstado Remove(IEstado estado)
        {
            IEstado sol = null;

            if (_estados.Remove(Xml.XMLEstado.Tranformar(estado)))
            {
                sol = estado;
            }

            return(sol);
        }
Пример #5
0
 public void Add(IEstado estado)
 {
     foreach (var item in _estados)
     {
         if (item.Estado == estado.Estado)
         {
             throw new ClaveDuplicadaException();
         }
     }
     _estados.Add(XMLEstado.Tranformar(estado));
 }
Пример #6
0
 public ITransicion CreateTransicion(IEstado origen, IEstado destino)
 {
     if (!origen.Flujograma.Equals(destino.Flujograma))
     {
         throw new NoMismoFlujogramaException();
     }
     return(new XMLTransicion()
     {
         Destino = destino, Origen = origen, Flujograma = origen.Flujograma
     });
 }
Пример #7
0
        public void ObtenerEstadoTest()
        {
            ITramitadorFactory target     = CreateITramitadorFactory(); // TODO: Initialize to an appropriate value
            IFlujograma        flujograma = target.CreateFlujograma();  // TODO: Initialize to an appropriate value
            int     estado   = 0;                                       // TODO: Initialize to an appropriate value
            IEstado expected = null;                                    // TODO: Initialize to an appropriate value
            IEstado actual;

            actual = target.ObtenerEstado(flujograma, estado);
            Assert.IsNull(actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #8
0
        public IEstado ObtenerEstado(IFlujograma flujograma, int estado)
        {
            IEstado sol = null;

            foreach (var est in flujograma.Estados)
            {
                if (est.Estado == estado)
                {
                    sol = est;
                    break;
                }
            }

            return(sol);
        }
Пример #9
0
        public void CreateEstadoTest()
        {
            ITramitadorFactory target     = CreateITramitadorFactory(); // TODO: Initialize to an appropriate value
            IFlujograma        flujograma = target.CreateFlujograma();  // TODO: Initialize to an appropriate value

            flujograma.Nombre  = "Mi flujo de pruebas";
            flujograma.Entidad = "Mi entidad";
            IEstado expected = null; // TODO: Initialize to an appropriate value
            IEstado actual;

            actual = target.CreateEstado(flujograma);
            Assert.IsNotNull(actual);
            Assert.AreEqual <IFlujograma>(flujograma, actual.Flujograma);
            Assert.AreEqual <int>(actual.Nombre.Length, 0);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #10
0
        public void ObtenerEstadoTest2()
        {
            ITramitadorFactory target     = CreateITramitadorFactory(); // TODO: Initialize to an appropriate value
            IFlujograma        flujograma = target.CreateFlujograma();  // TODO: Initialize to an appropriate value
            int     estado   = 3;                                       // TODO: Initialize to an appropriate value
            IEstado expected = target.CreateEstado(flujograma);         // TODO: Initialize to an appropriate value

            expected.Estado = 3;
            flujograma.Add(expected);
            IEstado actual;

            actual = target.ObtenerEstado(flujograma, estado);
            Assert.IsNotNull(actual);
            Assert.AreEqual <IEstado>(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #11
0
        public static XMLEstado Tranformar(IEstado estado)
        {
            XMLEstado sol = null;

            if (estado is XMLEstado)
            {
                sol = estado as XMLEstado;
            }
            else
            {
                sol = new XMLEstado();

                sol.Nombre        = estado.Nombre;
                sol.EsEstadoFinal = estado.EsEstadoFinal;
                sol.Estado        = estado.Estado;
                sol.Flujograma    = estado.Flujograma;
            }

            return(sol);
        }
Пример #12
0
        static void Main(string[] args)
        {
            ITramitadorFactory fact = new XMLTramitadorFactory();

            IFlujograma flujo = fact.ObtenerFlujograma("Mi entidad", 0);

            List <IEstado> estados = new List <IEstado>(fact.ObtenerEstados(flujo));
            //IEstado estado=fact.ObtenerEstado(
            //IFlujograma flujo = fact.CreateFlujograma();

            //flujo.Nombre = "Mi flujo de pruebas";
            //flujo.Entidad = "Mi entidad";


            IEstado origen = fact.CreateEstado(flujo);


            //origen.Descripcion = "Estado inicial";


            //IEstado destino = fact.CreateEstado(flujo);

            //destino.Estado = 1;

            //destino.Descripcion = "Estado final";

            ITransicion tr = fact.CreateTransicion(flujo.Estados[2], flujo.Estados[3]);

            trami.OnAntesTransicion += new Tramitador.EnventArgs.DAntesTransicion(trami_OnAntesTransicion);

            trami.Realizar(tr, new MiObjeto());
            //flujo.Add(origen);

            //flujo.Add(destino);

            //flujo.Add(tr);

            //fact.Almacenar(flujo);
        }
Пример #13
0
        protected void Grilla_Periodos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                IEstado         IService = new IEstado();
                List <BEEstado> lstBE    = new List <BEEstado>();
                lstBE = IService.IgetEstados();
                //Find the DropDownList in the Row
                DropDownList ddlCountries = (e.Row.FindControl("ddlCountries") as DropDownList);
                ddlCountries.DataSource     = lstBE;
                ddlCountries.DataTextField  = "descripcion";
                ddlCountries.DataValueField = "codEstado";
                ddlCountries.DataBind();

                ////Add Default Item in the DropDownList
                ////ddlCountries.Items.Insert(0, new ListItem("Please select"));

                //// Select the Country of Customer in DropDownList

                string country = (e.Row.FindControl("lblCountry") as Label).Text;
                ddlCountries.Items.FindByValue(country).Selected = true;
            }
        }
Пример #14
0
 public Lampada(IEstado estado)
 {
     Estado = estado;
 }
Пример #15
0
 public Orcamento()
 {
     this.Itens       = new List <Item>();
     this.EstadoAtual = new EmAprovacao();
 }
Пример #16
0
 public Contexto(IEstado _IEstado)
 {
     this.Transicion(_IEstado);
 }
Пример #17
0
        private void Gravar(IEstado estado)
        {
            DescontoRegra oRegDesc = new DescontoRegra();
            oRegDesc.Descricao = "Primeira Regra Desconto";
            oRegDesc.TipoValor = TipoValor.Percentual;
            oRegDesc.Valor = 10;

            oRegDesc.Filtros = new List<IDescontoRegraFiltro>{
                new DescontoRegraFiltro{
                 TabelaPreco = NovatabelaPreco()
                }
            };
            GUID = oRegDesc.Save();
        }
Пример #18
0
 public Orcamento(double valor)
 {
     Valor       = valor;
     itens       = new List <Item>();
     EstadoAtual = new EmAnalise();
 }
Пример #19
0
 public void Transicion(IEstado _IEstado)
 {
     this.IEstado = _IEstado;
     IEstado.AsignarContexto(this);
 }
Пример #20
0
 public Mario()
 {
     Vidas  = 3;
     Estado = new SmallMario(this);
 }
Пример #21
0
 public void SetEstado(IEstado estado)
 {
     Estado = estado;
 }
Пример #22
0
        public static bool Import(String filePath, IEstado estado, System.Windows.Forms.ProgressBar progress = null, System.Windows.Forms.Label lblprogress = null, bool raiseErrorFileAlreadyImp = true)
        {
            // verifica se arquivo já foi importado
            string md5 = Cryptography.Files.MD5.GetMD5Hash(filePath);
            IList<ILogIBPT> log = new LogIBPT()
                                            .Find<ILogIBPT>(new Where()
                                            {
                                                {
                                                    "sis_logibpt.md5", md5
                                                }
                                            });
            if (log.Count != 0 && raiseErrorFileAlreadyImp)
                throw new ArquivoJaImportado();

            // verifica se arquivo é do mesmo estado da empresa
            String stateEmp = estado.UF.Sigla;
            String stateFile = filePath.Split('\\')
                                        .Last().Substring(12, 2);
            if (!stateEmp.Equals(stateFile))
                throw new EstadoInvalido();

            Connection connection = null;
            int linhas = 0;
            try
            {
                connection = DbContext.CreateConnection();
                connection.BeginTransaction();

                // Abre arquivo para importação
                INCM ncm = null;
                IList<INCM> ncms = new NCM().Find<INCM>();
                String line = null;
                if (progress != null &&
                    lblprogress != null)
                {
                    progress.Maximum = File.ReadAllLines(filePath).Length;
                    progress.Step = 1;
                    lblprogress.Visible = true;
                    lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                    lblprogress.Refresh();
                }
                using (StreamReader str = new StreamReader(filePath, Encoding.Default))
                {

                    while ((line = str.ReadLine()) != null)
                    {
                        string[] sections = line.Split(';');

                        if (linhas == 0 || !String.IsNullOrEmpty(sections[1]))
                        {
                            linhas++;
                            if (progress != null &&
                                lblprogress != null)
                            {
                                progress.Increment(1);
                                lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                                lblprogress.Refresh();
                            }
                            continue;
                        }
                        ncm = ncms.FirstOrDefault(w => w.NCM.Trim() == sections[0]);
                        if (ncm == null) ncm = new NCM();

                        ncm.NCM = sections[0];
                        ncm.IPI = 0;
                        ncm.II = 0;
                        ncm.Descricao = sections[3];
                        ncm.ImpostoAproxEstadual = Unimake.Convert.ToDouble(sections[6]);
                        ncm.ImpostoAproximado = Unimake.Convert.ToDouble(sections[6]);
                        ncm.ImpostoAproxImport = Unimake.Convert.ToDouble(sections[5]);
                        ncm.ImpostoAproxMunicip = Unimake.Convert.ToDouble(sections[7]);
                        ncm.ChaveIBPT = sections[10];
                        ncm.Save();
                        linhas++;
                        if (progress != null &&
                            lblprogress != null)
                        {
                            progress.Increment(1);
                            progress.Refresh();
                            lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                            lblprogress.Refresh();
                        }
                    }
                }

                if (progress != null &&
                            lblprogress != null)
                {
                    lblprogress.Text = "Arquivo importado com sucesso!";
                    lblprogress.Refresh();

                }
                LogIBPT.Save(new LogIBPT()
                {
                    Evento = "Importação de arquivos de NCM",
                    TipoEvento = Enuns.TipoEvento.Import,
                    Caminho = filePath,
                    MD5 = md5
                });
                connection.CommitTransaction();
            }
            catch
            {
                if (connection != null)
                    connection.RollbackTransaction();

                if (progress != null &&
                           lblprogress != null)
                {
                    lblprogress.Text = "Ocorreu algum erro durante a importação!";
                    lblprogress.Refresh();
                }

                throw;
            }
            finally
            {
                if (connection != null)
                    connection.Close();
            }
            return true;
        }
Пример #23
0
 // Use this for initialization
 void Start()
 {
     Estado = new EstadoEnojado(this);
 }
Пример #24
0
 public bool Equals(IEstado other)
 {
     return((!EsEstadoFinal || other.EsEstadoFinal) && (!other.EsEstadoFinal || EsEstadoFinal) &&
            Estado == other.Estado && Nombre.Equals(other.Nombre) &&
            Flujograma.Equals(other.Flujograma));
 }
Пример #25
0
 /// <summary>
 /// Importa NCM do arquivo CSV
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="raiseErrorFileAlreadyImp">Se true, irá lançar o erro e não realizar a importação de arquivos</param>
 /// <exception cref="ArquivoJaImportado"> Lançada quando o arquivo informado em 'filePath' já foi importado pela aplicação.</exception>
 public static bool Import(String filePath, IEstado estado, bool raiseErrorFileAlreadyImp = true)
 {
     return ImportNCM.Import(filePath, estado, null, null, raiseErrorFileAlreadyImp);
 }
Пример #26
0
 public void AlterarEstado(Conta conta, IEstado novoEstado)
 {
     conta.EstadoConta = novoEstado;
 }
Пример #27
0
 public EstadoController(IEstado service)
 {
     _service = service;
 }
Пример #28
0
        public bool Equals(XMLEstado other)
        {
            IEstado otro = other;

            return(Equals(other as IEstado));
        }
Пример #29
0
 public ITransicion CreateTransicion(IEstado origen, IEstado destino)
 {
     if (!origen.Flujograma.Equals(destino.Flujograma))
         throw new NoMismoFlujogramaException();
     return new XMLTransicion() { Destino = destino, Origen = origen, Flujograma = origen.Flujograma };
 }
Пример #30
0
 // Use this for initialization
 void Start()
 {
     Estado = new EstadoEnojado(this);
 }