コード例 #1
0
        public IActionResult CalculateIMC([FromForm] IMCViewModel imcViewModel)
        {
            //TODO: criar tratamento na view, não deixar que seja digitado letras onde deveria ter números
            try
            {
                var person = TempData.PeekExt <PersonLogin>(nameof(PersonLogin));

                var imc = new IMC
                {
                    Height = imcViewModel.Height,
                    Weight = imcViewModel.Weight,
                };

                imc.IMCResult = IMCService.Calculate(imc.Height, imc.Weight);
                person.IMC    = imc;

                _PersonLoginbaseRepository.Upsert(person, person.Id);
            }
            catch (Exception)
            {
            }

            //TODO: modificar o redirect abaixo e retornar apenas uma mensagem de sucesso de dados gravados
            return(Redirect("/User/UserIndex"));
        }
コード例 #2
0
        public im()
        {
            IMC imc = new IMC("jabber.org.ua", "bot.farmbot", "pass");

            imc.setPresenceStatus("Привіт, Україно!");
            imc.setPresenceType(0);
            while (true)
            {
                Thread.Sleep(1000);
                String[] a = new String[2];
                a[0] = "";
                a[1] = "";
                if (imc.doInbox())
                {
                    a[0] = imc.getInboxMess()[0];
                    a[1] = imc.getInboxMess()[1];
                }
                if (a[0].IndexOf("/") > 0)
                {
                    a[0] = a[0].Substring(0, a[0].IndexOf("/"));
                    if (imc.getOutboxStatus())
                    {
                        imc.setMess(a);
                    }
                }
            }
        }
コード例 #3
0
 public void AddIMC(IMC imc)
 {
     using (var _dbContext = new DbUniHealthContext())
     {
         _dbContext.IMCs.Add(imc);
         _dbContext.SaveChanges();
     }
 }
コード例 #4
0
        static void Main(string[] args)
        {

            Program metodos = new Program();
            IMC imc = new IMC();


            //Cabeçalho da questão UM.
            Console.WriteLine("Digite dois numeros por favor. ");
            Console.Write("\nPrimeiro numero: ");
            int pri_n = Convert.ToInt32(Console.ReadLine());
            
            Console.Write("Segundo numero: ");
            int seg_n = Convert.ToInt32(Console.ReadLine());

            metodos.Maior(pri_n, seg_n);
            //Fim do cabeçalho da questão UM.

            //ReadKey sem precisar ficar escrevendo um milhao de vezes a mesma coisa.
            metodos.ReadKey();
            //Fim do ReadKey.

            //Limpar a tela.
            metodos.Clear();
            //Limpou

            //Cabeçalho da questão DOIS.
            Console.WriteLine("Digite seu peso e altura. ");
            Console.Write("\nPeso: ");
            double pes = Convert.ToDouble(Console.ReadLine());

            Console.Write("Altura: ");
            double alt = Convert.ToDouble(Console.ReadLine());
            imc.IMC_(pes, alt);
            //Fim da questão DOIS.

            metodos.ReadKey();
            metodos.Clear();

            //Cabeçalho da questão TRES.
            Console.WriteLine("Digite um numero para verificar se é par.");
            Console.Write("Numero: ");
            int par_impar = Convert.ToInt32(Console.ReadLine());

            metodos.Par(par_impar);
            //Fim da questão TRES.

            metodos.ReadKey();
            metodos.Clear();

            //Cabeçalho da questão QUATRO.
            metodos.quatro();
            //Fim da questão QUATRO.

            //ReadKey sem precisar ficar escrevendo um milhao de vezes a mesma coisa.
            metodos.ReadKey();

        }
コード例 #5
0
 public ApiWrapper()
 {
     this.api           = XmlRpcProxyGen.Create <IMC>();
     this.api.UserAgent = "MailChimp.Net/1.1";
     this.api.Timeout   = 90000;           //default = 90 second timeout
     this.secure        = false;
     this.datacenter    = "us1";
     this.buildEndPoint();
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: ShinedAngel/MethodsCs
            static void Main(string[] args)
            {
                // QUESTÃO 01 - Dois números em parâmetro
                Console.Write("\n\tOs números passados como parâmetro foi o 106 e 102. Sendo assim, o maior número é o ");
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.WriteLine(Maior(106, 102));

                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.WriteLine("\n\t———————————————————————————————————————————————————————————————————————————————————————");

                Console.ResetColor();

                // QUESTÃO 02 - IMC
                IMC imc = new IMC();

                Console.WriteLine("\n\tDigite o valor da sua altura utilizando virgula ");
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write("\t");
                double altura = double.Parse(Console.ReadLine());

                Console.ResetColor();

                Console.WriteLine("\n\tMe informe o valor do seu peso ");
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write("\t");
                double peso = double.Parse(Console.ReadLine());

                Console.ResetColor();

                double seuIMC = imc.calcular(peso, altura);

                Console.Write("\n\tSeu IMC é de ");
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write(seuIMC.ToString("N1"));

                Console.ResetColor();

                Console.Write("\n\tSua classificação é: ");
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write(imc.classificar(imc.calcular(peso, altura)));

                Console.Write("\n");
                Console.ResetColor();

                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.WriteLine("\n\t———————————————————————————————————————————————————————————————————————————————————————");
                Console.ResetColor();

                // QUESTÃO 03 - Descobrir se é par ou ímpar
                Console.Write("\n\tThe number passed as a parameter is ");

                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write(Impar(10));

                Console.ResetColor();
                Console.ReadKey();
            }
コード例 #7
0
        public IMC CalcIMC(double peso, double altura, string cpf)
        {
            var usuario = _usuarioRepository.GetUsuarioByCPF(cpf);

            var imc = new IMC(peso, altura, usuario.Id);

            _imcRepository.AddIMC(imc);

            return(imc);
        }
コード例 #8
0
        public AntropometriaOutputDTO(long id, double peso, double altura, IMC imc,
                                      int percentualDeGordura, double massaMuscular, long alunoId)
        {
            Id     = id;
            Peso   = peso;
            IMC    = imc;
            Altura = altura;
            PercentualDeGordura = percentualDeGordura;
            MassaMuscular       = massaMuscular;
            AlunoId             = alunoId;

            CalculoIMC();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            IMC seuIMC = new IMC();

            Console.Write("Informe sua massa em kg: ");
            seuIMC.Massa = double.Parse(Console.ReadLine());

            Console.Write("Informe sua altura em metros: ");
            seuIMC.Altura = double.Parse(Console.ReadLine());

            seuIMC.Imc = CalculoIMC(seuIMC.Massa, seuIMC.Altura);
            Console.WriteLine("Seu índice de massa corporal é {0:0.0}", seuIMC.Imc);
            Console.ReadKey();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: Anil1111/DadosCursoCsharp
        static void Main(string[] args)
        {
            IMC paciente = new IMC();

            Console.WriteLine("Digite o peso (Massa) em Kg");
            paciente.Massa = double.Parse(Console.ReadLine());
            Console.WriteLine("Digite a Altura em m");
            paciente.Altura = double.Parse(Console.ReadLine());

            paciente.Imc = paciente.Massa / (paciente.Altura * paciente.Altura);

            Console.WriteLine($"O Imc do paciente é: {paciente.Imc:0.00} kg/m2");
            Console.ReadKey();
        }
コード例 #11
0
    private void CalcularIMC()
    {
        try
        {
            IMC imc = new IMC();

            imc.Altura = (double)Session["altura"];
            imc.Peso   = (double)Session["peso"];

            double resultado = imc.Calcular();

            string mensagem = "";

            if (resultado < 17)
            {
                mensagem = "IMC: " + resultado.ToString("N") + " - Muito abaixo do peso";
            }
            else if (resultado > 17 && resultado < 18.49)
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Abaixo do peso";
            }
            else if (resultado > 18.5 && resultado < 24.99)
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Peso normal";
            }
            else if (resultado > 25 && resultado < 29.99)
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Acima do peso";
            }
            else if (resultado > 30 && resultado < 34.99)
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Obesidade I";
            }
            else if (resultado > 35 && resultado < 39.99)
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Obesidade II (severa)";
            }
            else
            {
                mensagem = "resultado: " + resultado.ToString("N") + " - Obesidade III (mórbida)";
            }

            labelIMC.Text = mensagem;
        }
        catch (Exception ex)
        {
            Alerta(string.Format("ERRO! {0} | {1}", "Erro ao calcular IMC.", ex.Message));
        }
    }
コード例 #12
0
ファイル: Program.cs プロジェクト: alexiakarine/ETEC
        static void Main(string[] args)
        {
            float peso, altura, IMC;

            Console.WriteLine("Informe seu peso altual: ");
            peso = float.Parse(Console.ReadLine());
            Console.WriteLine("Informe sua altura: ");
            altura = float.Parse(Console.ReadLine());

            IMC = (peso / (altura * altura));

            if (IMC <= 18.5)
            {
                Console.WriteLine("Peso abaixo do normal");
                Console.WriteLine(IMC.ToString());
            }

            else if ((IMC >= 18.5) && (IMC <= 24.9))
            {
                Console.WriteLine("Peso normal ");
                Console.WriteLine(IMC.ToString());
            }

            else if ((IMC >= 25) && (IMC <= 29.9))
            {
                Console.WriteLine("Sobrepeso ");
                Console.WriteLine(IMC.ToString());
            }

            else if ((IMC >= 30) && (IMC <= 34.9))
            {
                Console.WriteLine("Peso Obesidade grau 1 ");
                Console.WriteLine(IMC.ToString());
            }
            else if ((IMC >= 35) && (IMC <= 39.9))
            {
                Console.WriteLine("Peso Obesidade grau 2 ");
                Console.WriteLine(IMC.ToString());
            }

            else
            {
                Console.WriteLine("Obesidade grau 3 ");
                Console.WriteLine(IMC.ToString());
            }

            Console.ReadKey();
            Console.WriteLine("Digite <Enter> para sair !");
        }
コード例 #13
0
ファイル: MainPage.xaml.cs プロジェクト: mgoiss/TestesXamarin
        private void Calculo(object sender, EventArgs args)
        {
            if (isValidDados())
            {
                try
                {
                    IMC imc = new IMC(float.Parse(txtPeso.Text), float.Parse(txtAltura.Text));

                    lblResultado.Text = string.Format("Seu IMC é: {0}\n\n" +
                                                      "Avaliação: {1}", imc.ValorImc, imc.Resultado);
                }
                catch (Exception ex)
                {
                    DisplayAlert("ERRO", ex.Message, "OK");
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Metodo por el cual se obtendra el valor de tipo string para ser reflejado en la aplicacion como categoria
        /// </summary>
        /// <param name="imc"></param>
        /// <returns></returns>
        public static String getValue(IMC imc)
        {
            String imcStr = "Sin valor";

            switch (imc)
            {
            case IMC.VERY_SEVERELY_UNDER_WEIGHT:
                imcStr = "Muy severamente bajo de peso";
                break;

            case IMC.SEVERELY_UNDER_WEIGHT:
                imcStr = "Severamente bajo de peso";
                break;

            case IMC.UNDER_WEIGHT:
                imcStr = "Bajo de peso";
                break;

            case IMC.NORMAL:
                imcStr = "Peso normal";
                break;

            case IMC.OVER_wEIGHT:
                imcStr = "Sobre peso";
                break;

            case IMC.MODERATELY_OBESE:
                imcStr = "Moderadamente obeso";
                break;

            case IMC.SEVERELY_OBESE:
                imcStr = "Severamente obeso";
                break;

            case IMC.VERY_SEVERELY_OBESE:
                imcStr = "Muy severamente obeso";
                break;

            default:
                break;
            }
            return(imcStr);
        }
コード例 #15
0
        /// <summary>
        /// View Model for TextureView
        /// </summary>
        /// <param name="item">The currently selected item</param>
        /// <param name="category">The category of the selected item</param>
        public TextureViewModel(ItemData item, string category)
        {
            selectedItem     = item;
            selectedCategory = category;

            var imcData = IMC.GetVersion(selectedCategory, selectedItem, false);

            imcVersion = imcData.Item1;
            VFXVersion = imcData.Item2;

            RaceComboBox = MTRL.GetMTRLRaces(selectedItem, selectedCategory, imcVersion);

            if (RaceComboBox.Count > 1)
            {
                RaceEnabled = true;
            }
            else
            {
                RaceEnabled = false;
            }
        }
コード例 #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            double A, P, IMC;

            A             = Convert.ToDouble(textBox1.Text);
            P             = Convert.ToDouble(textBox2.Text);
            IMC           = P / (A * A);
            textBox3.Text = IMC.ToString("0.00");

            if (IMC < 18.49)
            {
                MessageBox.Show("Situação: Você está abaixo do Peso", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            else if (IMC <= 24.99)
            {
                MessageBox.Show("Situação: Você está com Peso na Normalidade", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            else if (IMC < 29.99)
            {
                MessageBox.Show("Situação: Você está acima do Peso", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            else if (IMC < 34.99)
            {
                MessageBox.Show("Situação: Você está com Obesidade Grau I", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            else if (IMC < 39.99)
            {
                MessageBox.Show("Situação: Você está com Obesidade Grau II (Severa)", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            else if (IMC > 40)
            {
                MessageBox.Show("Situação: Você está com Obesidade Grau III (Mórbida)", "Cálculo IMC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #17
0
        /// <summary>
        /// View Model for TextureView
        /// </summary>
        /// <param name="item">The currently selected item</param>
        /// <param name="category">The category of the selected item</param>
        public void UpdateTexture(ItemData item, string category)
        {
            selectedItem     = item;
            selectedCategory = category;

            if (!category.Equals("UI"))
            {
                var imcData = IMC.GetVersion(selectedCategory, selectedItem, false);

                imcVersion = imcData.Item1;
                VFXVersion = imcData.Item2;

                RaceComboBox = MTRL.GetMTRLRaces(selectedItem, selectedCategory, imcVersion);
            }
            else
            {
                RaceComboBox = new ObservableCollection <ComboBoxInfo>()
                {
                    new ComboBoxInfo()
                    {
                        Name = "-", ID = "-", IsNum = false
                    }
                };
            }


            if (RaceComboBox.Count > 1)
            {
                RaceEnabled = true;
            }
            else
            {
                RaceEnabled = false;
            }

            RaceIndex = 0;
        }
コード例 #18
0
        /// <summary>
        /// Gets the available types or maps for the currently selcted item given a specified race and part
        /// Hair, Face, and Mounts that are demihuman, contain types, all others do not.
        /// </summary>
        private void PartComboBoxChanged()
        {
            if (selectedCategory != "UI")
            {
                var body    = "";
                var modelID = selectedItem.PrimaryModelID;
                var imc     = imcVersion;
                var vfx     = VFXVersion;
                var part    = selectedPart.Name;

                if (selectedItem.PrimaryMTRLFolder != null)
                {
                    if (selectedItem.PrimaryMTRLFolder.Contains("weapon"))
                    {
                        var imcData = IMC.GetVersion(selectedCategory, selectedItem, false);

                        imc = imcData.Item1;
                        vfx = imcData.Item2;

                        modelID = selectedItem.PrimaryModelID;
                        body    = selectedItem.PrimaryModelBody;
                        part    = selectedPart.Name;
                    }
                }


                if (SelectedPart.Name.Equals("s"))
                {
                    var imcData = IMC.GetVersion(selectedCategory, selectedItem, true);

                    imc = imcData.Item1;
                    vfx = imcData.Item2;

                    modelID = selectedItem.SecondaryModelID;
                    body    = selectedItem.SecondaryModelBody;
                    part    = "a";

                    if (body == null)
                    {
                        body = "0001";
                    }
                }

                if (selectedCategory.Equals(Strings.Pets))
                {
                    body = "a";
                }
                var info = MTRL.GetMTRLData(selectedItem, selectedRace.ID, selectedCategory, part, imc, body, modelID, vfx);
                mtrlData = info.Item1;

                if (selectedItem.ItemName.Equals(Strings.Face) || selectedItem.ItemName.Equals(Strings.Hair))
                {
                    TypeComboBox = info.Item2;
                    TypeIndex    = 0;
                }
                else if (selectedCategory.Equals(Strings.Mounts))
                {
                    bool isDemiHuman = selectedItem.PrimaryMTRLFolder.Contains("demihuman");

                    if (isDemiHuman)
                    {
                        TypeComboBox = info.Item2;
                        TypeIndex    = 0;
                    }
                    else
                    {
                        MapComboBox = info.Item2;
                        if (MapComboBox.Count < (currMap + 1))
                        {
                            MapIndex = 0;
                        }
                        else
                        {
                            MapIndex = currMap;
                        }
                        TypeComboBox.Clear();
                    }
                }
                else
                {
                    MapComboBox = info.Item2;
                    if (MapComboBox.Count < (currMap + 1))
                    {
                        MapIndex = 0;
                    }
                    else
                    {
                        MapIndex = currMap;
                    }
                    TypeComboBox.Clear();
                }
            }
            else
            {
                var info = MTRL.GetUIData(selectedItem);
                mtrlData    = info.Item1;
                MapComboBox = info.Item2;
                if (MapComboBox.Count < (currMap + 1))
                {
                    MapIndex = 0;
                }
                else
                {
                    MapIndex = currMap;
                }
                TypeComboBox.Clear();
            }


            if (TypeComboBox.Count > 1)
            {
                TypeEnabled = true;
            }
            else
            {
                TypeEnabled = false;
            }

            if (MapComboBox.Count > 0)
            {
                MapEnabled = true;
            }
            else
            {
                MapEnabled = false;
            }
        }
コード例 #19
0
 public ApiWrapper()
 {
     this.api = XmlRpcProxyGen.Create<IMC>();
     this.api.UserAgent = "MailChimp.Net/1.1";
     this.api.Timeout = 90000; //default = 90 second timeout
     this.secure = false;
     this.datacenter = "us1";
     this.buildEndPoint();
 }
コード例 #20
0
        /// <summary>Metodo utilizadp para obtener la categoria, de acuerdo a tu imc
        /// <para>Este metodo recibe un valor tipo double, con el cual obtiene la categoria en la que tre encuentras,
        /// esto de acuerdo a la clase IENUM donde se guardan varios valores para ser devueltos como string.
        /// </para>
        /// </summary>
        /// <param name="imc"></param>
        /// <returns></returns>
        private String getBMICategoria(Double imc)
        {
            Edad = int.Parse(txt_edad.Text);
            string op = PickerSexo.SelectedItem.ToString();

            if (op == "Hombre")
            {
                if (Edad >= 1 && Edad < 5)
                {
                    if (imc < 5.7)
                    {
                        categoria = IMC.VERY_SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 6.0)
                    {
                        categoria = IMC.SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 6.2)
                    {
                        categoria = IMC.UNDER_WEIGHT;
                    }
                    else if (imc < 7.0)
                    {
                        categoria = IMC.NORMAL;
                    }
                    else if (imc < 7.8)
                    {
                        categoria = IMC.OVER_wEIGHT;
                    }
                    else if (imc < 8.7)
                    {
                        categoria = IMC.MODERATELY_OBESE;
                    }
                    else if (imc < 8.9)
                    {
                        categoria = IMC.SEVERELY_OBESE;
                    }
                    else
                    {
                        categoria = IMC.VERY_SEVERELY_OBESE;
                    }
                }
                else if (Edad >= 5 && Edad <= 11)
                {
                    if (imc < 5.7)
                    {
                        categoria = IMC.VERY_SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 6.0)
                    {
                        categoria = IMC.SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 6.2)
                    {
                        categoria = IMC.UNDER_WEIGHT;
                    }
                    else if (imc < 7.0)
                    {
                        categoria = IMC.NORMAL;
                    }
                    else if (imc < 7.8)
                    {
                        categoria = IMC.OVER_wEIGHT;
                    }
                    else if (imc < 8.7)
                    {
                        categoria = IMC.MODERATELY_OBESE;
                    }
                    else if (imc < 8.9)
                    {
                        categoria = IMC.SEVERELY_OBESE;
                    }
                    else
                    {
                        categoria = IMC.VERY_SEVERELY_OBESE;
                    }
                }
                else if (Edad >= 12 && Edad <= 19)
                {
                    if (imc < 5.7)
                    {
                        categoria = IMC.VERY_SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 7.0)
                    {
                        categoria = IMC.SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 7.2)
                    {
                        categoria = IMC.UNDER_WEIGHT;
                    }
                    else if (imc < 8.0)
                    {
                        categoria = IMC.NORMAL;
                    }
                    else if (imc < 8.8)
                    {
                        categoria = IMC.OVER_wEIGHT;
                    }
                    else if (imc < 9.7)
                    {
                        categoria = IMC.MODERATELY_OBESE;
                    }
                    else if (imc < 9.9)
                    {
                        categoria = IMC.SEVERELY_OBESE;
                    }
                    else
                    {
                        categoria = IMC.VERY_SEVERELY_OBESE;
                    }
                }
                else if (Edad >= 20 && Edad <= 59)
                {
                    if (imc < 5.7)
                    {
                        categoria = IMC.VERY_SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 12.0)
                    {
                        categoria = IMC.SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 13.2)
                    {
                        categoria = IMC.UNDER_WEIGHT;
                    }
                    else if (imc < 14.0)
                    {
                        categoria = IMC.NORMAL;
                    }
                    else if (imc < 17.8)
                    {
                        categoria = IMC.OVER_wEIGHT;
                    }
                    else if (imc < 18.7)
                    {
                        categoria = IMC.MODERATELY_OBESE;
                    }
                    else if (imc < 20)
                    {
                        categoria = IMC.SEVERELY_OBESE;
                    }
                    else
                    {
                        categoria = IMC.VERY_SEVERELY_OBESE;
                    }
                }
                else if (Edad >= 60 && Edad >= 70)
                {
                    if (imc < 5.7)
                    {
                        categoria = IMC.VERY_SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 12.0)
                    {
                        categoria = IMC.SEVERELY_UNDER_WEIGHT;
                    }
                    else if (imc < 13.2)
                    {
                        categoria = IMC.UNDER_WEIGHT;
                    }
                    else if (imc < 14.0)
                    {
                        categoria = IMC.NORMAL;
                    }
                    else if (imc < 14.8)
                    {
                        categoria = IMC.OVER_wEIGHT;
                    }
                    else if (imc < 15.7)
                    {
                        categoria = IMC.MODERATELY_OBESE;
                    }
                    else if (imc < 16.9)
                    {
                        categoria = IMC.SEVERELY_OBESE;
                    }
                    else
                    {
                        categoria = IMC.VERY_SEVERELY_OBESE;
                    }
                }
            }
            else
            {
                if (Edad >= 1 && Edad < 5)
                {
                }
                else if (Edad >= 5 && Edad <= 11)
                {
                }
                else if (Edad >= 12 && Edad <= 19)
                {
                }
                else if (Edad >= 20 && Edad <= 59)
                {
                }
                else if (Edad >= 60 && Edad >= 70)
                {
                }
            }

            return(IENUM.getValue(categoria));
        }
コード例 #21
0
 public IMCEnum(IMC imc)
 {
     this.imc = imc;
 }
コード例 #22
0
        /// <summary>
        /// Gets the MTRL data of the given mesh
        /// </summary>
        /// <param name="mesh">The mesh to obtain the data from</param>
        /// <returns>The MTRLData of the given mesh</returns>
        public MTRLData MTRL3D(int mesh)
        {
            MTRLData mtrlData    = null;
            bool     isDemiHuman = false;

            if (selectedItem.PrimaryMTRLFolder != null)
            {
                isDemiHuman = selectedItem.PrimaryMTRLFolder.Contains("demihuman");
            }

            var itemVersion = IMC.GetVersion(selectedCategory, selectedItem, false).Item1;
            var itemType    = Helper.GetCategoryType(selectedCategory);

            try
            {
                if (selectedItem.ItemName.Equals(Strings.Face) || selectedItem.ItemName.Equals(Strings.Hair) || isDemiHuman)
                {
                    string slotAbr;

                    if (isDemiHuman)
                    {
                        slotAbr = Info.slotAbr[SelectedPart.Name];
                    }
                    else if (selectedCategory.Equals(Strings.Character))
                    {
                        var race = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4);

                        if (materialStrings[mesh].Contains("h00"))
                        {
                            var hairNum    = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("h00") + 1, 4);
                            var mtrlFolder = string.Format(Strings.HairMtrlFolder, race, hairNum);
                            slotAbr = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") - 3, 3);
                            slotAbr = Info.HairTypes.FirstOrDefault(x => x.Value == slotAbr).Key;

                            var hairInfo = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, hairNum, slotAbr, itemVersion, selectedCategory);
                            return(hairInfo.Item1);
                        }
                        else if (materialStrings[mesh].Contains("f00"))
                        {
                            var faceNum    = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("f00") + 1, 4);
                            var mtrlFolder = string.Format(Strings.FaceMtrlFolder, race, faceNum);
                            slotAbr = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") - 3, 3);
                            slotAbr = Info.FaceTypes.FirstOrDefault(x => x.Value == slotAbr).Key;

                            var faceInfo = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, faceNum, slotAbr, itemVersion, selectedCategory);
                            return(faceInfo.Item1);
                        }
                        else
                        {
                            slotAbr = selectedPart.Name;
                        }
                    }
                    else
                    {
                        slotAbr = selectedPart.Name;
                    }

                    var info = MTRL.GetMTRLDatafromType(selectedItem, SelectedRace, selectedPart.Name, slotAbr, itemVersion, selectedCategory);
                    mtrlData = info.Item1;
                }
                else
                {
                    Tuple <MTRLData, ObservableCollection <ComboBoxInfo> > info;

                    if (itemType.Equals("character") || itemType.Equals("equipment"))
                    {
                        try
                        {
                            if (materialStrings[mesh].Contains("b00") || materialStrings[mesh].Contains("t00") || materialStrings[mesh].Contains("h00"))
                            {
                                if (materialStrings[mesh].Contains("mt_c"))
                                {
                                    var mtrlFolder = "";
                                    var race       = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4);

                                    if (materialStrings[mesh].Contains("b00"))
                                    {
                                        mtrlFolder = string.Format(Strings.BodyMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("b00") + 1, 4));
                                    }
                                    else if (materialStrings[mesh].Contains("t00"))
                                    {
                                        mtrlFolder = string.Format(Strings.TailMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("t00") + 1, 4));
                                    }
                                    else if (materialStrings[mesh].Contains("h00"))
                                    {
                                        mtrlFolder = string.Format(Strings.HairMtrlFolder, race, materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("h00") + 1, 4));
                                    }

                                    var mtrlFile = materialStrings[mesh].Substring(1);

                                    return(MTRL.GetMTRLInfo(Helper.GetItemOffset(FFCRC.GetHash(mtrlFolder), FFCRC.GetHash(mtrlFile)), true));
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.Message);
                            Debug.WriteLine(ex.StackTrace);
                        }
                    }
                    else
                    {
                        info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, SelectedPart.Name, itemVersion, "", "", "0000");
                    }

                    if (SelectedPart.Name.Equals("Secondary"))
                    {
                        info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, SelectedPart.Name, itemVersion, "Secondary", "", "0000");
                    }
                    else
                    {
                        string part   = "a";
                        string itemID = selectedItem.PrimaryModelID;

                        if (materialStrings.Count > 1)
                        {
                            try
                            {
                                part   = materialStrings[mesh].Substring(materialStrings[mesh].LastIndexOf("_") + 1, 1);
                                itemID = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("_") + 2, 4);
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine(ex.Message);
                                Debug.WriteLine(ex.StackTrace);
                            }
                        }

                        if (selectedCategory.Equals(Strings.Pets))
                        {
                            part = "1";
                        }

                        info = MTRL.GetMTRLData(selectedItem, SelectedRace.ID, selectedCategory, part, itemVersion, "", itemID, "0000");
                    }

                    if (info != null)
                    {
                        mtrlData = info.Item1;
                    }
                    else
                    {
                        var combo = new ComboBoxInfo()
                        {
                            Name = "Default", ID = materialStrings[mesh].Substring(materialStrings[mesh].IndexOf("c") + 1, 4), IsNum = false
                        };

                        if (SelectedPart.Name.Equals("-"))
                        {
                            info = MTRL.GetMTRLData(selectedItem, combo.ID, selectedCategory, "a", itemVersion, "", "", "0000");
                        }
                        else
                        {
                            info = MTRL.GetMTRLData(selectedItem, combo.ID, selectedCategory, SelectedPart.Name, itemVersion, "", "", "0000");
                        }

                        mtrlData = info.Item1;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
                return(null);
            }

            return(mtrlData);
        }
コード例 #23
0
 public IENUM(IMC imc)
 {
     this.imc = imc;
 }
コード例 #24
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Black;
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();

            Double op, numerador, denominador, division, num, cubo, peso, altura, IMC;



            do
            {
                Console.Title = "Programa que muestra menú de calculo.";
                Console.WriteLine("\n\tOPERACIONES MATEMÁTICAS:");
                Console.WriteLine("\n\t1. Dividir");
                Console.WriteLine("\n\t2. Obtener cubo");
                Console.WriteLine("\n\t3. Cálculo de IMC (Índice de Masa Corporal)");
                Console.WriteLine("\n\t4. Salir del programa");
                Console.WriteLine("\n ");
                Console.Write("Digite su opción: ");
                op = Double.Parse(Console.ReadLine());



                switch (op)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("Usted ha seleccionado la opción: Dividir.");
                    Console.WriteLine("Ingrese el numerador de la división: ");
                    numerador = Double.Parse(Console.ReadLine());
                    Console.WriteLine("Ingrese el denominador de la división: ");
                    denominador = Double.Parse(Console.ReadLine());
                    division    = (numerador / denominador);
                    Console.WriteLine("El resultado de la división es: " + division);
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine("Usted ha seleccionado la opción: Obtener cubo.");
                    Console.WriteLine("Ingrese el número del que desea conocer el cubo: ");
                    num  = Double.Parse(Console.ReadLine());
                    cubo = (Math.Pow(num, 3));
                    Console.WriteLine("El cubo de " + num + " es: " + cubo);
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine("Usted ha seleccionado la opción: Cálculo de IMC (Índice de Masa Corporal).");
                    Console.WriteLine("Ingrese su peso en kilogramos: ");
                    peso = Double.Parse(Console.ReadLine());
                    Console.WriteLine("Ingrese su altura en metros: ");
                    altura = Double.Parse(Console.ReadLine());
                    IMC    = peso / (Math.Pow(altura, 2));
                    Console.Write("Su índice de masa corporal es de: " + (IMC.ToString("#.##")));
                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("Saliendo del programa...");
                    Environment.Exit(0);
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Opción no definida.");
                    break;
                }
            } while (op >= 1 && op <= 4);

            {
                Console.WriteLine("La opción debe de estar dentro del menú.");
            }

            Console.ReadKey();
        }
コード例 #25
0
        private void Save()
        {
            var    actualName = _userRepository.GetActualUserNickName();
            double IMCToPass;

            IMCToPass = _userServices.GetIMCByUserParameters(Weight, Height);
            IMC       = (int)IMCToPass;
            _userRepository.ModifyUserByUsername(Name, Surname, Age, Weight, Height, Password, Username, IMC.ToString(), actualName);
        }
コード例 #26
0
        private void Save()
        {
            double IMCToPass;

            IMCToPass = _userServices.GetIMCByUserParameters(Weight, Height);
            IMC       = (int)IMCToPass;
            _userRepository.AddUser(Name, Surname, Age, Weight, Height, Password, Username, IMC.ToString());
        }