Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx    m   = new Modelx();
        msbase    ms  = new msbase();
        DataTable dt  = null;
        ArrayList al  = new ArrayList();
        string    uid = Request["UserID"];

        Session["uid"] = uid;
        if (uid == null || m.getUserTypeByUserID(uid) == null || !m.getUserTypeByUserID(uid).Equals("T"))
        {
            Session["uid"] = null;
            Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
        }
        //string uid = m.UID;
        m.setNewWeek();
        decimal pSerID = m.getPSerIDByUserID(uid);
        string  sqlstm = "select * from YXZ_stuAppt where pSerID=" + pSerID + " order by weeknum desc;";

        dt = ms.SelectSql(sqlstm);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.stuAppt stu = new Modelx.stuAppt();
            stu.SerID    = Convert.ToDecimal(dt.Rows[i][0]);
            stu.UserID   = m.getStuIDBySerID(stu.SerID);
            stu.StuName  = m.getSnameBySerID(stu.SerID);
            stu.semavail = Convert.ToInt32(dt.Rows[i][1]);
            stu.pSerID   = Convert.ToDecimal(dt.Rows[i][2]);
            stu.date     = Convert.ToDateTime(dt.Rows[i][3]);
            stu.status   = Convert.ToInt32(dt.Rows[i][4]);
            stu.weeknum  = Convert.ToInt32(dt.Rows[i][5]);
            al.Add(stu);
        }
        Context.Items["al"] = al;
    }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Modelx m = new Modelx();
     msbase ms = new msbase();
     DataTable dt = null;
     ArrayList al = new ArrayList();
     string uid = Request["UserID"];
     Session["uid"] = uid;
     if (uid == null || m.getUserTypeByUserID(uid) ==null|| !m.getUserTypeByUserID(uid).Equals("T")) {
         Session["uid"] = null;
         Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
     }
     //string uid = m.UID;
     m.setNewWeek();
     decimal pSerID = m.getPSerIDByUserID(uid);
     string sqlstm = "select * from YXZ_stuAppt where pSerID=" + pSerID + " order by weeknum desc;";
     dt = ms.SelectSql(sqlstm);
     for (int i = 0; i < dt.Rows.Count;i++)
     {
         Modelx.stuAppt stu = new Modelx.stuAppt();
         stu.SerID = Convert.ToDecimal(dt.Rows[i][0]);
         stu.UserID = m.getStuIDBySerID(stu.SerID);
         stu.StuName = m.getSnameBySerID(stu.SerID);
         stu.semavail = Convert.ToInt32(dt.Rows[i][1]);
         stu.pSerID = Convert.ToDecimal(dt.Rows[i][2]);
         stu.date = Convert.ToDateTime(dt.Rows[i][3]);
         stu.status = Convert.ToInt32(dt.Rows[i][4]);
         stu.weeknum = Convert.ToInt32(dt.Rows[i][5]);
         al.Add(stu);
     }
     Context.Items["al"] = al;
 }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx    m         = new Modelx();
        msbase    ms        = new msbase();
        DataTable dt        = null;
        ArrayList allApptmt = new ArrayList();
        ArrayList p         = new ArrayList();
        string    uid       = Request["UserID"];

        if (uid != null)
        {
            Session["uid"] = uid;
        }
        string userid = (string)Session["uid"];

        if (userid == null || m.getUserTypeByUserID(userid) == null || !(m.getUserTypeByUserID(userid).Equals("Q") || m.getUserTypeByUserID(userid).Equals("M") || m.getUserTypeByUserID(userid).Equals("X")))
        {
            Session["uid"] = null;
            Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
        }
        //string uid = m.UID;
        m.setNewWeek();
        int weeknum = m.getWeeknum();

        m.principalInit(weeknum);
        string sqlstm1 = "select top(2) * from YXZ_principal where district='江锦';";
        string sqlstm2 = "select top(2) * from YXZ_principal where district='采荷';";

        dt = ms.SelectSql(sqlstm1);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID    = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name     = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail    = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum  = Convert.ToInt32(dt.Rows[i][5]);
            p.Add(pr);
        }
        dt = ms.SelectSql(sqlstm2);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID    = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name     = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail    = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum  = Convert.ToInt32(dt.Rows[i][5]);
            p.Add(pr);
        }
        for (int i = 0; i < p.Count; i++)
        {
            string sqlstm = "select * from YXZ_stuAppt where pSerID=" + ((Modelx.principal)p[i]).SerID + " order by weeknum desc;";
            dt = ms.SelectSql(sqlstm);
            ArrayList apptmt = new ArrayList();
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                Modelx.stuAppt stu = new Modelx.stuAppt();
                stu.SerID    = Convert.ToDecimal(dt.Rows[j][0]);
                stu.semavail = Convert.ToInt32(dt.Rows[j][1]);
                stu.pSerID   = Convert.ToDecimal(dt.Rows[j][2]);
                stu.date     = Convert.ToDateTime(dt.Rows[j][3]);
                stu.weeknum  = Convert.ToInt32(dt.Rows[j][5]);
                stu.StuName  = m.getSnameBySerID(stu.SerID);
                apptmt.Add(stu);
            }
            allApptmt.Add(apptmt);
        }
        //for (int i = 0; i < al2.Count; i++)
        //{
        //    string sqlstm = "select * from YXZ_stuAppt where pSerID=" + ((Model.principal)al2[i]).SerID + ";";
        //    dt = ms.SelectSql(sqlstm);
        //    Model.prst prst = new Model.prst();
        //    if (dt.Rows.Count > 0)
        //    {
        //        prst.sSerID = Convert.ToDecimal(dt.Rows[0][0]);
        //        prst.sname = m.getSnameBySerID(prst.sSerID);
        //        prst.semavail = Convert.ToInt32(dt.Rows[0][1]);
        //        prst.pSerID = Convert.ToDecimal(dt.Rows[0][2]);
        //        prst.pname = ((Model.principal)al2[i]).name;
        //        prst.date = Convert.ToDateTime(dt.Rows[0][3]);
        //        prst.status = Convert.ToInt32(dt.Rows[0][4]);
        //    }
        //    else
        //    {
        //        prst.pSerID = ((Model.principal)al2[i]).SerID;
        //        prst.pname = ((Model.principal)al2[i]).name;
        //    }
        //    alprst.Add(prst);
        //}
        Context.Items["p"]         = p;
        Context.Items["allApptmt"] = allApptmt;
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx m = new Modelx();
        Modelx.stuAppt stuAppt = new Modelx.stuAppt();
        msbase ms = new msbase();
        DataTable dt = null;
        string sqlstm;
        string sqlstm1;
        string sqlstm2;
        int t = 0, weeknum = 0;
        ArrayList al = new ArrayList();
        ArrayList al1 = new ArrayList();
        ArrayList al2 = new ArrayList();
        /* sqlstm="select * from principal;";
         cmd = new SqlCommand(sqlstm, conn);
         dr = cmd.ExecuteReader();
         while(dr.Read()) {
             al.Add( dr.GetString(1));
         }
         Context.Items["prcpl"] = al;
         dbh.closeConn(cmd, dr);*/
        stuAppt.UserID = (string)Session["uid"];
        if (stuAppt.UserID == null || m.getUserTypeByUserID(stuAppt.UserID) ==null|| !m.getUserTypeByUserID(stuAppt.UserID).Equals("S")) {
            Session["uid"] = null;
            Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
        }
        //stuAppt.UserID = m.uid;
        stuAppt.SerID = m.getSerIDByUserID(stuAppt.UserID);
        m.setNewWeek();
        weeknum = m.getWeeknum();
        Context.Items["weeknum"] = weeknum;
        sqlstm = "select * from YXZ_stuAppt where SerID=" + stuAppt.SerID + ";";
        dt = ms.SelectSql(sqlstm);
        if (dt.Rows.Count > 0)
        {
            stuAppt.semavail = Convert.ToInt32(dt.Rows[0][1]);
            stuAppt.weeknum = Convert.ToInt32(dt.Rows[0][5]);
            if (stuAppt.semavail == 0)
            {
                stuAppt.pSerID = Convert.ToDecimal(dt.Rows[0][2]);
                stuAppt.date = Convert.ToDateTime(dt.Rows[0][3]);
                stuAppt.status = Convert.ToInt32(dt.Rows[0][4]);
            }
        }
        stuAppt.StuName = m.getSnameBySerID(stuAppt.SerID);
        Session["stu"] = stuAppt;

        //sqlstm = "select * from YXZ_rec where sSerID=" + stuAppt.SerID + " and pSerID=" + stuAppt.pSerID + " order by time;";
        //dt = ms.SelectSql(sqlstm);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    Model.rec rec = new Model.rec();
        //    rec.recID = Convert.ToInt32(dt.Rows[i][0]);
        //    rec.sSerID = Convert.ToDecimal(dt.Rows[i][1]);
        //    rec.pSerID = Convert.ToDecimal(dt.Rows[i][2]);
        //    rec.question = dt.Rows[i][3].ToString();
        //    rec.msg = dt.Rows[i][4].ToString();
        //    rec.time = Convert.ToDateTime(dt.Rows[i][5]);
        //    al.Add(rec);
        //}
        //Context.Items["al"] = al;

        t = m.getWeekleft(weeknum);
        Context.Items["weekleft"] = t;

        m.principalInit(weeknum);
        sqlstm1 = "select top(2) * from YXZ_principal where district='江锦' and avail=1;";
        sqlstm2 = "select top(2) * from YXZ_principal where district='采荷' and avail=1;";
        dt = ms.SelectSql(sqlstm1);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum = Convert.ToInt32(dt.Rows[i][5]);
            al1.Add(pr);
        }
        Context.Items["al1"] = al1;

        dt = ms.SelectSql(sqlstm2);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum = Convert.ToInt32(dt.Rows[i][5]);
            al2.Add(pr);
        }
        Context.Items["al2"] = al2;
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx    m       = new Modelx();
        msbase    ms      = new msbase();
        DataTable dt      = null;
        string    sqlstm  = null;
        ArrayList al      = new ArrayList();
        ArrayList msgbox  = new ArrayList();
        ArrayList date    = new ArrayList();
        int       pageNow = Convert.ToInt32(Context.Request["pageNow"]);

        if (pageNow == 0)
        {
            pageNow = 1;
        }
        Modelx.paginationUnit = 8;
        int    pageTotal = 0;
        string act       = Request["act"];

        if (act == null)
        {
            if (m.getCount() % (Modelx.paginationUnit) == 0)
            {
                pageTotal = m.getCount() / (Modelx.paginationUnit);
            }
            else
            {
                pageTotal = m.getCount() / (Modelx.paginationUnit) + 1;
            }
            // sqlstm = "select * from rec where msg !=('') order by time desc;";
            sqlstm = "select top " + Modelx.paginationUnit + " * from YXZ_rec where recID not in (select top " + (pageNow - 1) * Modelx.paginationUnit + " recID from YXZ_rec where isConvAnnounced=1 and msg!='' order by time desc ) and isConvAnnounced=1 and msg!=''order by time desc;";
        }
        else if (encryption.DeCode(act).Equals("search"))
        {
            Context.Items["pageTotal"] = pageTotal;
            string date1 = Request["date1"];
            string date2 = Request["date2"];
            string s     = "select count(*) from YXZ_rec where isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "';";
            if (m.getCount(s) % (Modelx.paginationUnit) == 0)
            {
                pageTotal = m.getCount(s) / (Modelx.paginationUnit);
            }
            else
            {
                pageTotal = m.getCount(s) / (Modelx.paginationUnit) + 1;
            }
            sqlstm = "select top " + Modelx.paginationUnit + " * from YXZ_rec where recID not in (select top " + (pageNow - 1) * Modelx.paginationUnit + " recID from YXZ_rec where isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "' order by time desc ) and isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "' order by time desc;";
        }
        Context.Items["pageTotal"] = pageTotal;
        //dt = ms.SelectSql(sqlstm);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    Model.rec rec = new Model.rec();
        //    rec.recID = Convert.ToInt32(dt.Rows[i][0]);
        //    rec.sSerID = Convert.ToDecimal(dt.Rows[i][1]);
        //    rec.pSerID =Convert.ToDecimal(dt.Rows[i][2]);
        //    rec.question = dt.Rows[i][3].ToString();
        //    rec.msg = dt.Rows[i][4].ToString();
        //    rec.time = Convert.ToDateTime(dt.Rows[i][5]);
        //    al.Add(rec);
        //}
        al = m.getAnnouncedConv(pageNow);
        for (int i = 0; i < al.Count; i++)
        {
            if (i == 0)
            {
                ArrayList msg = new ArrayList();
                date.Add(((Modelx.rec)al[i]).time);
                msg.Add(al[i]);
                msgbox.Add(msg);
            }
            else
            {
                Modelx.rec lr = (Modelx.rec)al[i - 1];
                Modelx.rec r  = (Modelx.rec)al[i];
                if (r.time.Year.CompareTo(lr.time.Year) != 0 || r.time.Day.CompareTo(lr.time.Day) != 0 || r.time.Month.CompareTo(lr.time.Month) != 0)
                {
                    ArrayList msg = new ArrayList();
                    date.Add(r.time);
                    msg.Add(r);
                    msgbox.Add(msg);
                }
                else
                {
                    int       count = msgbox.Count;
                    ArrayList mssg  = (ArrayList)msgbox[count - 1];
                    mssg.Add(r);
                }
            }
        }
        Context.Items["msgbox"] = msgbox;
        Context.Items["date"]   = date;
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx m = new Modelx();
        msbase ms = new msbase();
        DataTable dt = null;
        string sqlstm = null;
        ArrayList al = new ArrayList();
        ArrayList msgbox = new ArrayList();
        ArrayList date = new ArrayList();
        int pageNow = Convert.ToInt32(Context.Request["pageNow"]);
        if (pageNow == 0) { pageNow = 1; }
        Modelx.paginationUnit = 8;
        int pageTotal = 0;
        string act = Request["act"];
        if (act == null)
        {
            if (m.getCount() % (Modelx.paginationUnit) == 0) { pageTotal = m.getCount() / (Modelx.paginationUnit); }
            else { pageTotal = m.getCount() / (Modelx.paginationUnit) + 1; }
            // sqlstm = "select * from rec where msg !=('') order by time desc;";
            sqlstm = "select top " + Modelx.paginationUnit + " * from YXZ_rec where recID not in (select top " + (pageNow - 1) * Modelx.paginationUnit + " recID from YXZ_rec where isConvAnnounced=1 and msg!='' order by time desc ) and isConvAnnounced=1 and msg!=''order by time desc;";
        }
        else if (encryption.DeCode(act).Equals("search"))
        {
            Context.Items["pageTotal"] = pageTotal;
            string date1 = Request["date1"];
            string date2 = Request["date2"];
            string s = "select count(*) from YXZ_rec where isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "';";
            if (m.getCount(s) % (Modelx.paginationUnit) == 0) { pageTotal = m.getCount(s) / (Modelx.paginationUnit); }
            else { pageTotal = m.getCount(s) / (Modelx.paginationUnit) + 1; }
            sqlstm = "select top " + Modelx.paginationUnit + " * from YXZ_rec where recID not in (select top " + (pageNow - 1) * Modelx.paginationUnit + " recID from YXZ_rec where isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "' order by time desc ) and isConvAnnounced=1 and msg!=('') and time between '" + date1 + "' and '" + date2 + "' order by time desc;";
        }
        Context.Items["pageTotal"] = pageTotal;
        //dt = ms.SelectSql(sqlstm);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    Model.rec rec = new Model.rec();
        //    rec.recID = Convert.ToInt32(dt.Rows[i][0]);
        //    rec.sSerID = Convert.ToDecimal(dt.Rows[i][1]);
        //    rec.pSerID =Convert.ToDecimal(dt.Rows[i][2]);
        //    rec.question = dt.Rows[i][3].ToString();
        //    rec.msg = dt.Rows[i][4].ToString();
        //    rec.time = Convert.ToDateTime(dt.Rows[i][5]);
        //    al.Add(rec);
        //}
        al = m.getAnnouncedConv(pageNow);
        for (int i = 0; i < al.Count; i++)
        {
            if (i == 0)
            {
                ArrayList msg = new ArrayList();
                date.Add(((Modelx.rec)al[i]).time);
                msg.Add(al[i]);
                msgbox.Add(msg);
            }
            else
            {
                Modelx.rec lr = (Modelx.rec)al[i - 1];
                Modelx.rec r = (Modelx.rec)al[i];
                if (r.time.Year.CompareTo(lr.time.Year) != 0 || r.time.Day.CompareTo(lr.time.Day) != 0 || r.time.Month.CompareTo(lr.time.Month) != 0)
                {
                    ArrayList msg = new ArrayList();
                    date.Add(r.time);
                    msg.Add(r);
                    msgbox.Add(msg);
                }
                else
                {
                    int count = msgbox.Count;
                    ArrayList mssg = (ArrayList)msgbox[count - 1];
                    mssg.Add(r);
                }
            }

        }
        Context.Items["msgbox"] = msgbox;
        Context.Items["date"] = date;
    }
Пример #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Modelx m = new Modelx();
     msbase ms = new msbase();
     DataTable dt = null;
     ArrayList  allApptmt= new ArrayList();
     ArrayList p= new ArrayList();
     string uid = Request["UserID"];
     if (uid != null)
     {
         Session["uid"] = uid;
     }
     string userid=(string)Session["uid"];
     if (userid == null || m.getUserTypeByUserID(userid) ==null|| !(m.getUserTypeByUserID(userid).Equals("Q") || m.getUserTypeByUserID(userid).Equals("M") || m.getUserTypeByUserID(userid).Equals("X")))
     {
         Session["uid"] = null;
         Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
     }
     //string uid = m.UID;
     m.setNewWeek();
     int weeknum = m.getWeeknum();
     m.principalInit(weeknum);
     string sqlstm1 = "select top(2) * from YXZ_principal where district='江锦';";
     string sqlstm2 = "select top(2) * from YXZ_principal where district='采荷';";
     dt = ms.SelectSql(sqlstm1);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         Modelx.principal pr = new Modelx.principal();
         pr.SerID = Convert.ToDecimal(dt.Rows[i][0]);
         pr.name = dt.Rows[i][2].ToString();
         pr.district = dt.Rows[i][3].ToString();
         pr.avail = Convert.ToInt32(dt.Rows[i][4]);
         pr.weeknum = Convert.ToInt32(dt.Rows[i][5]);
         p.Add(pr);
     }
     dt = ms.SelectSql(sqlstm2);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         Modelx.principal pr = new Modelx.principal();
         pr.SerID = Convert.ToDecimal(dt.Rows[i][0]);
         pr.name = dt.Rows[i][2].ToString();
         pr.district = dt.Rows[i][3].ToString();
         pr.avail = Convert.ToInt32(dt.Rows[i][4]);
         pr.weeknum = Convert.ToInt32(dt.Rows[i][5]);
         p.Add(pr);
     }
     for (int i = 0; i < p.Count; i++)
     {
         string sqlstm = "select * from YXZ_stuAppt where pSerID=" + ((Modelx.principal)p[i]).SerID + " order by weeknum desc;";
         dt = ms.SelectSql(sqlstm);
         ArrayList apptmt = new ArrayList();
         for(int j=0;j<dt.Rows.Count;j++)
         {
             Modelx.stuAppt stu = new Modelx.stuAppt();
             stu.SerID = Convert.ToDecimal(dt.Rows[j][0]);
             stu.semavail = Convert.ToInt32(dt.Rows[j][1]);
             stu.pSerID = Convert.ToDecimal(dt.Rows[j][2]);
             stu.date = Convert.ToDateTime(dt.Rows[j][3]);
             stu.weeknum= Convert.ToInt32(dt.Rows[j][5]);
             stu.StuName = m.getSnameBySerID(stu.SerID);
             apptmt.Add(stu);
         }
         allApptmt.Add(apptmt);
     }
     //for (int i = 0; i < al2.Count; i++)
     //{
     //    string sqlstm = "select * from YXZ_stuAppt where pSerID=" + ((Model.principal)al2[i]).SerID + ";";
     //    dt = ms.SelectSql(sqlstm);
     //    Model.prst prst = new Model.prst();
     //    if (dt.Rows.Count > 0)
     //    {
     //        prst.sSerID = Convert.ToDecimal(dt.Rows[0][0]);
     //        prst.sname = m.getSnameBySerID(prst.sSerID);
     //        prst.semavail = Convert.ToInt32(dt.Rows[0][1]);
     //        prst.pSerID = Convert.ToDecimal(dt.Rows[0][2]);
     //        prst.pname = ((Model.principal)al2[i]).name;
     //        prst.date = Convert.ToDateTime(dt.Rows[0][3]);
     //        prst.status = Convert.ToInt32(dt.Rows[0][4]);
     //    }
     //    else
     //    {
     //        prst.pSerID = ((Model.principal)al2[i]).SerID;
     //        prst.pname = ((Model.principal)al2[i]).name;
     //    }
     //    alprst.Add(prst);
     //}
     Context.Items["p"] = p;
     Context.Items["allApptmt"] = allApptmt;
 }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Modelx m = new Modelx();

        Modelx.stuAppt stuAppt = new Modelx.stuAppt();
        msbase         ms      = new msbase();
        DataTable      dt      = null;
        string         sqlstm;
        string         sqlstm1;
        string         sqlstm2;
        int            t = 0, weeknum = 0;
        ArrayList      al  = new ArrayList();
        ArrayList      al1 = new ArrayList();
        ArrayList      al2 = new ArrayList();

        /* sqlstm="select * from principal;";
         * cmd = new SqlCommand(sqlstm, conn);
         * dr = cmd.ExecuteReader();
         * while(dr.Read()) {
         *   al.Add( dr.GetString(1));
         * }
         * Context.Items["prcpl"] = al;
         * dbh.closeConn(cmd, dr);*/
        stuAppt.UserID = (string)Session["uid"];
        if (stuAppt.UserID == null || m.getUserTypeByUserID(stuAppt.UserID) == null || !m.getUserTypeByUserID(stuAppt.UserID).Equals("S"))
        {
            Session["uid"] = null;
            Context.Response.Redirect("http://oa.chsx.cn/ISchoolOs/mainlogin.aspx");
        }
        //stuAppt.UserID = m.uid;
        stuAppt.SerID = m.getSerIDByUserID(stuAppt.UserID);
        m.setNewWeek();
        weeknum = m.getWeeknum();
        Context.Items["weeknum"] = weeknum;
        sqlstm = "select * from YXZ_stuAppt where SerID=" + stuAppt.SerID + ";";
        dt     = ms.SelectSql(sqlstm);
        if (dt.Rows.Count > 0)
        {
            stuAppt.semavail = Convert.ToInt32(dt.Rows[0][1]);
            stuAppt.weeknum  = Convert.ToInt32(dt.Rows[0][5]);
            if (stuAppt.semavail == 0)
            {
                stuAppt.pSerID = Convert.ToDecimal(dt.Rows[0][2]);
                stuAppt.date   = Convert.ToDateTime(dt.Rows[0][3]);
                stuAppt.status = Convert.ToInt32(dt.Rows[0][4]);
            }
        }
        stuAppt.StuName = m.getSnameBySerID(stuAppt.SerID);
        Session["stu"]  = stuAppt;

        //sqlstm = "select * from YXZ_rec where sSerID=" + stuAppt.SerID + " and pSerID=" + stuAppt.pSerID + " order by time;";
        //dt = ms.SelectSql(sqlstm);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    Model.rec rec = new Model.rec();
        //    rec.recID = Convert.ToInt32(dt.Rows[i][0]);
        //    rec.sSerID = Convert.ToDecimal(dt.Rows[i][1]);
        //    rec.pSerID = Convert.ToDecimal(dt.Rows[i][2]);
        //    rec.question = dt.Rows[i][3].ToString();
        //    rec.msg = dt.Rows[i][4].ToString();
        //    rec.time = Convert.ToDateTime(dt.Rows[i][5]);
        //    al.Add(rec);
        //}
        //Context.Items["al"] = al;

        t = m.getWeekleft(weeknum);
        Context.Items["weekleft"] = t;

        m.principalInit(weeknum);
        sqlstm1 = "select top(2) * from YXZ_principal where district='江锦' and avail=1;";
        sqlstm2 = "select top(2) * from YXZ_principal where district='采荷' and avail=1;";
        dt      = ms.SelectSql(sqlstm1);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID    = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name     = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail    = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum  = Convert.ToInt32(dt.Rows[i][5]);
            al1.Add(pr);
        }
        Context.Items["al1"] = al1;

        dt = ms.SelectSql(sqlstm2);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Modelx.principal pr = new Modelx.principal();
            pr.SerID    = Convert.ToDecimal(dt.Rows[i][0]);
            pr.name     = dt.Rows[i][2].ToString();
            pr.district = dt.Rows[i][3].ToString();
            pr.avail    = Convert.ToInt32(dt.Rows[i][4]);
            pr.weeknum  = Convert.ToInt32(dt.Rows[i][5]);
            al2.Add(pr);
        }
        Context.Items["al2"] = al2;
    }