/**
     * Salva o paciente no banco.
     */
    public void saveMovement()
    {
        var muscles = musculos.text.Split(',');

        string movunderscored    = (nomeMovimento.text).Replace(' ', '_');
        string physiounderscored = (GlobalController.instance.admin.persona.nomePessoa).Replace(' ', '_');

        string pathSave = GlobalController.instance.admin.idPessoa + "-";

        pathSave += physiounderscored + "/";
        pathSave += movunderscored + "-";
        pathSave += DateTime.Now.ToString("HHmmss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

        Movimento.Insert(GlobalController.instance.admin.idFisioterapeuta,
                         nomeMovimento.text, descricao.text, pathSave);

        List <Movimento> movementsList = Movimento.Read();

        foreach (var muscle in muscles)
        {
            name = new string((from c in muscle where char.IsLetterOrDigit(c) select c).ToArray());
            if (!checkMuscle(name))
            {
                Musculo.Insert(name);
                List <Musculo> musclesList = Musculo.Read();
                MovimentoMusculo.Insert(musclesList[musclesList.Count - 1].idMusculo, movementsList[movementsList.Count - 1].idMovimento);
            }
        }

        GlobalController.instance.movement = movementsList[movementsList.Count - 1];
        SceneManager.LoadScene("Clinic");
    }
    /**
     * Salva o Movimento no banco.
     */
    public void saveMovement()
    {
        List <InputField> allInputs = new List <InputField>();

        allInputs.Add(nomeMovimento);
        allInputs.Add(musculos);
        allInputs.Add(descricao);

        if (ValidInput(allInputs))
        {
            foreach (var x in allInputs)
            {
                ApplyColor(x, 1);
            }

            var muscles = musculos.text.Split(',');

            string movunderscored    = (nomeMovimento.text).Replace(' ', '_');
            string physiounderscored = (GlobalController.instance.admin.persona.nomePessoa).Replace(' ', '_');

            string pathSave = GlobalController.instance.admin.idPessoa + "-";

            pathSave += physiounderscored + "/";
            pathSave += movunderscored + "-";
            pathSave += DateTime.Now.ToString("HHmmss", System.Globalization.DateTimeFormatInfo.InvariantInfo);

            Movimento.Insert(GlobalController.instance.admin.idFisioterapeuta,
                             nomeMovimento.text, pathSave + ".points", descricao.text);

            List <Movimento> movementsList = Movimento.Read();

            foreach (var muscle in muscles)
            {
                name = new string((from c in muscle where char.IsLetterOrDigit(c) select c).ToArray());
                if (!checkMuscle(name))
                {
                    Musculo.Insert(name);
                    List <Musculo> musclesList = Musculo.Read();
                    MovimentoMusculo.Insert(musclesList[musclesList.Count - 1].idMusculo, movementsList[movementsList.Count - 1].idMovimento);
                }
            }

            GlobalController.patientOrPhysio   = true;
            GlobalController.instance.movement = movementsList[movementsList.Count - 1];
            if (GlobalController.Sensor == false)
            {
                Flow.StaticRealtimeGraphKinectPhysio();
            }
            else
            {
                Flow.StaticRealtimeGraphUDPPhysio();
            }
        }
    }
    static bool checkMuscle(string name)
    {
        List <Musculo> musclesList = Musculo.Read();

        foreach (var muscle in musclesList)
        {
            if (muscle.nomeMusculo == name)
            {
                return(true);
            }
        }

        return(false);
    }
        public static void TestMusculoRead()
        {
            using (var conn = new SqliteConnection(GlobalController.path))
            {
                conn.Open();

                Musculo.Insert("bíceps");
                Musculo.Insert("tríceps");
                Musculo.Insert("quadríceps");

                List <Musculo> allMuscs = Musculo.Read();

                string[] x = new string[] { "", "b", "tr", "quadr" };

                for (int i = 1; i <= allMuscs.Count; ++i)
                {
                    Assert.AreEqual(allMuscs[i - 1].idMusculo, i);
                    Assert.AreEqual(allMuscs[i - 1].nomeMusculo, (x[i] + "íceps"));
                }

                conn.Dispose();
                conn.Close();
            }
        }