//SEARCH

        private void btnHakuOp_Click(object sender, EventArgs e)
        {
            if (tbOp.Text != "")
            {
                tbOp.Text = SukuVar;
                OpListForm opListForm = new OpListForm(Opiskelijat, SukuVar, idChecker, Alt);
                SukuVar = opListForm.SukuVar;
                opListForm.ShowDialog();
                this.Show();
                try
                {
                    gbOp.Enabled     = true;
                    gbMuu.Enabled    = true;
                    gbKrHaku.Enabled = true;
                    btnTyh.Enabled   = true;
                    var So = opListForm.SelectedOpiskelija;
                    populateForm(So);
                }
                catch
                {
                    gbOp.Enabled     = false;
                    gbMuu.Enabled    = false;
                    gbKrHaku.Enabled = false;
                    btnTyh.Enabled   = false;
                }
            }
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnHakuOp_Click(object sender, EventArgs e)
        {
            if (tbOp.Text != "" /*CHECK FOR EXISTENCE WILL BE MADE IN OPLISTFORM*/)
            {
                tbOp.Text = SukuVar;
                OpListForm opListForm = new OpListForm(Opiskelijat, SukuVar, idChecker, Alt);
                SukuVar = opListForm.SukuVar;
                opListForm.ShowDialog();
                this.Show();

                //try
                //{

                //}
                //catch
                //{

                //}
                //THE VOID FROM DATAACCESS


                //Opiskelijat = db.HaeOpiskelijat(lbSuku.Text);
                gbOp.Enabled  = true;
                gbMuu.Enabled = true;
                gbKr.Enabled  = true;

                this.populateForm();
            }
            //else if () {}
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        private void btnHakuOp_Click(object sender, EventArgs e)
        {
            if (tbOp.Text != "" /*CHECK FOR EXISTENCE WILL BE MADE IN OPLISTFORM*/)
            {
                tbOp.Text = SukuVar;
                OpListForm opListForm = new OpListForm(Opiskelijat, SukuVar, idChecker, Alt);
                SukuVar = opListForm.SukuVar;
                opListForm.ShowDialog();
                this.Show();

                //try
                //{

                //}
                //catch
                //{

                //}

                gbOp.Enabled  = true;
                gbMuu.Enabled = true;
                gbKr.Enabled  = true;
                // var asd = this.selectedid;

                var So = opListForm.SelectedOpiskelija;

                var asd = opListForm.SelectedId;
                populateForm(asd);
            }
            //else if () {} NOT FOUND
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //SEARCH

        private void btnHakuOp_Click(object sender, EventArgs e)
        {
            if (tbOp.Text != "")
            {
                tbOp.Text = SukuVar;
                OpListForm opListForm = new OpListForm(Opiskelijat, SukuVar, idChecker, Alt);
                SukuVar = opListForm.SukuVar;
                opListForm.ShowDialog();
                this.Show();
                try
                {
                    gbOp.Enabled     = true;
                    gbMuu.Enabled    = true;
                    gbKrHaku.Enabled = true;
                    btnTyh.Enabled   = true;
                    var So = opListForm.SelectedOpiskelija;
                    populateForm(So);
                    //
                    gbKr.Enabled        = false;
                    lbKrID.Text         = "Kurssin ID";
                    tbKrNimi.Text       = null;
                    tbKrNimi.ReadOnly   = true;
                    gbKoeHaku.Enabled   = false;
                    gbKoe.Enabled       = false;
                    lbKoID.Text         = "Kokeen ID";
                    tbKoeNimi.Text      = null;
                    tbKoeNimi.ReadOnly  = true;
                    tbKoeNimi.BackColor = SystemColors.Control;
                    tbOpett.Text        = null;
                    tbOpett.ReadOnly    = true;
                    tbOpett.BackColor   = SystemColors.Control;
                    tbVaik.Text         = null;
                    tbVaik.ReadOnly     = true;
                    tbVaik.BackColor    = SystemColors.Control;
                    tbKieli.Text        = null;
                    tbKieli.ReadOnly    = true;
                    tbKieli.BackColor   = SystemColors.Control;
                    tbPvm.Text          = null;
                    tbPvm.ReadOnly      = true;
                    tbPvm.BackColor     = SystemColors.Control;
                    tbTPO.Text          = null;
                    tbTPO.ReadOnly      = true;
                    tbTPO.BackColor     = SystemColors.Control;
                    tbSPO.Text          = null;
                    tbSPO.ReadOnly      = true;
                    tbSPO.BackColor     = SystemColors.Control;
                    //
                }
                catch
                {
                    gbOp.Enabled     = false;
                    gbMuu.Enabled    = false;
                    gbKrHaku.Enabled = false;
                    btnTyh.Enabled   = false;
                    //
                    gbKr.Enabled        = false;
                    lbKrID.Text         = "Kurssin ID";
                    tbKrNimi.Text       = null;
                    tbKrNimi.ReadOnly   = true;
                    gbKoeHaku.Enabled   = false;
                    gbKoe.Enabled       = false;
                    lbKoID.Text         = "Kokeen ID";
                    lbVID.Text          = "Vastaus ID";
                    tbKoeNimi.Text      = null;
                    tbKoeNimi.ReadOnly  = true;
                    tbKoeNimi.BackColor = SystemColors.Control;
                    tbOpett.Text        = null;
                    tbOpett.ReadOnly    = true;
                    tbOpett.BackColor   = SystemColors.Control;
                    tbVaik.Text         = null;
                    tbVaik.ReadOnly     = true;
                    tbVaik.BackColor    = SystemColors.Control;
                    tbKieli.Text        = null;
                    tbKieli.ReadOnly    = true;
                    tbKieli.BackColor   = SystemColors.Control;
                    tbPvm.Text          = null;
                    tbPvm.ReadOnly      = true;
                    tbPvm.BackColor     = SystemColors.Control;
                    tbTPO.Text          = null;
                    tbTPO.ReadOnly      = true;
                    tbTPO.BackColor     = SystemColors.Control;
                    tbSPO.Text          = null;
                    tbSPO.ReadOnly      = true;
                    tbSPO.BackColor     = SystemColors.Control;
                    //
                }
            }
            else
            {
                MessageBox.Show("Haku on tyhjä!", "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }