Ejemplo n.º 1
0
        }//---------------------

        //###########################################END BUTTON btnClose EVENTS####################################################

        //###########################################LISTVIEW lsvMajorExam EVENTS#####################################################
        //event is raised when the checked is changed
        private void lsvMajorExamItemChecked(object sender, ItemCheckedEventArgs e)
        {
            if (e.Item.Checked && _cashieringManager.IsClearanceIncluded(e.Item.SubItems[1].Text))
            {
                this.lsvMajorExam.ItemChecked -= new ItemCheckedEventHandler(lsvMajorExamItemChecked);

                _cashieringManager.InitializeInsertedExamSchedule(e.Item.SubItems[1].Text, e.Item.Checked);

                Int32 index = 0;

                foreach (ListViewItem item in lsvMajorExam.Items)
                {
                    if (item.Checked && index != e.Item.Index)
                    {
                        item.Checked = false;

                        _cashieringManager.InitializeInsertedExamSchedule(item.SubItems[1].Text, item.Checked);
                    }

                    index++;
                }

                this.lsvMajorExam.ItemChecked += new ItemCheckedEventHandler(lsvMajorExamItemChecked);
            }
            else if (e.Item.Checked && !_cashieringManager.IsClearanceIncluded(e.Item.SubItems[1].Text))
            {
                this.lsvMajorExam.ItemChecked -= new ItemCheckedEventHandler(lsvMajorExamItemChecked);

                _cashieringManager.InitializeInsertedExamSchedule(e.Item.SubItems[1].Text, e.Item.Checked);

                Int32 index = 0;

                foreach (ListViewItem item in lsvMajorExam.Items)
                {
                    if (_cashieringManager.IsClearanceIncluded(item.SubItems[1].Text))
                    {
                        item.Checked = false;

                        _cashieringManager.InitializeInsertedExamSchedule(item.SubItems[1].Text, item.Checked);
                    }

                    index++;
                }

                this.lsvMajorExam.ItemChecked += new ItemCheckedEventHandler(lsvMajorExamItemChecked);
            }
            else
            {
                this.lsvMajorExam.ItemChecked -= new ItemCheckedEventHandler(lsvMajorExamItemChecked);

                _cashieringManager.InitializeInsertedExamSchedule(e.Item.SubItems[1].Text, e.Item.Checked);

                this.lsvMajorExam.ItemChecked += new ItemCheckedEventHandler(lsvMajorExamItemChecked);
            }


            this.btnPrint.Enabled = this.lsvMajorExam.CheckedItems.Count <= 0 ? false : true;
        }//-----------------------