示例#1
0
        private void Toolbar_Application_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            try
            {
                switch (e.Tool.Key)
                {
                case "BTN_Users":
                case "BTN_Books":
                    //this.IsMdiContainer = true;
                    Frm_BOOKS Form2 = new Frm_BOOKS();
                    //Form2.MdiParent = this;
                    Form2.ShowDialog();
                    break;

                case "BTN_Students":
                    this.IsMdiContainer = true;
                    FRM_Students Form = new FRM_Students();
                    //Form.MdiParent = this;
                    Form.ShowDialog();
                    break;

                case "BTN_CreateQuestion":
                    this.IsMdiContainer = true;
                    FRM_Questions vFrm_Questions = new FRM_Questions();
                    vFrm_Questions.ShowDialog();
                    break;

                case "BTN_Exams":
                    string visExamTaken = BasicClass.fReturnScalar("SELECT ISNULL(IsExamTaken,'N') from [User] WHERE ID =" + BasicClass.vUsrID + " ", this.Name);
                    if (visExamTaken.Trim().ToUpper() == "Y")
                    {
                        MessageBox.Show("هذا المستخدم قام بتأدية ذلك الامتحان من قبل", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }
                    else
                    {
                        this.IsMdiContainer = true;
                        FRM_Exam vFrm_Exam = new FRM_Exam();
                        vFrm_Exam.ShowDialog();
                        break;
                    }

                case "BTN_Reports":
                    break;
                }
            }

            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex.Message, this.Name, "Toolbar_Application_ToolClick");
            }
        }
        private void radButton1_Click(object sender, EventArgs e)
        {
            string visExamTaken = BasicClass.fReturnScalar("SELECT ISNULL(IsExamTaken,'N') from [User] WHERE ID =" + BasicClass.vUsrID + " ", this.Name);

            if (visExamTaken.Trim().ToUpper() == "Y")
            {
                MessageBox.Show("هذا المستخدم قام بتأدية ذلك الامتحان من قبل", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                Application.Exit();
            }
            else
            {
                this.IsMdiContainer = true;
                FRM_Exam vFrm_Exam = new FRM_Exam();
                vFrm_Exam.ShowDialog();
            }
        }