Exemple #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();
            }
        }
Exemple #3
0
        private string sGetMaxCode()
        {
            string result   = "";
            string statment = "";

            try
            {
                statment = "SELECT ISNULL(Max(convert(decimal , substring(Code,5,11))),0) " + "\n" +
                           "FROM [Question]" + "\n";
                result = BasicClass.fReturnScalar(statment, this.Name);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex.Message, this.Name, "sGetMaxCode");
                result = "";
            }
            return(result);
        }
        private string sGetMinCode()
        {
            string result   = "";
            string statment = "";

            BasicClass.vSqlConn = new SqlConnection(BasicClass.vConectionString);
            try
            {
                statment = "SELECT ISNULL(Min(convert(decimal , substring(Code,5,11))),0) " + "\n" +
                           "FROM [Book]" + "\n";
                result = BasicClass.fReturnScalar(statment, this.Name);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex.Message, this.Name, "sGetMinCode");
                result = "";
            }
            return(result);
        }