Esempio n. 1
0
        private void buttonQRSCarregar_Click(object sender, EventArgs e)
        {
            DatabaseEntities entities = new DatabaseEntities();

            var query = from c in entities.CONFIG
                        where c.onda == "QRS"
                        select c;

            if (entities.CONFIG.Count(c => c.onda == "QRS") == 0)
            {
                CONFIG conf = new CONFIG();
                conf.onda = "QRS";
                conf.descr = comboBoxQRS.SelectedItem.ToString();
                entities.AddToCONFIG(conf);
                entities.SaveChanges();
            }
            else
            {
                CONFIG conf = (CONFIG)query.First();

                conf.descr = comboBoxQRS.SelectedItem.ToString();

                entities.SaveChanges();
            }

            MessageBox.Show("Rede carregada com sucesso!");
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ondaId"></param>
        public void Salvar(long ondaId)
        {
            DatabaseEntities entities = new DatabaseEntities();
            ComplexoQRS qrs = this;
            QRS q;

            var query = from f in entities.QRS
                            where f.id == qrs.Id
                            select f;

            if (query.Count(t => t.id == qrs.Id) != 0)
            {
                q = query.FirstOrDefault<QRS>();
            }
            else
            {
                q = new QRS();
                entities.AddToQRS(q);
            }

            string vetor = "";

            foreach (double d in qrs.Vetor)
            {
                vetor += d + ";";
            }

            q.onda = ondaId;
            q.vetor = vetor;
            q.length = qrs.Length;
            q.diag = Utils.DoubleToString(qrs.Diagnostico);

            try
            {
                entities.SaveChanges();

                Console.WriteLine("Complexo QRS inserido/atualizado com o id {0}", q.id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                throw (ex);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ondaId"></param>
        public void Salvar(long ondaId)
        {
            DatabaseEntities entities = new DatabaseEntities();
            OndaT ondat = this;
            T t;

            var query = from f in entities.T
                        where f.id == ondat.Id
                        select f;

            if (query.Count(q => q.id == ondat.Id) != 0)
            {
                t = query.FirstOrDefault<T>();
            }
            else
            {
                t = new T();
                entities.AddToT(t);
            }

            string vetor = "";

            foreach (double d in ondat.Vetor)
            {
                vetor += d + ";";
            }

            t.onda = ondaId;
            t.vetor = vetor;
            t.length = ondat.Length;
            t.diag = Utils.DoubleToString(ondat.Diagnostico);

            try
            {
                entities.SaveChanges();

                Console.WriteLine("Onda T inserida com o id {0}", t.id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                throw (ex);
            }
        }
Esempio n. 4
0
        public void Salvar()
        {
            DatabaseEntities entities = new DatabaseEntities();
            Onda onda = this;
            ONDA o = new ONDA();

            string vetor = "";

            foreach(double d in onda.Vetor)
            {
                vetor += d + ";";
            }

            o.vetor = vetor;
            o.length = onda.Length;

            entities.AddToONDA(o);

            try
            {
                entities.SaveChanges();

                this.Id = o.id;

                Console.WriteLine("Onda inserida com o id {0}", o.id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                throw (ex);
            }
        }