Exemplo n.º 1
0
    //metodo que registra a doarção de sangue
    //public void doarSangue(Doador doador, Receptor recptor){
    public bool doarSangue(int codDoador, int codRecptor)
    {
        bool deuCerto = false;

        Doador   doador  = doadores[codDoador];
        Receptor recptor = recptores[codRecptor];

        if (doador.podeDoar() && recptor.podeReceber(doador.getTipoSanguineo()))
        {
            string registro = $"Doado sangue de {doador.getNome()} do tipo {doador.getTipoSanguineo()} para {recptor.getNome()} do tipo {recptor.getTipoSanguineo()}";

            ComunicaoArquivo.escreva(registro, "registro_doacoes.txt");

            //doadores.RemoveAt(doadores.IndexOf(doador));
            //recptores.RemoveAt(recptores.IndexOf(recptor));

            doadores.RemoveAt(doadores.IndexOf(doador));
            recptores.RemoveAt(recptores.IndexOf(recptor));

            deuCerto = true;
        }
        else
        {
            string registro = $"Rejeicao: Sangue, idade ou peso do {doador.getNome()} não permite doar para {recptor.getNome()}, cujo o tipo sanguineo do {doador.getNome()} é {doador.getTipoSanguineo()}";

            ComunicaoArquivo.escreva(registro, "registro_doacoes.txt");

            deuCerto = false;
        }

        return(deuCerto);
    }
Exemplo n.º 2
0
    void CalculateRays(Vector3 point, Vector3 direction, int index)
    {
        RaycastHit2D hit = Physics2D.Raycast(point, direction, range, collisionMask);

        // Debug.Log("Raycast "+ index +": "+ point + " direction "+ direction);
        if (index >= maxReflection + 2)
        {
            DrawRays(index);
        }
        else if (hit.collider != null && index < maxReflection + 2)
        {
            // Case where the laser reach something
            points[index] = hit.point;
            GameObject go = hit.collider.gameObject;
            if (go.GetComponent <Receptor>() != null)
            {
                // If it is a receptor : stop and activate
                DrawRays(index + 1);
                go.GetComponent <Receptor>().On(gameObject);
                toDeactivate = go.GetComponent <Receptor>();
            }
            else if (go.layer == LayerMask.NameToLayer("Reflector"))
            {
                // If it is a reflector : continue
                Vector3 dir   = Vector3.Reflect(-direction, hit.collider.transform.up);
                float   angle = Vector3.Angle(-direction, dir);
                if (angle != 180)
                {
                    CalculateRays(new Vector3(hit.point.x, hit.point.y, transform.parent.position.z) + (dir * 0.15f), dir, index + 1);
                }
                else
                {
                    // Case where the laser is parallele to the reflector
                    DrawRays(index + 1);
                    if (toDeactivate != null)
                    {
                        toDeactivate.Off(gameObject);
                    }
                }
            }
            else
            {
                // If it is an obstacle : stop
                DrawRays(index + 1);
                if (toDeactivate != null)
                {
                    toDeactivate.Off(gameObject);
                }
            }
        }
        else
        {
            // Case where the laser doesn't touch anything
            points[index] = point + (direction * range);
            if (toDeactivate != null)
            {
                toDeactivate.Off(gameObject);
            }
        }
    }
Exemplo n.º 3
0
        public ReceptorEditViewModel(Receptor receptor)
        {
            if (receptor == null)
            {
                throw new ArgumentNullException("receptor");
            }

            this.PublicKey = receptor.PublicKey;

            this.RFC    = receptor.RFC;
            this.Nombre = receptor.Nombre;

            if (receptor.Domicilio != null)
            {
                this.Domicilio = new UbicacionViewModel(receptor.Domicilio);
                //    this.Calle = emisor.DomicilioFiscal.Calle;
                //    this.NoExterior = emisor.DomicilioFiscal.NoExterior;
                //    this.NoInterior = emisor.DomicilioFiscal.NoInterior;
                //    this.Colonia = emisor.DomicilioFiscal.Colonia;
                //    this.Localidad = emisor.DomicilioFiscal.Localidad;
                //    this.Municipio = emisor.DomicilioFiscal.Municipio;
                //    this.Estado = emisor.DomicilioFiscal.Estado;
                //    this.Pais = emisor.DomicilioFiscal.Pais;
                //    this.CodigoPostal = emisor.DomicilioFiscal.CodigoPostal;
                //    this.Referencia = emisor.DomicilioFiscal.Referencia;
            }
            ////this.RegimenFiscal = emisor.RegimenFiscal;

            //this.Correo = emisor.Correo;
            //this.Telefono = emisor.Telefono;
            //this.CifUrl = emisor.CifUrl;
            //this.LogoUrl = emisor.LogoUrl;
        }
Exemplo n.º 4
0
 public Task(string _Id, GameObject _Coordinates, StandardAgent _Emisor, Receptor _Receptor)
 {
     Id          = _Id;
     Coordinates = _Coordinates;
     Emisor      = _Emisor;
     receptor    = _Receptor;
 }
Exemplo n.º 5
0
        public static Doacao ObterInstanciaDoacao()
        {
            CompraDoacao compraDoacao = ObterInstanciaCompraDoacao();
            Receptor     receptor     = ObterInstanciaReceptor();

            return(Doacao.Create(compraDoacao.IdCompraDoacao, receptor.IdReceptor, DOACAO_DATADOACAO, DOACAO_DATARETIRADA));
        }
Exemplo n.º 6
0
        // GET: Receptors/Edit/5
        public async Task <ActionResult> Edit(string code = "")
        {
            if (code == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Receptor receptor = await db.Receptors.Where(r => r.receptor_code == code).FirstOrDefaultAsync(); //await db.Receptors.FindAsync(id);

            if (receptor == null)
            {
                return(HttpNotFound());
            }
            IEnumerable <SelectListItem> items = db.Zones.Select(z => new SelectListItem {
                Value = z.state_name, Text = z.state_name
            });
            IEnumerable <SelectListItem> issuers = db.Issuers.Select(iss => new SelectListItem {
                Value = iss.issuer_code, Text = iss.issuer_name
            });
            IEnumerable <SelectListItem> agents = db.TaxAgents.Select(t => new SelectListItem {
                Value = t.agent_code, Text = t.first_name + " " + t.last_name
            });

            ViewBag.IssuersList = issuers;
            ViewBag.zones       = items;
            ViewBag.agents      = agents;
            return(View(receptor));
        }
        public void Receptor_excluirconta()
        {
            Receptor receptor = InstanciasClasses.ObterInstanciaReceptor();

            receptor.ExcluirConta();
            Assert.False(receptor.Ativo);
        }
        public void Receptor_alterardados()
        {
            string  nome     = "Teste565";
            string  telefone = "11-2222-3333";
            string  cpf      = "66735956044";
            string  endereco = "Rua escura";
            int     numero   = 2;
            string  cidade   = "Tiradentes";
            string  estado   = "Brasilia";
            string  email    = "*****@*****.**";
            decimal renda    = 23.67m;

            Receptor receptor = InstanciasClasses.ObterInstanciaReceptor();

            receptor.AlterarDados(nome, telefone, cpf, endereco, numero, cidade, estado, email, renda);
            Assert.Equal(nome, receptor.Nome);
            Assert.Equal(telefone, receptor.Telefone);
            Assert.Equal(cpf, receptor.CPF);
            Assert.Equal(endereco, receptor.Endereco);
            Assert.Equal(numero, receptor.Numero);
            Assert.Equal(cidade, receptor.Cidade);
            Assert.Equal(estado, receptor.Estado);
            Assert.Equal(email, receptor.Email);
            Assert.Equal(renda, receptor.Renda);
        }
Exemplo n.º 9
0
        public static void ImprimirElementosReceptor(XDocument doc, string filePath, Receptor receptor, int index)
        {
            var documento = _documento + "-" + index;

            var receptorElemento = new XElement(_receptor);

            doc.Element(_transaccion).Element(documento).Element(_encabezado).Add(receptorElemento);

            var elementoReceptor = new XElement("RUTRECEP", receptor.RutRecep);

            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            elementoReceptor = new XElement("RZNSOCRECEP", receptor.RznSocRecep);
            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            elementoReceptor = new XElement("CONTACTO", receptor.Contacto);
            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            elementoReceptor = new XElement("DIRRECEP", receptor.DirRecep.Length > 15 ? receptor.DirRecep.Substring(0, 15) : receptor.DirRecep);
            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            elementoReceptor = new XElement("CMNARECEP", receptor.CmnaRecep.Length > 15 ? receptor.CmnaRecep.Substring(0, 15) : receptor.CmnaRecep);
            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            elementoReceptor = new XElement("CIUDADRECEP", receptor.CiudadRecep.Length > 15 ? receptor.CiudadRecep.Substring(0, 15) : receptor.CiudadRecep);
            doc.Element(_transaccion).Element(documento).Element(_encabezado).Element(_receptor).Add(elementoReceptor);

            doc.Save(filePath);
        }
Exemplo n.º 10
0
        public static List <Receptor> ListarReceptores()
        {
            SqlConnection conexion    = null;
            SqlDataReader lectorDatos = null;

            try
            {
                conexion = new SqlConnection(DatosConexion.CadenaConexion);

                SqlCommand comando = conexion.CreateCommand();
                comando.CommandText = "ListarReceptores";
                comando.CommandType = CommandType.StoredProcedure;

                conexion.Open();

                lectorDatos = comando.ExecuteReader();

                List <Receptor> cod = new List <Receptor>();

                Receptor ag = null;

                while (lectorDatos.Read())
                {
                    TipoDocumentoType Documento         = PTipoDocumentoType.BuscarTipoDocumento((int)lectorDatos["TipoDocRecep"]);
                    NumeroDocumento   NumeroDeDocumento = new NumeroDocumento(Documento, (string)lectorDatos["DocRecep"]);
                    PaisType          Pais          = PPaisType.BuscarPaisType((string)lectorDatos["CodPaisRecep"]);
                    string            RznSocRecep   = (string)lectorDatos["RznSocRecep"];
                    string            DirRecep      = (string)lectorDatos["DirRecep"];
                    string            CiudadRecep   = (string)lectorDatos["CiudadRecep"];
                    string            DeptoRecep    = (string)lectorDatos["DeptoRecep"];
                    string            CP            = (string)lectorDatos["CP"];
                    string            InfoAdicional = (string)lectorDatos["InfoAdicional"];
                    string            LugarDestEnt  = (string)lectorDatos["LugarDestEnt"];
                    string            CompraID      = (string)lectorDatos["CompraID"];
                    ag = new Receptor(NumeroDeDocumento, Pais, RznSocRecep, DirRecep,
                                      CiudadRecep, DeptoRecep, CP, InfoAdicional, LugarDestEnt, CompraID);
                    ag.Id = (int)lectorDatos["Id"];
                    cod.Add(ag);
                }

                return(cod);
            }
            catch (Exception ex)
            {
                throw new ExcepcionesPersonalizadas.Persistencia("No se pudo conseguir las listas de " + mensaje + ex.Message + ".");
            }
            finally
            {
                if (lectorDatos != null)
                {
                    lectorDatos.Close();
                }

                if (conexion != null)
                {
                    conexion.Close();
                }
            }
        }
Exemplo n.º 11
0
        public void ReceptorSimpleTest()
        {
            Receptor receptor = new Receptor(0.5f, 0.5f, 0.99f, 0.99f);

            bool state = receptor.GetReceptorState(26, 26, 50, 50);

            Assert.IsTrue(state, "The receptor doesn't detected the point");
        }
Exemplo n.º 12
0
        public static Receptor BuscarReceptor(int Id)
        {
            SqlConnection conexion    = null;
            SqlDataReader lectorDatos = null;

            try
            {
                conexion = new SqlConnection(DatosConexion.CadenaConexion);

                SqlCommand comando = conexion.CreateCommand();
                comando.CommandText = "BuscarReceptor";
                comando.CommandType = CommandType.StoredProcedure;

                comando.Parameters.AddWithValue("@id", Id);

                conexion.Open();

                lectorDatos = comando.ExecuteReader();

                Receptor ret = null;

                if (lectorDatos.Read())
                {
                    TipoDocumentoType Documento         = PTipoDocumentoType.BuscarTipoDocumento((int)lectorDatos["TipoDocRecep"]);
                    NumeroDocumento   NumeroDeDocumento = new NumeroDocumento(Documento, (string)lectorDatos["DocRecep"]);
                    PaisType          Pais          = PPaisType.BuscarPaisType((string)lectorDatos["CodPaisRecep"]);
                    string            RznSocRecep   = (string)lectorDatos["RznSocRecep"];
                    string            DirRecep      = Convert.ToString(lectorDatos["DirRecep"]);
                    string            CiudadRecep   = Convert.ToString(lectorDatos["CiudadRecep"]);
                    string            DeptoRecep    = Convert.ToString(lectorDatos["DeptoRecep"]);
                    string            CP            = Convert.ToString(lectorDatos["CP"]);
                    string            InfoAdicional = Convert.ToString(lectorDatos["InfoAdicional"]);
                    string            LugarDestEnt  = Convert.ToString(lectorDatos["LugarDestEnt"]);
                    string            CompraID      = Convert.ToString(lectorDatos["CompraID"]);
                    ret = new Receptor(NumeroDeDocumento, Pais, RznSocRecep, DirRecep,
                                       CiudadRecep, DeptoRecep, CP, InfoAdicional, LugarDestEnt, CompraID);
                    ret.Id = Id;
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw new ExcepcionesPersonalizadas.
                      Persistencia("No se pudo buscar " + mensaje + ".");
            }
            finally
            {
                if (lectorDatos != null)
                {
                    lectorDatos.Close();
                }

                if (conexion != null)
                {
                    conexion.Close();
                }
            }
        }
Exemplo n.º 13
0
        public void Doacao_instancia_direto()
        {
            CompraDoacao compraDoacao = InstanciasClasses.ObterInstanciaCompraDoacao();
            Receptor     receptor     = InstanciasClasses.ObterInstanciaReceptor();

            Doacao doacao = Doacao.Create(compraDoacao.IdCompraDoacao, receptor.IdReceptor, InstanciasClasses.DOACAO_DATADOACAO, InstanciasClasses.DOACAO_DATARETIRADA);

            Assert.IsType <Doacao>(doacao);
        }
Exemplo n.º 14
0
        public async Task <ActionResult> DeleteConfirmed(string code)
        {
            Receptor receptor = await db.Receptors.Where(r => r.receptor_code == code).FirstOrDefaultAsync();

            db.Receptors.Remove(receptor);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 15
0
        public static void DatosReceptor(DataSet dstinvoicexml, Receptor receptor, DatosGenerales datosGenerales)
        {
            foreach (DataRow reader in dstinvoicexml.Tables[0].Rows)
            {
                var CorreoReceptor = reader["correoreceptor"];
                if (CorreoReceptor != null)
                {
                    receptor.CorreoReceptor = CorreoReceptor.ToString();
                }
                var IDReceptor = reader["idreceptor"];
                if (IDReceptor != null)
                {
                    receptor.IDReceptor = IDReceptor.ToString();
                }
                var NombreReceptor = reader["nombrereceptor"];
                if (NombreReceptor != null)
                {
                    receptor.NombreReceptor = NombreReceptor.ToString();
                    Constants.RECEPTOR      = NombreReceptor.ToString();
                }

                var Direccion = reader["direccionReceptor"];
                if (Direccion != null)
                {
                    receptor.Direccion = Direccion.ToString();
                }
                var CodigoPostal = reader["codigoPostalReceptor"];
                if (CodigoPostal != null)
                {
                    receptor.CodigoPostal = CodigoPostal.ToString();
                }
                var Municipio = reader["municipioReceptor"];
                if (Municipio != null)
                {
                    receptor.Municipio = Municipio.ToString();
                }
                var Departamento = reader["departamentoReceptor"];
                if (Departamento != null)
                {
                    receptor.Departamento = Departamento.ToString();
                }
                var Pais = reader["paisReceptor"];
                if (Pais != null)
                {
                    receptor.Pais = Pais.ToString();
                }

                var exento = reader["exenta"];
                if (exento != null)
                {
                    if (exento.ToString() == "SI")
                    {
                        Constants.EXENTA = true;
                    }
                }
            }
        }
Exemplo n.º 16
0
        public static void DarAltaReceptor(Receptor a, out int id)
        {
            ValidarReceptor(a);

            if (PReceptor.AltaReceptor(a, out id) == -1)
            {
                throw new ExcepcionesPersonalizadas.Logica("El " + mensaje + " ya se encuentra en la BD.");
            }
        }
Exemplo n.º 17
0
        public static void ModificarReceptor(Receptor a)
        {
            ValidarReceptor(a);

            if (PReceptor.ModificarReceptor(a) == -1)
            {
                throw new ExcepcionesPersonalizadas.Logica("No se encontró el " + mensaje + ".");
            }
        }
Exemplo n.º 18
0
        public void SetReceptor(Receptor receptor)
        {
            if (this.receptor != null)
            {
                throw new InvalidOperationException("Cannot set a new receptor when one is already active");
            }

            this.receptor = receptor;
        }
Exemplo n.º 19
0
        public static Receptor BuscarReceptor(int id)
        {
            Receptor a = PReceptor.BuscarReceptor(id);

            if (a == null)
            {
                throw new ExcepcionesPersonalizadas.Logica("No se encontró " + mensaje + ".");
            }
            return(a);
        }
Exemplo n.º 20
0
        public static void EX1()
        {
            Receptor  receptor  = new Receptor();
            Invocador invocador = new Invocador(new ComandoConcreto(receptor));

            invocador.Action();

            invocador = new Invocador(new ComandoConcreto2(receptor));
            invocador.Action();
        }
Exemplo n.º 21
0
        public async Task <PartialViewResult> AddRevenueToReceptor(string revenueCode, string receptorCode)
        {
            Receptor recept = await db.Receptors.Where(r => r.receptor_code == receptorCode).FirstOrDefaultAsync();

            Revenue revenue = await db.Revenues.Where(r => r.revenue_code == revenueCode).FirstOrDefaultAsync();

            //revenue.receptors.Add(recept);
            recept.revenues.Add(revenue);
            db.SaveChanges();
            return(PartialView("_ListReceptorRevenueTable", recept));
        }
 public IEnumerable <ValidationResult> Validar(Receptor instancia)
 {
     if (instancia.ReceptorCodigo.Length > 256)
     {
         yield return(new ValidationResult("O código do receptor não pode ter mais de 256 caracteres", new string[] { "ReceptorCodigo" }));
     }
     if (instancia.ReceptorCodigo.Length < 3)
     {
         yield return(new ValidationResult("O código do recptor não pode ter menos de 3 caracteres", new string[] { "ReceptorCodigo" }));
     }
 }
Exemplo n.º 23
0
 public static void ValidarReceptor(Receptor a)
 {
     if (string.IsNullOrEmpty(a.DocRecep.Documento) || string.IsNullOrWhiteSpace(a.DocRecep.Documento))
     {
         throw new ExcepcionesPersonalizadas.Logica("Debe completar el campo Documento y Tipo de documento del receptor");
     }
     if (a == null)
     {
         throw new ExcepcionesPersonalizadas.Logica("El " + mensaje + " no tiene asignado un " + mensaje + ".");
     }
     ReceptorValidacion.ValidarReceptor(a);
 }
Exemplo n.º 24
0
 public static bool esReceptorValido(Receptor receptor)
 {
     if (receptor.Identificacion == null)
     {
         return(false);
     }
     if (receptor.Identificacion.Numero == null)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 25
0
        public void OnReceptorSelectionChanged()
        {
            //Stop automatically reception test when user change receptor
            Receptor r = _previousTestReceptor;

            if (r != null && r.IsPingTestRunning)
            {
                r.StopPingTest();
            }

            RefreshGUI();
        }
Exemplo n.º 26
0
 // Use this for initialization
 void Start()
 {
     position    = new Complex(real, complex);
     destination = position;
     locManager  = Player.GetComponent <UpdateUI>();
     UI.SetActive(false);
     textScript  = textData.GetComponent <Text>();
     recepScript = receptor.GetComponent <Receptor>();
     particles   = particleSystem.GetComponent <ParticleSystem>();
     countText   = countObject.GetComponent <Text>();
     count       = originalCount;
 }
Exemplo n.º 27
0
        public static int ModificarReceptor(Receptor a)
        {
            SqlConnection conexion = null;

            try
            {
                conexion = new SqlConnection(DatosConexion.CadenaConexion);

                SqlCommand comando = conexion.CreateCommand();
                comando.CommandText = "ModificarReceptor";
                comando.CommandType = CommandType.StoredProcedure;

                comando.Parameters.AddWithValue("@Id", a.Id);
                comando.Parameters.AddWithValue("@TipoDocRecep", a.DocRecep.Id);
                comando.Parameters.AddWithValue("@CodPaisRecep", a.PaisRecep.Id);
                comando.Parameters.AddWithValue("@DocRecep", a.DocRecep.Documento);
                comando.Parameters.AddWithValue("@RznSocRecep", a.RznSocRecep);
                comando.Parameters.AddWithValue("@DirRecep", a.DirRecep);
                comando.Parameters.AddWithValue("@CiudadRecep", a.CiudadRecep);
                comando.Parameters.AddWithValue("@DeptoRecep", a.DeptoRecep);
                comando.Parameters.AddWithValue("@CP", a.CP);
                comando.Parameters.AddWithValue("@InfoAdicional", a.InfoAdicional);
                comando.Parameters.AddWithValue("@LugarDestEnt", a.LugarDestEnt);
                comando.Parameters.AddWithValue("@CompraID", a.CompraID);

                SqlParameter valorRetorno = new SqlParameter("@valorRetorno", SqlDbType.Int);
                valorRetorno.Direction = ParameterDirection.ReturnValue;
                comando.Parameters.Add(valorRetorno);

                conexion.Open();

                int filasAfectadas = comando.ExecuteNonQuery();

                if ((int)valorRetorno.Value == -2)
                {
                    throw new Exception();
                }

                return((int)valorRetorno.Value);
            }
            catch (Exception)
            {
                throw new ExcepcionesPersonalizadas.Persistencia("No se pudo modificar " + mensaje + ".");
            }
            finally
            {
                if (conexion != null)
                {
                    conexion.Close();
                }
            }
        }
        public long Adicionar(Receptor instancia)
        {
            var validationResult = Validar(instancia);

            if (validationResult.Any())
            {
                throw new AppException(validationResult.First().ErrorMessage, validationResult);
            }

            var result = ReceptorRepositorio.Adicionar(instancia);

            return(result);
        }
Exemplo n.º 29
0
        public void Load()
        {
            //TODO : Handle exeption  if conf. file does not exists
            //TODO : Handle exeption  if fireworks file does not exists

            //Load config file
            XDocument confFile = XDocument.Load(GetConfigFileName());

            //Load default receptors definition
            List <XElement> receptors = (from r in confFile.Descendants("Receptor")
                                         select r).ToList();

            _receptors.Clear();
            foreach (XElement r in receptors)
            {
                Receptor recep = new Receptor(r.Attribute("name").Value, r.Attribute("address").Value.ToString(), Convert.ToInt32(r.Attribute("nbOfChannels").Value.ToString()));
                _receptors.Add(recep);
            }

            //Excel
            XElement excelFile = confFile.Descendants("ExcelFile").First();

            _excelFireworkName = excelFile.Element("FireworkName").Value.ToString();
            _excelFirstRowData = Convert.ToInt32(excelFile.Element("FireworkDataRow").Value.ToString());
            _excelSheetNumber  = Convert.ToInt32(excelFile.Element("FireworkSheetNumber").Value.ToString());

            //Transceiver
            XElement transceiver = confFile.Descendants("Transceiver").First();

            //_ackTimeOut= Convert.ToInt32(transceiver.Element("AckTimeOut").Value.ToString());
            _totalTimeOut        = Convert.ToInt32(transceiver.Element("TotalTimeout").Value.ToString());
            _retryFrameEmission  = Convert.ToInt32(transceiver.Element("RetryFrameEmission").Value.ToString());
            _transceiverAddress  = transceiver.Element("Address").Value.ToString();
            _transceiverBaudrate = Convert.ToInt32(transceiver.Element("Baudrate").Value.ToString());
            //_tranceiverRetryPing = Convert.ToInt32(transceiver.Element("RetryPingTransceiver").Value.ToString());

            //*** Fireworks
            XDocument fireworksFile = XDocument.Load(GetFireworksFileName());

            List <XElement> fireworks = (from r in fireworksFile.Descendants("Firework")
                                         select r).ToList();

            _fireworks.Clear();
            foreach (XElement fw in fireworks)
            {
                TimeSpan duration = TimeSpan.Parse(fw.Attribute("duration").Value.ToString());
                Firework f        = new Firework(fw.Attribute("reference").Value.ToString(), fw.Attribute("designation").Value.ToString(), duration);

                _fireworks.Add(f);
            }
        }
Exemplo n.º 30
0
        // GET: Receptors/Delete/5
        public async Task <ActionResult> Delete(string code)
        {
            if (code == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Receptor receptor = await db.Receptors.Where(r => r.receptor_code == code).FirstOrDefaultAsync(); // await db.Receptors.FindAsync(id);

            if (receptor == null)
            {
                return(HttpNotFound());
            }
            return(View(receptor));
        }