protected void Button_OK_Click(object sender, EventArgs e)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
            //do it
            string s = "";

            foreach (GridViewRow r in GridView2.Rows)
            {
                if (r.BackColor == System.Drawing.Color.DarkGray)
                {
                    s = r.Cells[0].Text;
                    Exam_Entry ex1 = new Exam_Entry();
                    ex1.Load(s);
                    if (ex1.CanDelete())
                    {
                        s = "delete";
                        ex1.Delete();
                    }
                    else
                    {
                        s = "withdraw";
                        ex1.Withdraw();
                    }
                }
            }
            SqlDataSource2.SelectCommand = GetQueryString();
            Encode en = new Encode();

            SqlDataSource2.ConnectionString = en.GetDbConnection();
            SqlDataSource2.DataBind();
            Button_Delete.Visible = false;
        }
示例#2
0
        protected void Button_CheckTime_Click(object sender, EventArgs e)
        {
            string       s        = TextBox1.Text;
            string       ErrorMsg = "";
            TextFileType ftype1   = TextFileType.Unknown;

            try
            {
                ftype1 = (TextFileType)ViewState["TextFileType"];
            }
            catch
            {
                Label_Text.Text = "File Type not recognised"; return;
            }
            char[]          ct1    = new char[1]; ct1[0] = (char)0x09;
            string[]        fields = new string[20];
            ExamsUtility    u      = new ExamsUtility();
            PupilGroupList  pgl    = new PupilGroupList();
            ExamConversions Ec     = new ExamConversions();
            SimplePupil     pupil1 = new SimplePupil();
            Guid            g1     = new Guid(); g1 = Guid.Empty;
            DateTime        t1     = new DateTime(); t1 = DateTime.Now;

            using (StringReader sr = new StringReader(s))
            {
                string firstline = sr.ReadLine();
                string line      = sr.ReadLine();
                fields = line.Split(ct1);
                Exam_Board exbde1 = Ec.GetExamBoard(fields[1]);
                switch (ftype1)
                {
                case TextFileType.Unknown:
                    Label_Text.Text = "File Type not recognised";
                    break;

                case TextFileType.Students:       //Admission Number,Surname, GivenName,Board,Syllabus,Option...";
                    try
                    {
                        pupil1.Load_StudentIdOnly(System.Convert.ToInt32(fields[0]));    ///loads lft students aswell
                        if (!u.AddEntry(pupil1.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1))
                        {
                            Label_Text.Text = ErrorMsg; return;
                        }
                        else
                        {
                            Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete();
                        }
                    }
                    catch (Exception ex)
                    {
                        Label_Text.Text = ex.ToString(); return;
                    }
                    break;

                case TextFileType.Sets:
                    pgl.m_pupilllist.Clear();
                    pgl.AddToList(fields[0], DateTime.Now);
                    foreach (SimplePupil p in pgl.m_pupilllist)
                    {
                        try
                        {
                            if (!u.AddEntry(p.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1))
                            {
                                Label_Text.Text = ErrorMsg; return;
                            }
                            else
                            {
                                Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete();
                            }
                        }
                        catch (Exception ex)
                        {
                            Label_Text.Text = ex.ToString(); return;
                        }
                    }
                    break;

                default:
                    break;
                }

                //done one set or one student...scale up....
                TimeSpan ts1 = DateTime.Now - t1; TimeSpan ts2 = new TimeSpan(); ts2 = ts1;
                while ((line = sr.ReadLine()) != null)
                {
                    ts2 += ts1;
                }
                TextBox_Warning.Text     = "WARNING:  This operation is likely to take about " + ts2.ToString() + Environment.NewLine + "Press Process Button to continue...";
                TextBox_Warning.Visible  = true;
                Button_CheckTime.Visible = false;
                Button_Process.Visible   = true;
            }
        }