private void frm_create_test_Load(object sender, EventArgs e)
 {
     s=null;
     ob=new class_Application();
     s = "select exam_code,exam_name from exam_master;";
     ob.fill_combo_box(comboBox1, s, "exam_name");
  }
        private void frm_SelectStudent_Load(object sender, EventArgs e)
        {
            ob = new class_Application();
            s = "select user_id,user_name from user_access";
            ds = ob.fill_data_set(s);


            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add("user_id", "USER ID");
            dataGridView1.Columns.Add("user_name", "USER NAME");
            dataGridView1.Columns.Add(chk);
            dataGridView1.Columns[2].HeaderText = "SELECT";
            dataGridView1.Columns[2].Name = "select";
            dataGridView1.RowHeadersVisible = false;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.Programmatic;
            dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.Programmatic;



            dataGridView1.Rows.Add(ds.Tables[0].Rows.Count);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {   dataGridView1.Rows[i].Cells["user_id"].Value = ds.Tables[0].Rows[i]["user_id"];
                dataGridView1.Rows[i].Cells["user_name"].Value = ds.Tables[0].Rows[i]["user_name"];
            }


        }
   //----form load event--->
   private void frm_create_questions_Load(object sender, EventArgs e)
   {
      
       ob = new class_Application();
       refresh_me();
 
   }
        private void frm_experimemnt_Load(object sender, EventArgs e)
        {

            seconds = Duration * 60;
            ob = new class_Application();
            count = 0;
            MyTabs();

        }
        //---form load event-------->
        private void frm_select_exam_Load(object sender, EventArgs e)
        {
            ob = new class_Application();
            s = null;
            
            
             s="SELECT Test_Master.Exam_code, Test_Master.Test_code, Exam_Master.Exam_Name, Test_Master.Test_Name,"+
              " Test_Master.Test_Duration FROM (Exam_Master INNER JOIN Test_Master ON"+
              " Exam_Master.Exam_Code = Test_Master.Exam_code) INNER JOIN Questions_Master "+
              "ON (Exam_Master.Exam_Code = Questions_Master.Exam_code) AND (Test_Master.Test_code = Questions_Master.Test_code)"+
              " AND (Test_Master.Exam_code = Questions_Master.Exam_code);";
             ds = ob.fill_data_set(s);

             var query = from p in ds.Tables[0].AsEnumerable()
                         group p by new
                         {
                             ExamCode=p.Field<string>(0),
                             TestCode=p.Field<string>(1),
                             ExamNmae=p.Field<string>(2),
                             TestName=p.Field<string>(3),
                             Duration=p.Field<int>(4)
                         } into grp
                         select new
                         {
                             ExamCode = grp.Key.ExamCode,
                             TestCode = grp.Key.TestCode,
                             ExamNmae = grp.Key.ExamNmae,
                             TestName = grp.Key.TestName,
                             Duration = grp.Key.Duration 
                         };


          
             DataTable dt_table = new DataTable();
             dt_table.Columns.Add("ExamCode", typeof(string));
             dt_table.Columns.Add("TestCode", typeof(string));
             dt_table.Columns.Add("ExamName", typeof(string));
             dt_table.Columns.Add("TestName", typeof(string));
             dt_table.Columns.Add("Duration", typeof(int));
             DataRow combo_row;

             foreach (var grp in query)
             {   combo_row = dt_table.NewRow();
                 combo_row["ExamCode"] = grp.ExamCode;
                 combo_row["TestCode"] = grp.TestCode;
                 combo_row["ExamName"] = grp.ExamNmae;
                 combo_row["TestName"] = grp.TestName;
                 combo_row["Duration"] = grp.Duration;
                 dt_table.Rows.Add(combo_row);
            }

          
            comboBox1.DataSource = dt_table;
            comboBox1.DisplayMember = "ExamName";
            
         }
        private void frm_subject_master_Load(object sender, EventArgs e)
        {
            exam_code = null;
            ob = new class_Application();
            //---filling the combobox1-->
            s = "select exam_code,exam_name from exam_master;";
            ob.fill_combo_box(comboBox1, s, "exam_name");



        }
 private void Form1_Load(object sender, EventArgs e)
 {
     //--instantiating the parent form-->
     class_Application.parent_form = this;
     //--instantiating the object ob of the class application--->
     ob = new class_Application();
     frm_login frm_login = new frm_login();
     frm_login.MdiParent  = this;
     frm_login.StartPosition = FormStartPosition.CenterScreen;
     frm_login.Show();
     
 }
        private void frm_subject_master_Load(object sender, EventArgs e)
        {
            exam_code = null;
            group_code = null;
            ob = new class_Application();
           
            s = "select exam_code,exam_name from exam_master;";
            ob.fill_combo_box(comboBox1, s, "exam_name");
            s = "select group_code,group_name from group_master";
            ob.fill_combo_box(comboBox2, s, "group_name");

        }
        //---button click event for successful login--->
        private void button1_Click(object sender, EventArgs e)
        {
            string s;
            s = null;
            DataSet ds = new DataSet();
            ob = new class_Application();
            s = "SELECT User_Access.User_ID,user_name,user_role FROM User_Access where user_name='"+ textBox1.Text.ToUpper() +"' and user_password='******' and is_active=1;";
            ds = ob.fill_data_set(s);

         


  


            //---elaborate login code will go in here----->
            if (ds.Tables[0].Rows.Count>0 && Convert.ToString(ds.Tables[0].Rows[0][2]).Equals("ADMIN"))
            {   class_Application.user_id = Convert.ToString(ds.Tables[0].Rows[0][0]);
                class_Application.user_name = Convert.ToString(ds.Tables[0].Rows[0][1]);
                class_Application.parent_form.enable_admin_menu();
                this.Close();
            }

               

            else if (ds.Tables[0].Rows.Count > 0 && Convert.ToString(ds.Tables[0].Rows[0][2]).Equals("USER"))
            {
                class_Application.user_id = Convert.ToString(ds.Tables[0].Rows[0][0]);
                class_Application.user_name = Convert.ToString(ds.Tables[0].Rows[0][1]);
                class_Application.parent_form.enable_user_menu();
                this.Close();
            }


            else
            {
                MessageBox.Show("Please check your login id or password");
            }
        }
        private void frm_QuestionAddEdit_Load(object sender, EventArgs e)
        {   s = null;
            ob = new class_Application();
            
            s = "SELECT Exam_Master.Exam_Code, Test_Master.Test_code, Subject_Master.Sub_code, Exam_Master.Exam_Name, " +
                "Test_Master.Test_Name, Subject_Master.Sub_Name FROM (Exam_Master INNER JOIN Test_Master ON " +
                "Exam_Master.Exam_Code = Test_Master.Exam_code) INNER JOIN Subject_Master ON Exam_Master.Exam_Code = " +
                "Subject_Master.Exam_code;";

            dt = new DataTable();
            dt = ob.fill_data_table(s);

            var query = from p in dt.AsEnumerable()
                        group p by new
                        {   ExamCode = p.Field<string>("Exam_Code"),
                            ExamName = p.Field<string>("Exam_Name")
                        } into grp
                        select new
                        {   ExamCode = grp.Key.ExamCode,
                            ExamName = grp.Key.ExamName
                        };

            DataTable ExamTable = new DataTable("Exam_Master");
            ExamTable.Columns.Add("ExamCode", typeof(string));
            ExamTable.Columns.Add("ExamName", typeof(string));

            foreach (var grp in query)
            {   DataRow dr = ExamTable.NewRow();
                dr["ExamCode"] = grp.ExamCode;
                dr["ExamName"] = grp.ExamName;
                ExamTable.Rows.Add(dr);
            }

           
            comboBox1.DataSource = ExamTable;
            comboBox1.DisplayMember = "ExamName";
             
        }
        //-----form load event---->
        private void Frm_test_type_Load(object sender, EventArgs e)
        {

            ob = new class_Application();
            fill_grid();
        }
        //--form load event---->
        private void frm_exam_Load(object sender, EventArgs e)
        {

            
            count = 0;
            ob = new class_Application();

            if (class_Application.REVIEW == 0)
            {
                timer1.Enabled = true;
                lbl_timer.Visible = true;

                string s = "SELECT Exam_Master.Exam_Code, Subject_Master.Sub_code, Test_Master.Test_code, Exam_Master.Exam_Name," +
               " Subject_Master.Sub_Name, Test_Master.Test_Name, Questions_Master.Q_No, Questions_Master.Q_Name, " +
               "Questions_Master.Answer1, Questions_Master.Answer2, Questions_Master.Answer3, Questions_Master.Answer4, " +
               "Questions_Master.Answer5, Questions_Master.Answer6, Questions_Master.Answer7, Questions_Master.Answer8, " +
               "Questions_Master.Answer9, Questions_Master.Answer10, Questions_Master.Answer11, Questions_Master.Answer12, " +
               "Questions_Master.Answer13, Questions_Master.Answer14, Questions_Master.Answer15, Questions_Master.Answer16," +
               " Questions_Master.Answer17, Questions_Master.Answer18, Questions_Master.Qname_HasImage,"+
               "Questions_Master.Q_type,Exam_Master.Can_Skip,sub_duration FROM ((Exam_Master INNER JOIN Subject_Master ON " +
               "Exam_Master.Exam_Code = Subject_Master.Exam_code) INNER JOIN Test_Master ON Exam_Master.Exam_Code = " +
               "Test_Master.Exam_code) INNER JOIN Questions_Master ON (Exam_Master.Exam_Code = Questions_Master.Exam_code) AND " +
               "(Test_Master.Test_code = Questions_Master.Test_code) AND (Test_Master.Exam_code = Questions_Master.Exam_code)" +
               " AND (Subject_Master.Exam_code = Questions_Master.Exam_code) AND (Subject_Master.Sub_code = Questions_Master.Sub_code) " +
               "WHERE (((Exam_Master.Exam_Code)='" + ExamCode + "') AND ((Test_Master.Test_code)='" + TestCode + "'));";
                init_datatable = ob.fill_data_table(s);
                collection = new DataTable();
                collection = init_datatable.Clone();
                collection.Columns.Add("option1", typeof(int));
                collection.Columns.Add("option2", typeof(int));
                collection.Columns.Add("option3", typeof(int));
                collection.Columns.Add("option4", typeof(int));
                collection.Columns.Add("option5", typeof(int));
                collection.Columns.Add("option6", typeof(int));
                collection.Columns.Add("option7", typeof(int));
                collection.Columns.Add("option8", typeof(int));
                collection.Columns.Add("option9", typeof(int));
                collection.Columns.Add("option10", typeof(int));
                collection.Columns.Add("option11", typeof(int));
                collection.Columns.Add("option12", typeof(int));
                collection.Columns.Add("option13", typeof(int));
                collection.Columns.Add("option14", typeof(int));
                collection.Columns.Add("option15", typeof(int));
                collection.Columns.Add("option16", typeof(int));
                collection.Columns.Add("option17", typeof(int));
                collection.Columns.Add("option18", typeof(int));
                collection.Columns.Add("essay_answer", typeof(string));



                var query = from p in init_datatable.AsEnumerable()
                            group p by new
                            {
                                SubjectCode = p.Field<string>("Sub_code"),
                                SubjectName = p.Field<string>("Sub_Name"),
                                time = p.Field<int>("sub_duration"),
                                CanSkip = p.Field<int>("Can_Skip")
                            } into grp
                            select new
                            {
                                SubjectCode = grp.Key.SubjectCode,
                                SubjectName = grp.Key.SubjectName,
                                time = grp.Key.time,
                                CanSkip = grp.Key.CanSkip
                            };

                Subject = new DataTable("Subject");
                Subject.Columns.Add("SubjectCode", typeof(string));
                Subject.Columns.Add("SubjectName", typeof(string));
                Subject.Columns.Add("time", typeof(int));
                Subject.Columns.Add("CanSkip", typeof(int));
                foreach (var grp in query)
                {
                    DataRow dr = Subject.NewRow();
                    dr["SubjectCode"] = grp.SubjectCode;
                    dr["SubjectName"] = grp.SubjectName;
                    dr["time"] = grp.time;
                    dr["CanSkip"] = grp.CanSkip;
                    Subject.Rows.Add(dr);
                }

                lbl_exam.Text = ExamName;
                lbl_test.Text = TestName;
                string sub_code = Convert.ToString(Subject.Rows[count]["SubjectCode"]);
                time = Convert.ToInt32(Subject.Rows[count]["time"]) * 60;
                bind_data(sub_code);


               }
            else
            {
                timer1.Enabled = false;
                lbl_timer.Visible = false;

                string s = "SELECT Exam_Master.Exam_Code, Subject_Master.Sub_code, Test_Master.Test_code, Exam_Master.Exam_Name, "+
                           "Subject_Master.Sub_Name, Test_Master.Test_Name, Questions_Master.Q_No, Questions_Master.Q_Name, Questions_Master.Answer1, "+
                           "Questions_Master.Answer2, Questions_Master.Answer3, Questions_Master.Answer4, Questions_Master.Answer5, "+
                           "Questions_Master.Answer6, Questions_Master.Answer7, Questions_Master.Answer8, Questions_Master.Answer9, "+
                           "Questions_Master.Answer10, Questions_Master.Answer11, Questions_Master.Answer12, Questions_Master.Answer13, "+
                           "Questions_Master.Answer14, Questions_Master.Answer15, Questions_Master.Answer16, Questions_Master.Answer17, "+
                           "Questions_Master.Answer18, Questions_Master.Qname_HasImage, Questions_Master.Correct_Option, Questions_Master.Q_type, "+
                           "User_Exam_Dtl.Option1, User_Exam_Dtl.Option2, User_Exam_Dtl.Option3, User_Exam_Dtl.Option4, User_Exam_Dtl.Option5, "+
                           "User_Exam_Dtl.Option6, User_Exam_Dtl.Option7, User_Exam_Dtl.Option8, User_Exam_Dtl.Option9, User_Exam_Dtl.Option10, "+
                           "User_Exam_Dtl.Option11, User_Exam_Dtl.Option12, User_Exam_Dtl.Option13, User_Exam_Dtl.Option14, User_Exam_Dtl.Option15, "+
                           "User_Exam_Dtl.Option16, User_Exam_Dtl.Option17, User_Exam_Dtl.Option18, User_Exam_Dtl.Essay_Answer FROM (((Exam_Master INNER "+
                           "JOIN Test_Master ON Exam_Master.Exam_Code = Test_Master.Exam_code) INNER JOIN Subject_Master ON Exam_Master.Exam_Code = "+
                           "Subject_Master.Exam_code) INNER JOIN Questions_Master ON (Exam_Master.Exam_Code = Questions_Master.Exam_code) AND "+
                           "(Test_Master.Test_code = Questions_Master.Test_code) AND (Test_Master.Exam_code = Questions_Master.Exam_code) AND "+
                           "(Subject_Master.Exam_code = Questions_Master.Exam_code) AND (Subject_Master.Sub_code = Questions_Master.Sub_code)) "+
                           "INNER JOIN User_Exam_Dtl ON (Exam_Master.Exam_Code = User_Exam_Dtl.Exam_code) AND (Questions_Master.Q_No = User_Exam_Dtl.Q_No) "+
                           "AND (Questions_Master.Test_code = User_Exam_Dtl.Test_code) AND (Questions_Master.Sub_code = User_Exam_Dtl.Sub_code) AND "+
                           "(Questions_Master.Exam_code = User_Exam_Dtl.Exam_code) WHERE (((Exam_Master.Exam_Code)='"+ ExamCode +"') AND "+
                           "((Test_Master.Test_code)='"+ TestCode +"') AND ((User_Exam_Dtl.User_ID)='"+ class_Application.user_id +"'));";

                init_datatable = ob.fill_data_table(s);


                var query = from p in init_datatable.AsEnumerable()
                            group p by new
                            {
                                SubjectCode = p.Field<string>("Sub_code"),
                                SubjectName = p.Field<string>("Sub_Name"),
                            } into grp
                            select new
                            {
                                SubjectCode = grp.Key.SubjectCode,
                                SubjectName = grp.Key.SubjectName,
                             
                            };

                Subject = new DataTable("Subject");
                Subject.Columns.Add("SubjectCode", typeof(string));
                Subject.Columns.Add("SubjectName", typeof(string));
                foreach (var grp in query)
                {
                    DataRow dr = Subject.NewRow();
                    dr["SubjectCode"] = grp.SubjectCode;
                    dr["SubjectName"] = grp.SubjectName;
                    Subject.Rows.Add(dr);
                }

                lbl_exam.Text = ExamName;
                lbl_test.Text = TestName;
                string sub_code = Convert.ToString(Subject.Rows[count]["SubjectCode"]);
                bind_data_for_review(sub_code);

            }
        }
示例#13
0
 private void Form1_Load(object sender, EventArgs e)
 {
     ob = new class_Application();
     MyTabs();
 }
 //---load event for organisation master--->
 private void frm_mater_organisation_Load(object sender, EventArgs e)
 {
     ob = new class_Application();
     fill_grid();
 }
        private void frm_sub_group_Load(object sender, EventArgs e)
        {
           ob = new class_Application();
           fill_grid();

       }
        private void frm_create_user_Load(object sender, EventArgs e)
        {

            ob = new class_Application();
            fill_grid();
        }