示例#1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // clear form and re-create all obj
            newTest = true;

            NameTextBox.Clear();
            AgeNumericUpDown1.Value = 0;
            MaxHRTextBox.Clear();
            HR85textBox.Clear();
            MaleRadioButton.Checked          = false;
            FemaleRadioButton.Checked        = false;
            readynessCheckBox.Checked        = false;
            contraIndicationCheckBox.Checked = false;
            lifestyleCheckBox.Checked        = false;
            aerobicTextBox.Clear();
            fitnessTextBox.Clear();
            RemarksRichTextBox.Clear();
            HR1NumericUpDown.Value = 0;
            HR2NumericUpDown.Value = 0;
            HR3NumericUpDown.Value = 0;
            HR4NumericUpDown.Value = 0;
            HR5NumericUpDown.Value = 0;

            foreach (var series in chart1.Series)
            {
                series.Points.Clear();
            }
            checkAllForm();

            currentTested = new Tested();
        }
示例#2
0
 public Form2(Session session, DbEntities dbEnt)
 {
     InitializeComponent();
     currentSession = session;
     db             = dbEnt;
     currentTested  = new Tested();
 }
示例#3
0
        private void testedListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            // get selected db id
            int testedId = (testedListBox.SelectedItem as HiddenValue).Id;

            currentTested = db.TestedSet.Where(t => t.Id == testedId).FirstOrDefault();

            // clear graph
            foreach (var series in chart1.Series)
            {
                series.Points.Clear();
            }

            // set all infos in the form
            NameTextBox.Text                 = currentTested.name;
            AgeNumericUpDown1.Value          = currentTested.age;
            readynessCheckBox.Checked        = currentTested.readynessToEx;
            contraIndicationCheckBox.Checked = currentTested.contraIndication;
            lifestyleCheckBox.Checked        = currentTested.lifestyleActlvl;

            MaleRadioButton.Checked   = currentTested.sex;
            FemaleRadioButton.Checked = !currentTested.sex;

            aerobicTextBox.Clear();
            fitnessTextBox.Clear();

            HR1NumericUpDown.Value   = int.Parse(currentTested.hearthRate.Split(',')[0]);
            HR1NumericUpDown.Enabled = true;
            HR2NumericUpDown.Value   = int.Parse(currentTested.hearthRate.Split(',')[1]);
            HR3NumericUpDown.Value   = int.Parse(currentTested.hearthRate.Split(',')[2]);
            HR4NumericUpDown.Value   = int.Parse(currentTested.hearthRate.Split(',')[3]);
            HR5NumericUpDown.Value   = int.Parse(currentTested.hearthRate.Split(',')[4]);
            RemarksRichTextBox.Text  = currentTested.remarks;
            // set old record flag
            newTest = false;

            // form validation
            checkAllForm();
        }
示例#4
0
        private void importFromCSVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // import csv file

            String fName = "";

            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            fName = openFileDialog1.FileName;
            StreamReader sr = new StreamReader(fName);

            // read file
            while (sr.Peek() != -1)
            {
                Tested importTested = new Tested();
                String line         = sr.ReadLine();
                // set test proprieties
                String[] infoImport = line.Split(',');
                importTested.name             = infoImport[0];
                importTested.age              = int.Parse(infoImport[1]);
                importTested.sex              = (infoImport[2] == "M");
                importTested.lifestyleActlvl  = false;
                importTested.readynessToEx    = false;
                importTested.contraIndication = false;
                importTested.remarks          = "";
                importTested.hearthRate       = "0,0,0,0,0";
                importTested.SessionSet       = currentSession;
                // add to db
                db.TestedSet.Add(importTested);
            }
            sr.Close();
            db.SaveChanges();

            UpdateTestedListBox();
        }