Exemplo n.º 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 hasInserted = false;
            Boolean hasErrors   = false;

            this.dgvList.EndEdit();

            this.dgvList.ShowCellErrors = true;

            DataTable conflictSchduleTable = _teacherLoadingManager.SelectByScheduleDetailsListConflictsWithAnotherScheduleTeacherLoad(_userInfo,
                                                                                                                                       (DataTable)this.dgvList.DataSource, _employeeId);

            for (Int32 x = 0; x < this.dgvList.Rows.Count; x++)
            {
                if ((Boolean)this.dgvList.Rows[x].Cells["checkbox_column"].Value)
                {
                    if (!_teacherLoadingManager.HasConflictSchedule(conflictSchduleTable, dgvList.Rows[x].Cells["sysid_schedule"].Value.ToString()))
                    {
                        _teacherLoadingManager.InsertTeacherLoadCached(_employeeId, dgvList.Rows[x].Cells["sysid_schedule"].Value.ToString());

                        hasInserted = true;
                    }
                    else
                    {
                        this.dgvList.Rows[x].Cells["checkbox_column"].Value = false;

                        DataGridViewCell dgvCell = this.dgvList.Rows[x].Cells["sysid_schedule"];

                        CommonExchange.Employee empInfo = _teacherLoadingManager.GetEmployeeInformation(_userInfo, _employeeId);

                        dgvCell.ErrorText = "This schedule conflicts with another schedule that has been loaded to " +
                                            RemoteClient.ProcStatic.GetCompleteNameFullMiddleName(empInfo.PersonInfo.LastName, empInfo.PersonInfo.FirstName,
                                                                                                  empInfo.PersonInfo.MiddleName) + " from another department.";

                        ToolTip errToolTip = new ToolTip();

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

                        hasErrors = true;
                    }
                }
            }

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