Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            using (WebClient client = new WebClient())
            {
                client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko");
                //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                client.Headers.Add("Authorization", "SNAeoB88JTmAXfNTAfpR");

                try
                {
                    string response = client.DownloadString("https://sandbox.apply-for-teacher-training.service.gov.uk/api/v1");
                }
                catch (Exception e2)
                {
                    string s5455 = e2.ToString();
                    s5455 = e2.InnerException.ToString();
                }
            }

            return;


            ISAMS_ExamStudentAccessList list44 = new ISAMS_ExamStudentAccessList();

            list44.load(18);


            ISAMS_ExamSeatingPlan_List list33 = new ISAMS_ExamSeatingPlan_List();

            list33.Load(18);

            // ISAMS_Set_PTOList Leena = new ISAMS_Set_PTOList();
            // Leena.load(12);



            return;



            ExamComponentResultList ecrl1 = new ExamComponentResultList();

            ecrl1.Load_OptionStudent(new Guid("d22c0f3e-38ff-4a81-9c00-dc7892548f68"), new Guid("fbbd073f-b4cd-4fb1-a12f-e3a755e7cc63"));
            string s = "";

            foreach (ExamComponentResult r in ecrl1.m_list)
            {
                s = r.ComponentStatus;
            }
            Response.Redirect("../studentinformation/ComponentResults.aspx?StudentId=fbbd073f-b4cd-4fb1-a12f-e3a755e7cc63 &OptionId=d22c0f3e-38ff-4a81-9c00-dc7892548f68");



            TT_compare(); return;

            //call from button..
            RegistrationsList r1 = new RegistrationsList();

            r1.Get_Recent_Registrations("6368");
            foreach (Registrations r in r1.Registrations)
            {
                TextBox1.Text += r.m_date.ToString() + "  " + r.m_staff + Environment.NewLine;
            }

            return;


            List <string> test3 = Get_Registrations("6368");

            foreach (string s4 in test3)
            {
                TextBox1.Text += s4 + Environment.NewLine;
            }
            return;

            IntPtr token     = IntPtr.Zero;
            string adno      = "6368";
            bool   isSuccess = LogonUser("test-staff", "challoners", "123Password",
                                         LOGON32_LOGON_NEW_CREDENTIALS,
                                         LOGON32_PROVIDER_DEFAULT, ref token);

            using (WindowsImpersonationContext person = new WindowsIdentity(token).Impersonate())
            {
                string path1 = @"\\registration.challoners.net\STEARsoft\Reg\data\cc\testfile.txt";
                //StreamReader sr1 = new StreamReader(path1);

                //string s = sr1.ReadLine();
                //Label4.Text = s;
                //s = s;
                int      i = 0; s = ""; int imax = 0; string sfile = "";
                string[] fileEntries = Directory.GetFiles(@"\\registration.challoners.net\STEARsoft\Reg\data", "attend*.csv");
                foreach (string fileName in fileEntries)
                {
                    //find last one!
                    s = fileName.Substring(fileName.IndexOf("log"));
                    try
                    {
                        s = s.Substring(3, 2);
                        i = System.Convert.ToInt32(s);
                        if (i > imax)
                        {
                            imax = i; sfile = fileName;
                        }
                    }
                    catch
                    {
                        try
                        {
                            s = s.Substring(3, 3);
                            i = System.Convert.ToInt32(s);
                            if (i > imax)
                            {
                                imax = i; sfile = fileName;
                            }
                        }
                        catch { }
                    }
                }
                if (imax > 0)
                {
                    string s1 = "";
                    Label4.Text = sfile;

                    StreamReader sr1 = new StreamReader(sfile);
                    while (!sr1.EndOfStream)
                    {
                        s = sr1.ReadLine();
                        string[] fred = s.Split((char)(','));

                        if (fred[4] == adno)
                        {
                            s1 = fred[11];
                        }
                    }
                }


                person.Undo();
            }



            return;



            //adno	first name	surname	StudentId	CourseId	StaffId	CommentType     poliyID	text
            Cerval_Library.TextReader text1 = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t     = new TextRecord();
            string     path = Server.MapPath(@"../App_Data/test.txt");
            FileStream f    = new FileStream(path, FileMode.Open);

            text1.ReadTextLine(f, ref t);//header row

            while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                ReportComment r = new ReportComment();
                r.m_studentId                = new Guid(t.field[3]);
                r.m_courseId                 = new Guid(t.field[4]);
                r.m_staffId                  = new Guid(t.field[5]);
                r.m_commentType              = System.Convert.ToInt32(t.field[6]);
                r.m_dateCreated              = DateTime.Now;
                r.m_dateModified             = r.m_dateCreated;
                r.m_collectionOutputPolicyId = new Guid(t.field[7]);
                r.m_content                  = t.field[8];
                r.Save();
            }
            f.Close();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString.Count >= 1)
                {
                    string type = Request.QueryString["Type"];
                    if (type == "Student")
                    {
                        string       Paper  = Request.QueryString["Paper"];
                        string       Date   = Request.QueryString["Date"];
                        string       Id     = Request.QueryString["Id"];
                        string       path   = Request.QueryString["path"];
                        PupilDetails pupil1 = new PupilDetails(Id);

                        //construct filename.....
                        string fname = path;
                        //date is 11/03/2012 etc.....
                        fname += Date.Substring(6, 4) + "_";
                        //for month want to go back to either 1 or 6.....
                        int m = System.Convert.ToInt16(Date.Substring(3, 2));
                        if (m < 5)
                        {
                            fname += "01_";
                        }
                        else
                        {
                            fname += "06_";
                        }
                        fname += Paper.Trim(); fname += ".txt";


                        //going to open the file

                        Cerval_Library.TextReader tr1 = new Cerval_Library.TextReader();
                        try
                        {
                            FileStream f1 = new FileStream(fname, FileMode.Open);
                            Cerval_Library.TextRecord tx1 = new TextRecord();
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are q nos..
                            string[] questions = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                questions[i] = tx1.field[i];
                            }
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are max marks..
                            string[] max = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                max[i] = tx1.field[i];
                            }

                            //row 3 has descriptions...
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are max marks..
                            string[] desc = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                desc[i] = tx1.field[i];
                            }

                            while (tr1.ReadTextLine(f1, ref tx1) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
                            {
                                if (tx1.field[1].Trim() == pupil1.m_adno.ToString())
                                {
                                    string s = tx1.field[0];//this is uci
                                    s  = "<p ><h3>Paper Breakdowns for " + pupil1.m_GivenName + " " + pupil1.m_Surname + " for" + Paper + "</h3><br /><TABLE BORDER   class=\"ResultsTbl\" style = \"font-size:small ;  \">";
                                    s += "<tr><th>Question</th><th>Max Mark</th><th>Your Mark</th><th>Question Description</th></tr>";
                                    for (int i = 3; i < tx1.number_fields + 1; i++)
                                    {
                                        s += "<tr><td>" + questions[i] + "</td><td>" + max[i] + "</td><td>" + tx1.field[i] + "</td><td>" + desc[i] + "</td></tr>";
                                    }
                                    s += "</table>";

                                    s += "<br/><h3>Please  note these are raw not UMS marks.</h3>";
                                    content4.InnerHtml = s;
                                    f1.Close();
                                    break;
                                }
                            }
                            f1.Close();
                        }
                        catch
                        {
                            //assume file not found....
                            content4.InnerHtml = "<h3> No data found for this paper</h3>";
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //file has  Board short name/optioncode/grade/mark


            if (!FileUpload1.HasFile)
            {
                return;
            }
            Cerval_Library.TextReader TxtRd1 = new Cerval_Library.TextReader();
            TextRecord t = new TextRecord(); int l = 0; int n = 0;
            string     s1 = ""; char ct = (char)0x09;

            int  n_Board = 0; int n_OptionCode = 0; int n_Grade = 0; int n_Mark = 0;
            bool f_Board = false; bool f_OptionCode = false; bool f_Grade = false; bool f_Mark = false;


            while (TxtRd1.ReadTextLine(FileUpload1.FileContent, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                l = s1.Length;
                for (int i = 0; i <= t.number_fields; i++)
                {
                    s1 += t.field[i] + ct;
                }
                if (s1.Length > l)
                {
                    s1 += Environment.NewLine;
                }
                if (n == 0)
                {
                    //going to look for our columns:
                    for (int i = 0; i <= t.number_fields; i++)
                    {
                        switch (t.field[i])
                        {
                        case "Board": n_Board = i; f_Board = true; break;

                        case "Option": n_OptionCode = i; f_OptionCode = true; break;

                        case "Mark": n_Mark = i; f_Mark = true; break;

                        case "Grade": n_Grade = i; f_Grade = true; break;

                        default: break;
                        }
                    }

                    // so do we have all the required columns??
                    if (!(f_Board && f_OptionCode && f_Grade && f_Mark))
                    {
                        Label_Text.Text = "Can't recognise the format of this file. ";
                        if (!f_Board)
                        {
                            Label_Text.Text += "No Board Column";
                        }
                        if (!f_OptionCode)
                        {
                            Label_Text.Text += "No Option Column";
                        }
                        if (!f_Mark)
                        {
                            Label_Text.Text += "No  Mark Column";
                        }
                        if (!f_Grade)
                        {
                            Label_Text.Text += "No Grade Column";
                        }
                        return;
                    }
                    else
                    {
                        Label_Text.Text = "File Format Fine:   ";
                    }
                }
            }

            //so process the file...
            string s2 = "";

            char[]   ct1 = new char[1]; ct1[0] = (char)0x09;
            string[] fields = new string[20];

            using (StringReader sr = new StringReader(s1))
            {
                string firstline = sr.ReadLine();
                string line;

                while ((line = sr.ReadLine()) != null)
                {
                    fields = line.Split(ct1);
                    bool       found = false;
                    Exam_Board eb1   = new Exam_Board();
                    eb1.Load(fields[n_Board]);
                    ExamOption eo1 = new ExamOption();
                    if (eo1.Load(fields[n_OptionCode], SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId))
                    {
                        //valid option cod
                        ExamTQMBoundaryList l1 = new ExamTQMBoundaryList();
                        l1.LoadList(eo1.m_OptionID, YearCode.ToString(), SeasonCode.ToString());
                        foreach (ExamTQMBoundary b in l1.m_list)
                        {
                            if (b.Grade == fields[n_Grade])
                            {
                                b.Mark = Convert.ToInt32(fields[n_Mark]);
                                b.Save();
                                found = true;
                                s2   += eb1.m_OrganisationFriendlyName + ct + eo1.m_OptionCode + ct + eo1.m_OptionTitle + ct + b.Grade + ct + b.Mark + ct + "Updated" + System.Environment.NewLine;
                            }
                        }
                        if (!found)
                        {
                            ExamTQMBoundary etqm1 = new ExamTQMBoundary();
                            etqm1.OptionId    = eo1.m_OptionID;
                            etqm1.Mark        = Convert.ToInt32(fields[n_Mark]);
                            etqm1.Grade       = fields[n_Grade];
                            etqm1.OptionCode  = eo1.m_OptionCode;
                            etqm1.OptionTitle = eo1.m_OptionTitle;
                            etqm1.Season      = SeasonCode.ToString();
                            etqm1.Year        = YearCode.ToString();
                            etqm1.Version     = 22;
                            etqm1.Save();
                            s2 += eb1.m_OrganisationFriendlyName + ct + eo1.m_OptionCode + ct + eo1.m_OptionTitle + ct + etqm1.Grade + ct + etqm1.Mark + ct + "New Entry" + System.Environment.NewLine;
                        }
                    }
                }
                Label_Text.Text = " Completed... saved as below:";
                TextBox1.Text   = s2;
            }
        }
Esempio n. 4
0
        protected void Button_FileUpload_Click(object sender, EventArgs e)
        {
            SimplePupil pupil1 = new SimplePupil();

            if (FileUpload_picker.FileName.ToUpper().Contains("WHOLEYEAR"))//should be WholeYear10 or etc
            {
                try
                {
                    string s1 = FileUpload_picker.FileName.Substring(9);
                    if (s1.StartsWith("1"))
                    {
                        s1 = s1.Substring(0, 2);
                    }
                    else
                    {
                        s1 = s1.Substring(0, 1);
                    }
                    int year = System.Convert.ToInt32(s1);
                    int k    = 4;
                    if (year < 10)
                    {
                        k = 3;
                    }
                    if (year > 11)
                    {
                        k = 5;
                    }
                    //need to set up the date for result
                    string   s2          = "";
                    DateTime SetListDate = new DateTime();
                    Utility  u           = new Utility();
                    TextBox2.Text = u.GetResultDate(s1, ref s2, ref SetListDate).ToShortDateString();
                    ProcessYearFile(k);
                    return;
                }
                catch
                {
                }
            }
            string s = "DataUpload_" + TextBox1.Text + "_" + DateTime.Now.ToLongTimeString() + ".txt";

            s = s.Replace(":", "-");
            string path = Server.MapPath(@"../App_Data/") + s;

            //String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            FileUpload_picker.SaveAs(path);
            Stream mystream = FileUpload_picker.FileContent;

            byte[] buffer = new byte[mystream.Length];
            mystream.Read(buffer, 0, (int)mystream.Length);

            Cerval_Library.TextReader text1 = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t     = new TextRecord();
            FileStream f = new FileStream(path, FileMode.Open);

            while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                //if all goes well col 2 is adno....
                s = t.field[2];
                try
                {
                    pupil1.Load(System.Convert.ToInt32(s));
                    TextBox tst1 = (TextBox)content0.FindControl(pupil1.m_StudentId.ToString());
                    if (tst1 != null)
                    {
                        //so we have the adno of a student in the list...
                        s = t.field[3];//and a grade
                        try
                        {
                            int r = System.Convert.ToInt32(s);
                            if ((r > 0) && (r < 101))
                            {
                                SaveResult(pupil1.m_StudentId.ToString(), s, TextBox3.Text);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }
            f.Close();
            //File.Delete(path);
            Table1.Controls.Clear();
            AddControls(true);
        }
Esempio n. 5
0
        protected void ProcessYearFile(int Key_stage)
        {
            string s = "DataUpload_YearFile_" + DateTime.Now.ToLongTimeString() + ".txt";

            s = s.Replace(":", "-");
            string path = Server.MapPath(@"../App_Data/") + s;

            //String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            FileUpload_picker.SaveAs(path);
            Cerval_Library.TextReader text1 = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t     = new TextRecord();
            FileStream f  = new FileStream(path, FileMode.Open);
            string     s2 = "";

            string[] Course_Name = new string[20];
            string[] Course_ID   = new string[20];
            text1.ReadTextLine(f, ref t);//header row
            s = t.field[2]; int n = t.number_fields;
            SimplePupil         pupil1 = new SimplePupil();

            if ((s != "Adno") || (n < 4))
            {
                f.Close(); return;
            }

            CourseList cl1 = new CourseList(Key_stage);

            for (int i = 3; i < n; i++)
            {
                Course_Name[i] = t.field[i];
                foreach (Course c in cl1._courses)
                {
                    if (c.CourseCode == Course_Name[i])
                    {
                        Course_ID[i] = c._CourseID.ToString();
                    }
                }
            }

            while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                //if all goes well col 2 is adno....
                s = t.field[2];
                for (int i = 3; i < n; i++)
                {
                    s2 = t.field[i];//result
                    try
                    {
                        pupil1.Load(System.Convert.ToInt32(s));

                        try
                        {
                            int r = System.Convert.ToInt32(s2);
                            if ((r > 0) && (r < 101))
                            {
                                SaveResult(pupil1.m_StudentId.ToString(), s2, Course_ID[i]);
                            }
                        }
                        catch
                        {
                        }
                    }
                    catch
                    {
                    }
                }
            }
            f.Close();
        }
        protected void Button_Check_Click(object sender, EventArgs e)
        {
            if (TextBox_emailSubject.Text == "")
            {
                TextBox_Message.Text = "You must give a subject"; return;
            }
            if (!FileUpload_Message.HasFile)
            {
                TextBox_Message.Text = "You must select a message file"; return;
            }
            if (!FileUpload_Recipients.HasFile)
            {
                TextBox_Message.Text = "You must select a recipients file"; return;
            }
            //so we have the two files... let's run through...
            System.IO.StreamReader sr = new System.IO.StreamReader(FileUpload_Message.FileContent);
            int n = 0;

            message = sr.ReadToEnd();
            ViewState.Add("msg", message);
            bool has_insert = false;

            if (message.Contains("<message>"))
            {
                has_insert = true;
                n          = message.IndexOf("<message>");
            }
            sr.Close();
            System.IO.StreamReader sr1 = new System.IO.StreamReader(FileUpload_Recipients.FileContent);


            Cerval_Library.TextReader tr = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t1 = new TextRecord();

            tr.ReadTextLine(sr1.BaseStream, ref t1);
            //we expect t1 to have Email  and Text columns
            if (t1.field[0].ToUpper() != "EMAIL")
            {
                TextBox_Message.Text = "Recipient file must have an Email field. "; return;
            }

            if (has_insert && (t1.field[1].ToUpper() != "TEXT"))
            {
                TextBox_Message.Text = "Recipient file must have a TEXT field as message has a <message> marker. "; return;
            }

            tr.ReadTextLine(sr1.BaseStream, ref t1);
            string s = message;

            //generate first message
            if (has_insert)
            {
                s  = message.Substring(0, n);
                s += t1.field[1];
                s += message.Substring(n + 9);
            }
            else
            {
            }
            msglist.Add(t1.field[0], t1.field[1]);
            SampleText.InnerHtml = "Text to be emailed is:<br/><br/>" + s;
            TextBox1.Text       += t1.field[0] + Environment.NewLine;
            while (tr.ReadTextLine(sr1.BaseStream, ref t1) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                if (!msglist.ContainsKey(t1.field[0]))//ignore duplicates...
                {
                    TextBox1.Text += t1.field[0] + Environment.NewLine;
                    msglist.Add(t1.field[0], t1.field[1]);
                }
            }

            Button_Send.Visible = true;
            ViewState.Add("list", msglist);
        }
Esempio n. 7
0
        protected void Button_Display_Click(object sender, EventArgs e)
        {
            if (!FileUpload1.HasFile)
            {
                return;
            }
            TextFileType ftype1 = TextFileType.Unknown;

            Cerval_Library.TextReader TxtRd1 = new Cerval_Library.TextReader();
            TextRecord t = new TextRecord(); int l = 0; int n = 0;
            string     s1 = ""; char ct = (char)0x09;

            int  n_Year = 0; int n_Season = 0; int n_OptionCode = 0; int n_TQM = 0; int n_ComponentCode = 0; int n_ScaledMark = 0; int n_ComponentUMS = 0; int n_Status = 0;
            bool f_Year = false; bool f_Season = false; bool f_OptionCode = false;
            bool f_TQM = false; bool f_ComponentCode = false; bool f_ScaledMark = false; bool f_ComponentUMS = false; bool f_Status = false;


            int n_CandNo = 0; bool f_CandNo = false;

            while (TxtRd1.ReadTextLine(FileUpload1.FileContent, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                l = s1.Length;
                for (int i = 0; i <= t.number_fields; i++)
                {
                    s1 += t.field[i] + ct;
                }
                if (s1.Length > l)
                {
                    s1 += Environment.NewLine;
                }
                if (n == 0)
                {
                    //going to look for our columns:
                    for (int i = 0; i <= t.number_fields; i++)
                    {
                        switch (t.field[i])
                        {
                        case "Series Year": n_Year = i; f_Year = true; break;

                        case "Series Code": n_Season = i; f_Season = true; break;

                        case "Entry Code": n_OptionCode = i;  f_OptionCode = true; break;

                        case "Result Mark": n_TQM = i; f_TQM = true; break;

                        case "Component Code": n_ComponentCode = i; f_ComponentCode = true; break;

                        case "Component UMS": n_ComponentUMS = i; f_ComponentUMS = true; break;

                        case "Component Scaled Mark": n_ScaledMark = i; f_ScaledMark = true; break;

                        case "Component Status Notes": n_Status = i; f_Status = true; break;

                        case "Candidate Number":    n_CandNo = i; f_CandNo = true; break;

                        default: break;
                        }
                    }

                    // so do we have all the required columns??
                    if (!(f_Year && f_Season && f_OptionCode && f_TQM && f_ComponentCode && f_ScaledMark && f_ComponentUMS && f_Status && f_CandNo))
                    {
                        Label_Text.Text = "Can't recognise the format of this file. ";
                        if (!f_Year)
                        {
                            Label_Text.Text += "No YearColumn";
                        }
                        if (!f_Season)
                        {
                            Label_Text.Text += "No SeasonColumn";
                        }
                        if (!f_OptionCode)
                        {
                            Label_Text.Text += "No OptionCodeColumn";
                        }
                        if (!f_TQM)
                        {
                            Label_Text.Text += "No TQMColumn";
                        }
                        if (!f_ComponentCode)
                        {
                            Label_Text.Text += "No ComponnetCodeColumn";
                        }
                        if (!f_ComponentUMS)
                        {
                            Label_Text.Text += "No ComponentUMSColumn";
                        }
                        if (!f_ScaledMark)
                        {
                            Label_Text.Text += "No ScaledMarkColumn";
                        }
                        if (!f_Status)
                        {
                            Label_Text.Text += "No StatusColumn";
                        }
                    }
                    else
                    {
                        foreach (TextFileType eb in Enum.GetValues(typeof(TextFileType)))
                        {
                            if (DropDownList1.SelectedValue == eb.ToString())
                            {
                                ftype1 = eb; break;
                            }
                        }

                        Label_Text.Text = "File Format Fine:     Board: " + ftype1.ToString();
                    }
                }
                ViewState["TextFileType"]    = ftype1;
                ViewState["n_Year"]          = n_Year;
                ViewState["n_Season"]        = n_Season;
                ViewState["n_OptionCode"]    = n_OptionCode;
                ViewState["n_TQM"]           = n_TQM;
                ViewState["n_ComponentCode"] = n_ComponentCode;
                ViewState["n_ComponentUMS"]  = n_ComponentUMS;
                ViewState["n_ScaledMark"]    = n_ScaledMark;
                ViewState["n_Status"]        = n_Status;
                ViewState["n_CandNo"]        = n_CandNo;


                TextBox1.Text          = s1;
                Button_Display.Visible = false;
                Button_Process.Visible = true;
            }
        }
Esempio n. 8
0
        protected void Button_Upload_Click(object sender, EventArgs e)
        {
            if (!FileUpload1.HasFile)
            {
                return;
            }
            TextFileType ftype1 = TextFileType.Unknown;

            string s = Server.MapPath("BaseData") + "\\" + FileUpload1.FileName;

            Cerval_Library.TextReader TxtRd1 = new Cerval_Library.TextReader();
            TextRecord t = new TextRecord(); int l = 0; int n = 0;
            string     s1 = ""; char ct = (char)0x09;

            while (TxtRd1.ReadTextLine(FileUpload1.FileContent, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                l = s1.Length;
                for (int i = 0; i < t.number_fields; i++)
                {
                    if (t.field[i].Length == 0)
                    {
                        break;
                    }
                    else
                    {
                        s1 += t.field[i] + ct;
                    }
                }
                if (s1.Length > l)
                {
                    s1 += Environment.NewLine;
                }
                if (n == 0)
                {
                    //this is first line so has headers....
                    if (t.field[0].ToUpper().Trim() == "SET")
                    {
                        ftype1 = TextFileType.Sets;
                    }
                    if (t.field[0].ToUpper().Trim() == "ADNO")
                    {
                        ftype1 = TextFileType.Students;
                    }
                    if (t.field[0].ToUpper().Trim() == "ADMISSION NUMBER")
                    {
                        ftype1 = TextFileType.Students;
                    }
                    switch (ftype1)
                    {
                    case TextFileType.Unknown:
                        Label_Text.Text = "First column must be either 'Set' or 'adno' or 'Admission Number'";
                        break;

                    case TextFileType.Students:
                        Label_Text.Text = "Assuming columns are: Admission Number,Surname, GivenName,Board,Syllabus,Option...";
                        break;

                    case TextFileType.Sets:
                        Label_Text.Text = "Assuming columns are: Set, Board, Syllabus, Option.......";
                        break;

                    default:
                        break;
                    }
                }
            }
            ViewState["TextFileType"] = ftype1;
            TextBox1.Text             = s1;
            Button_CheckTime.Visible  = false;
            Button_Upload.Visible     = false;
            Button_Process.Visible    = true;
        }