Esempio n. 1
0
        private void PrcLoadCell(float ValuePro2)
        {
            if (TestStep == 1)
            {
                db.Database.ExecuteSqlCommand("UPDATE CTest.dbo.ProgramMain SET Counter1 =" + c + " WHERE id =" + PublicVar.ProgramID);
                txtCounter1.Text = c.ToString();
            }
            else if (TestStep == 2)
            {
                db.Database.ExecuteSqlCommand("UPDATE CTest.dbo.ProgramMain SET Counter2 =" + c + " WHERE id =" + PublicVar.ProgramID);
                txtCounter2.Text = c.ToString();
            }
            else if (TestStep == 3)
            {
                db.Database.ExecuteSqlCommand("UPDATE CTest.dbo.ProgramMain SET Counter1 =" + c + " WHERE id =" + PublicVar.ProgramID);
                txtCounter1.Text = c.ToString();
            }
            _Test.ProgramID = Convert.ToInt32(PublicVar.ProgramID);
            _Test.w2 = ValuePro2;
            _Test.timeer = DateTime.Now.TimeOfDay;
            db.TestReports.Add(_Test);
            db.SaveChanges();
            series_LoadCell2.Points.Add(new SeriesPoint(c.ToString(), ValuePro2));
            chartControl_WiegthChart.Series.Add(series_LoadCell2);
            txtTime.Refresh();
            XYDiagram di1 = chartControl_WiegthChart.Diagram as XYDiagram;
            di1.AxisY.WholeRange.MinValue = 100;



        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtCounter2.EditValue = txtCounter1.EditValue = 0;

                dbContext.SaveChanges();
                MessageBox.Show("The information was saved successfully in the database", "System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                gridControl1.Refresh();
            }
            catch (Exception)
            {
                MessageBox.Show("Problem with recording information ", " System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                gridControl1.Refresh();
            }
            gridControl1.Refresh();
        }