Beispiel #1
0
        }//----------------------

        //##################################END PICTUREBOX pbxChecked EVENTS#########################################################

        //##################################PICTUREBOX pbxInsertSubjects EVENTS######################################################
        //event is raised when the picture box is clicked
        private void pbxInsertSubjectsClick(object sender, EventArgs e)
        {
            Boolean isValid     = true;
            Boolean hasInserted = false;

            for (Int32 x = 0; x < this.dgvList.Rows.Count; x++)
            {
                if ((Boolean)this.dgvList.Rows[x].Cells["checkbox_column"].Value)
                {
                    if (!_studentManager.InsertStudentLoad(dgvList.Rows[x].Cells["sysid_schedule"].Value.ToString(), _isInternational))
                    {
                        DataGridViewCell dgvCell = this.dgvList.Rows[x].Cells["sysid_schedule"];

                        dgvCell.ErrorText = "This schedule conflicts with another ";

                        ToolTip errToolTip = new ToolTip();

                        errToolTip.Show(dgvCell.ErrorText, this.dgvList, 10);

                        isValid = false;
                    }
                    else
                    {
                        hasInserted = true;
                    }
                }
            }

            if (isValid)
            {
                if (hasInserted)
                {
                    _hasSelected = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("There is no subject schedule that has been selected!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }//-----------------------