Exemple #1
0
 public FrmPrincipal()
 {
     InitializeComponent();
     txtCotizacionEuro.Text  = Euro.GetCotizacion().ToString();
     txtCotizacionPeso.Text  = Peso.GetCotizacion().ToString();
     txtCotizacionDolar.Text = Dolar.GetCotizacion().ToString();
 }
Exemple #2
0
        public async Task <IActionResult> PutPeso(int id, Peso peso)
        {
            if (id != peso.Id)
            {
                return(BadRequest());
            }

            _context.Entry(peso).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PesoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #3
0
        public ActionResult GetHumanMass()
        {
            string url = $"{_host}/people";

            var result       = _client.GetAsync(url).Result;
            var listaPessoas = result.Content.ReadAsAsync <ListPessoas>().Result;

            var soma       = 0;
            var qtdPessoas = 0;

            foreach (var pessoa in listaPessoas.Results)
            {
                var pesoDaPessoa = pessoa.Mass;

                var especieDaPessoa = pessoa.Species.ToList()[0];

                if (string.Equals(especieDaPessoa, "https://swapi.co/api/species/1/"))
                {
                    soma       = pesoDaPessoa + soma;
                    qtdPessoas = qtdPessoas + 1;
                }
            }
            var peso = new Peso();

            peso.MediaPeso = soma / qtdPessoas;

            return(new OkObjectResult(peso));
        }
Exemple #4
0
        public async Task <ActionResult <Peso> > PostPeso(Peso peso)
        {
            _context.Pesos.Add(peso);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetPeso), new { id = peso.Id }, peso));
        }
Exemple #5
0
        private IEnumerator AparicionDelPeso()
        {
            yield return(new WaitForSecondsRealtime(25f));

            Peso.SetActive(true);
            StartCoroutine(FadingEffects.ShowImageFading(1f, Peso.GetComponent <Image>()));
        }
Exemple #6
0
        public void InserirDados()
        {
            //tenta inserir
            try
            {
                //verifica se os campos estão em branco
                if (!Cod.Equals("") && !Nome.Equals("") && !Categoria.Equals("") &&
                    !Mercado.Equals("") && !Preco.Equals("") && !Peso.Equals("") &&
                    !Marca.Equals("") && !Quantidade.Equals(""))
                {
                    string          myConnectionString = "server =localhost; user id =root; password =; port =3306; database = CompareAqui";
                    MySqlConnection myConnection       = new MySqlConnection(myConnectionString);
                    string          myInsertQuery      = "INSERT INTO tb_produto (prod_cod, prod_nome, prod_categoria, prod_mercado, prod_preco, prod_peso, prod_marca, prod_quantidade)" +
                                                         " Values('" + Cod + "','" + Nome + "','" + Categoria + "','" + Mercado + "','" + Preco + "','" + Peso + "','" + Marca + "','" + Quantidade + "')";
                    MySqlCommand myCommand = new MySqlCommand(myInsertQuery, myConnection);

                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                    myConnection.Close();
                    //MessageBox.Show("Produto cadastrado com sucesso");
                }
                else
                {
                    MessageBox.Show("Nao deixe nenhum campo em branco ou somente com espacos!!");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemple #7
0
 public override string ToString()
 {
     return("Un mamifero de la especie " + Especie
            + ", que pesa " + Peso.ToString() + " Kg."
            + " y tiene " + Edad.ToString()
            + " años de edad");
 }
Exemple #8
0
 public Conversor()
 {
     InitializeComponent();
     this.eur = new Euro(0, (float)1.14);
     this.ars = new Peso(0, (float)0.026);
     this.usd = new Dolar(0, (float)1);
 }
Exemple #9
0
        static void Main(string[] args)
        {
            Dolar dolar = new Dolar(100);
            Euro  euro  = new Euro(86);
            Peso  peso  = new Peso(3833);
            Dolar total = dolar + euro + peso;

            Peso luz        = new Peso(3833 * 2);
            Euro luzEnEuros = (Euro)luz;

            total -= luzEnEuros;

            if (total.GetCantidad() > 99 && total.GetCantidad() < 101)
            {
                Console.WriteLine(total.GetCantidad());
                Console.WriteLine("Good");
            }
            else
            {
                Console.WriteLine("Bad");
            }

            if (new Euro(100) == (Peso) new Dolar(116))
            {
                Console.WriteLine("Good");
            }
            else
            {
                Console.WriteLine("Bad");
            }

            Console.ReadKey();
        }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string euro = textBox1.Text;
            string dolar = textBox2.Text;
            string peso = textBox3.Text;
            int    valorEuro, valorDolar, ValorPeso;

            int.TryParse(euro, out valorEuro);
            int.TryParse(dolar, out valorDolar);
            int.TryParse(peso, out ValorPeso);

            Moneda.Euro  monedaEuro  = new Euro(0, valorEuro);
            Moneda.Dolar monedaDolar = new Dolar(0, valorDolar);
            Moneda.Peso  monedaPeso  = new Peso(0, ValorPeso);

            button1.Visible   = false;
            button2.Enabled   = true;
            button3.Enabled   = true;
            button4.Enabled   = true;
            button5.Visible   = true;
            textBox1.Enabled  = false;
            textBox2.Enabled  = false;
            textBox3.Enabled  = false;
            textBox13.Enabled = true;
            textBox14.Enabled = true;
            textBox15.Enabled = true;
        }
        public static Bulto GetDefaultBulto(Peso peso = null, Dimensiones dimensiones = null)
        {
            peso        = peso ?? new Peso(UnidadPeso.Kilo, 5d);
            dimensiones = dimensiones ?? new Dimensiones(1d, 2d, 3d);

            return(new Bulto(peso, dimensiones));
        }
        public ActionResult Create(int animalId)
        {
            var peso = new Peso {
                AnimalId = animalId
            };

            return(PartialView("_Create", peso));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Peso peso = repoPeso.Find(id);

            repoPeso.Excluir(x => x == peso);
            repoPeso.SalvarTodos();
            return(Json(new { success = true }));
        }
Exemple #14
0
 public PesoModelo(Peso peso)
 {
     Codigo   = peso.Codigo;
     Paciente = peso.Paciente;
     Fecha    = peso.Fecha;
     Peso1    = peso.Peso1;
     Detalle  = peso.Detalle;
 }
Exemple #15
0
        // Wrap All Primitives (+string)
        public static void Run()
        {
            Console.WriteLine("Infome o peso em KG");
            var pesoKg   = Peso.From(int.Parse(Console.ReadLine()));
            var pesoPnds = convertePeso(pesoKg);

            Console.WriteLine($"Seu peso é: {pesoPnds} pounds");
        }
Exemple #16
0
        private void btnPesoConvert_Click(object sender, EventArgs e)
        {
            Peso billete = this.txtCantidadPeso.Text;

            this.txtPesoPeso.Text  = billete.GetCantidad().ToString("0.0");
            this.txtPesoDolar.Text = ((Dolar)billete).GetCantidad().ToString("0.0");
            this.txtPesoEuro.Text  = ((Euro)billete).GetCantidad().ToString("0.0");
        }
Exemple #17
0
        public void GeraPesosParaVitorWilson()
        {
            Funcionario  vitorWilson     = new Funcionario(0009968, "Victor Wilson", "Diretoria", "Diretor Financeiro", 12696.20f, new DateTime(2012, 01, 05));
            Participacao participante    = new Participacao(vitorWilson, salarioMinimoNacional.Value);
            Peso         pesoVitorWilson = new Peso(participante.AreaDeAtuacao, participante.SalarioBruto, participante.DataDeAdmissao, salarioMinimoNacional.Value, participante.Estagiario);

            Assert.IsTrue(pesoVitorWilson.RetornaPesoAreaDeAtuacao() == 1 && pesoVitorWilson.RetornaPesoFaixaSalarial() == 13 && pesoVitorWilson.RetornaPesoTempoAdmissao() == 7);
        }
Exemple #18
0
        //el evento leave es cuando se deja el foco del control bien sea por mouse o teclado.

        public Conversor()
        {
            InitializeComponent();
            //puedo inicializar el form con las cotizaciones por defecto
            txtCotizDolar.Text = Dolar.GetCotizacion().ToString();
            txtCotizEuro.Text  = Euro.GetCotizacion().ToString();
            txtCotizPesos.Text = Peso.GetCotizacion().ToString();
        }
Exemple #19
0
            public static Peso operator -(Peso p, Dolar d)
            {
                Peso x = new Peso();

                x = (Peso)d;

                p._cantidad -= x.GetCantidad();
                return(p);
            }
 public Peso Agregar(Peso pesoA)
 {
     using (var cnx = Conexion.Open)
     {
         cnx.Peso.InsertOnSubmit(pesoA);
         cnx.SubmitChanges();
     }
     return(pesoA);
 }
Exemple #21
0
        public bool EsPesoValido(Peso pesoTotal)
        {
            if (pesoTotal.Unidad == PesoMaximo.Unidad)
            {
                return(pesoTotal < PesoMaximo);
            }

            return(pesoTotal.CambiarAGramos() < PesoMaximo.CambiarAGramos());
        }
Exemple #22
0
        static void Main(string[] args)
        {
            Euro billeteUno = 1;
            Peso billeteDos = (Peso)billeteUno;


            Console.WriteLine(billeteDos.GetCantidad());
            Console.ReadKey();
        }
Exemple #23
0
            public static Peso operator -(Peso p, Euro e)
            {
                Peso x = new Peso();

                x = (Peso)e;

                p._cantidad -= x.GetCantidad();
                return(p);
            }
Exemple #24
0
 private void btnEuro_Click(object sender, EventArgs e)
 {
     euro              = new Euro(double.Parse(txtCantidadEuros.Text));
     peso              = (Peso)euro;
     dolar             = (Dolar)euro;
     txtEuroEuro.Text  = (euro.GetCantidad()).ToString();
     txtEuroDolar.Text = (dolar.GetCantidad()).ToString();
     txtEuroPeso.Text  = (peso.GetCantidad()).ToString();
 }
Exemple #25
0
 private void btnPeso_Click(object sender, EventArgs e)
 {
     peso              = new Peso(double.Parse(txtCantidadPesos.Text));
     dolar             = (Dolar)peso;
     euro              = (Euro)peso;
     txtPesoPeso.Text  = (peso.GetCantidad()).ToString();
     txtPesoDolar.Text = (dolar.GetCantidad()).ToString();
     txtPesoEuro.Text  = (euro.GetCantidad()).ToString();
 }
Exemple #26
0
 private void Cotizacion_Click(object sender, EventArgs e)
 {
     textBox1.Text    = (Euro.GetCotizacion()).ToString();
     textBox1.Enabled = false;
     textBox2.Text    = (Dolar.GetCotizacion()).ToString();
     textBox2.Enabled = false;
     textBox3.Text    = (Peso.GetCotizacion()).ToString();
     textBox3.Enabled = false;
 }
Exemple #27
0
 private void btnDolar_Click(object sender, EventArgs e)
 {
     dolar = new Dolar(double.Parse(txtCantidadDolar.Text));
     peso  = (Peso)dolar;
     euro  = (Euro)dolar;
     txtDolarDolar.Text = (dolar.GetCantidad()).ToString();
     txtDolarPeso.Text  = (peso.GetCantidad()).ToString();
     txtDolarEuro.Text  = (euro.GetCantidad()).ToString();
 }
        private void btnConvertPeso_Click(object sender, EventArgs e)
        {
            double cantidad;

            double.TryParse(this.txtPeso.Text, out cantidad);
            Peso peso = new Peso(cantidad);

            this.txtPesoAEuro.Text  = ((Euro)peso).GetCantidad().ToString();
            this.txtPesoADolar.Text = ((Dolar)peso).GetCantidad().ToString();
        }
Exemple #29
0
        static void Main(string[] args)
        {
            Peso  aux  = new Peso(100);
            Dolar auxD = new Dolar(1);
            Euro  auxE = new Euro(1);
            Peso  res  = aux + auxE;

            Console.WriteLine(res.GetCantidad());
            Console.ReadKey();
        }
Exemple #30
0
 public static bool operator ==(Dolar d, Peso p)
 {
     if (d._cantidad * Peso.GetCotizacin() == (float)p.GetCantidad())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }