Beispiel #1
0
 private void btnModification_Click(object sender, EventArgs e)
 {
     if (txtSubject.ReadOnly == true)
     {
         txtSubject.ReadOnly = false;
         txtTime.ReadOnly    = false;
     }
     else
     {
         if (txtSubject.Text != "")
         {
             var z = FunctionClassSubject.getById(idSubject);
             z.SubjectDescription = txtSubject.Text;
             FunctionClassSubject.update(z);
             MessageBox.Show("Zmodyfikowano!!");
             filldgSubject(dgGridSubject);
             txtSubject.ReadOnly = true;
             txtTime.ReadOnly    = true;
         }
         else if (txtTime.Text != "")
         {
             var zm = FunctionClassTime.getById(idTime);
             zm.TimeDuration = int.Parse(txtTime.Text);
             FunctionClassTime.update(zm);
             MessageBox.Show("Zmodyfikowano!!");
             Form1.filldgTime(dgGridTime);
             txtTime.ReadOnly    = true;
             txtSubject.ReadOnly = true;
         }
         else
         {
             MessageBox.Show("Nie można zostawić pustego  ");
         }
     }
 }
Beispiel #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Display(lblDisplay);

            if (hours == 0 && minutes == 0 && seconds == 0)
            {
                this.Location  = new System.Drawing.Point(500, 200);
                timer1.Enabled = false;
                foreach (Control p in gbTime.Controls)
                {
                    if ((p is TextBox) && ((TextBox)p).ReadOnly == false && p.Text != "")
                    {
                        LoadSchema();
                        SchemaForm();
                        txtSubject.Text = "Ukonczona fragment Schematu".ToUpper();
                        break;
                    }
                    else if ((p is TextBox) && ((TextBox)p).ReadOnly == true)
                    {
                        LoadSchema();
                        MiddleForm();
                        btnSchema.Text = "Plan";
                        break;
                    }
                }
                lblEnd.Visible  = true;
                txtTime.Visible = true;

                if (txtSubject.Text == "Ukonczona fragment Schematu".ToUpper())
                {
                    (new System.Media.SoundPlayer("Computer_Magic.wav")).Play();
                }
                else
                {
                    int przeliczona;
                    var z = FunctionClassSubject.getById(idSubject);

                    if (int.TryParse(txtTime.Text, out przeliczona))
                    {
                        z.Statystyka += przeliczona;
                        FunctionClassSubject.update(z);
                        filldgSubject(dgGridSubject);
                    }
                    else
                    {
                        MessageBox.Show("Proszę wpisać cyfrę");
                    }
                    txtTime.Text    = "";
                    txtSubject.Text = "Koniec";
                    (new System.Media.SoundPlayer("Computer_Magic.wav")).Play();
                }
                lblDisplaySchema.Text = addTime.ToString() + "";
            }
        }