Ejemplo n.º 1
0
        private void ReadDatabase()
        {
            try
            {
                DataClasses1DataContext dc = Dataclass1Singlon.getSinglon();
                var stress_input           = from i in dc.StressInput
                                             where i.Id == 0
                                             select i;

                textBox11.Text = stress_input.First().kc11.ToString();
                textBox12.Text = stress_input.First().kc12.ToString();
                textBox13.Text = stress_input.First().kc13.ToString();
                textBox14.Text = stress_input.First().kc14.ToString();
                textBox21.Text = stress_input.First().kc21.ToString();
                textBox22.Text = stress_input.First().kc22.ToString();
                textBox23.Text = stress_input.First().kc23.ToString();
                textBox24.Text = stress_input.First().kc24.ToString();
                textBox31.Text = stress_input.First().kc31.ToString();
                textBox32.Text = stress_input.First().kc32.ToString();
                textBox4.Text  = stress_input.First().kc4.ToString();
                textBox51.Text = stress_input.First().kc51.ToString();
                textBox52.Text = stress_input.First().kc52.ToString();
            }
            catch (Exception E)
            {
                ;
            }
        }
Ejemplo n.º 2
0
        private void SaveDatabase()
        {
            DataClasses1DataContext dc           = Dataclass1Singlon.getSinglon();
            StressInput             stress_input = dc.StressInput.FirstOrDefault();

            try {
                dc.StressInput.DeleteOnSubmit(stress_input);
                dc.SubmitChanges();
            }catch (Exception E)
            {
                ;
            }
            try {
                stress_input = new StressInput()
                {
                    kc11 = Convert.ToDouble(textBox11.Text),
                    kc12 = Convert.ToDouble(textBox12.Text),
                    kc13 = Convert.ToDouble(textBox13.Text),
                    kc14 = Convert.ToDouble(textBox14.Text),
                    kc21 = Convert.ToDouble(textBox21.Text),
                    kc22 = Convert.ToDouble(textBox22.Text),
                    kc23 = Convert.ToDouble(textBox23.Text),
                    kc24 = Convert.ToDouble(textBox24.Text),
                    kc31 = Convert.ToDouble(textBox31.Text),
                    kc32 = Convert.ToDouble(textBox32.Text),
                    kc4  = Convert.ToDouble(textBox4.Text),
                    kc51 = Convert.ToDouble(textBox51.Text),
                    kc52 = Convert.ToDouble(textBox52.Text)
                };
                dc.StressInput.InsertOnSubmit(stress_input);
                dc.SubmitChanges();
            }catch (Exception E)
            {
                ;
            }
        }