Exemple #1
0
    private void DelTerm(string szID)
    {
        REQUESTCODE uResponse   = REQUESTCODE.EXECUTE_FAIL;
        CTSREQ      vrParameter = new CTSREQ();

        CLASSTIMETABLE[] vrResult;
        if (m_Request.Reserve.GetClassTimeTable(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS)
        {
            ArrayList list = new ArrayList();
            for (int i = 0; i < vrResult.Length; i++)
            {
                if (vrResult[i].dwSecIndex.ToString() != szID)
                {
                    list.Add(vrResult[i]);
                }
            }
            CLASSTIMETABLE[] res2 = new CLASSTIMETABLE[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                res2[i] = new CLASSTIMETABLE();
                res2[i] = (CLASSTIMETABLE)list[i];
            }
            m_Request.Reserve.SetClassTimeTable(res2);
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CTSREQ vrParameter = new CTSREQ();

        CLASSTIMETABLE[] vrResult;
        if (Request["delID"] != null)
        {
            DelTerm(Request["delID"]);
        }
        if (m_Request.Reserve.GetClassTimeTable(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS)
        {
            for (int i = 0; i < vrResult.Length; i++)
            {
                m_szOut += "<tr>";
                m_szOut += "<td data-id=\"" + vrResult[i].dwSecIndex.ToString() + "\">" + vrResult[i].dwSecIndex + "</td>";
                m_szOut += "<td data-id=\"" + vrResult[i].dwSecIndex.ToString() + "\">" + vrResult[i].szSecName + "</td>";
                m_szOut += "<td>" + GetTimeStr(vrResult[i].dwBeginTime) + "</td>";

                m_szOut += "<td>" + GetTimeStr(vrResult[i].dwEndTime) + "</td>";
                string szDivOPTD = "OPTD";

                m_szOut += "<td><div class='" + szDivOPTD + "'></div></td>";
                m_szOut += "</tr>";
            }
            UpdatePageCtrl(m_Request.Reserve);
        }
        PutBackValue();
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_szRoomName = Request["szRoomName"];

        TESTITEMREQ vrTestItemReq = new TESTITEMREQ();

        UNITESTITEM[] vrTestItemResult;
        vrTestItemReq.dwGetType = (uint)TESTITEMREQ.DWGETTYPE.TESTITEMGET_BYID;
        vrTestItemReq.szGetKey  = Request["dwTestItemID"];
        if (m_Request.Reserve.GetTestItem(vrTestItemReq, out vrTestItemResult) == REQUESTCODE.EXECUTE_SUCCESS && vrTestItemResult.Length > 0)
        {
        }
        else
        {
            // MessageBox("实验安排失败,无效的实验项目," + m_Request.szErrMsg, "实验安排失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            // return;
        }
        ROOMREQ vrGetRoom = new ROOMREQ();

        UNIROOM[] vrRoomResult;
        vrGetRoom.dwRoomID = ToUint(Request["RoomID"]);
        if (m_Request.Device.RoomGet(vrGetRoom, out vrRoomResult) == REQUESTCODE.EXECUTE_SUCCESS && vrRoomResult.Length > 0)
        {
            m_szRoomName = vrRoomResult[0].szRoomName;
        }
        else
        {
            //MessageBox("实验安排失败,无效的房间号," + m_Request.szErrMsg, "实验安排失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            return;
        }
        UNIRESERVE newresv = new UNIRESERVE();

        newresv.dwMemberKind          = (uint)UNIRESERVE.DWMEMBERKIND.MEMBERKIND_GROUP;
        newresv.dwUseMode             = (uint)UNIRESERVE.DWUSEMODE.RESVUSE_USEDEV;
        newresv.dwPurpose             = (uint)UNIRESERVE.DWPURPOSE.USEFOR_TEACHING;
        newresv.dwPreDate             = ToUint(Request["dwDate"]);
        newresv.dwOwner               = ToUint(Request["dwOwner"]);
        newresv.dwLabID               = vrRoomResult[0].dwLabID;
        newresv.ResvDev               = new RESVDEV[1];
        newresv.ResvDev[0].szRoomNo   = vrRoomResult[0].szRoomNo;
        newresv.ResvDev[0].dwDevKind  = 1403;
        newresv.ResvDev[0].dwDevStart = 0;
        newresv.ResvDev[0].dwDevEnd   = 99999;
        newresv.dwProperty            = (uint)UNIRESERVE.DWPROPERTY.RESVPROP_LOCKROOM;
        newresv.dwTestItemID          = ToUint(Request["dwTestItemID"]);

        newresv.dwYearTerm = GetTerm(null);

        uint?dwBeginSec = ToUint(Request["dwBeginSec"]);
        uint?dwEndSec   = ToUint(Request["dwEndSec"]);

        CLASSTIMETABLE[] vtSec;
        CTSREQ           vrCtsReq = new CTSREQ();

        m_Request.Reserve.GetClassTimeTable(vrCtsReq, out vtSec);
        GetSecTime(vtSec, ref dwBeginSec, ref dwEndSec, out newresv.dwBeginTime, out newresv.dwEndTime);

        newresv.dwOccurTime = Get1970Seconds(DateTime.Now.ToString());
        newresv.dwBeginTime = Get1970Seconds(Request["dwDate"] + " " + newresv.dwBeginTime / 100 + ":" + newresv.dwBeginTime % 100);
        newresv.dwEndTime   = Get1970Seconds(Request["dwDate"] + " " + newresv.dwEndTime / 100 + ":" + newresv.dwEndTime % 100);

        //newresv.dwMemberID = 1071;// vrTestItemResult[0].dwGroupID;
        //newresv.szMemberName = "12日语本衔接班";// vrTestItemResult[0].szGroupName;
        // newresv.dwYearTerm = 20131401;
        // newresv.dwTeachingTime = 261212;

        if (Request["IsSubmit"] == "true")
        {
            if (m_Request.Reserve.Set(newresv, out newresv) == REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox("实验安排成功", "实验安排成功", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
            }
            else
            {
                // MessageBox("实验安排失败," + m_Request.szErrMsg, "实验安排失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            }
        }

        m_TermText = GetTermText(0);

        PutBackValue();
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CLASSTIMETABLE newTimeTable;

        if (IsPostBack)
        {
            GetHTTPObj(out newTimeTable);
            newTimeTable.dwSN        = uSnN;
            newTimeTable.dwBeginTime = GetTime(Request["dwBeginTime"]);
            newTimeTable.dwEndTime   = GetTime(Request["dwEndTime"]);
            REQUESTCODE      uResponse   = REQUESTCODE.EXECUTE_FAIL;
            CTSREQ           vrParameter = new CTSREQ();
            CLASSTIMETABLE[] vrResult;
            if (m_Request.Reserve.GetClassTimeTable(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS)
            {
                string szID = Request["dwID"];
                bool   bNew = true;
                if (szID != null && szID != "")
                {
                    bNew = false;
                }
                ArrayList list = new ArrayList();
                if (bNew)
                {
                    for (int i = 0; i < vrResult.Length; i++)
                    {
                        list.Add(vrResult[i]);
                    }
                    list.Add(newTimeTable);
                    CLASSTIMETABLE[] res2 = new CLASSTIMETABLE[(list.Count)];
                    for (int i = 0; i < list.Count; i++)
                    {
                        res2[i] = new CLASSTIMETABLE();
                        res2[i] = (CLASSTIMETABLE)list[i];
                    }
                    uResponse = m_Request.Reserve.SetClassTimeTable(res2);
                    if (uResponse != REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        MessageBox(m_Request.szErrMessage, "新建作息时间失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    }
                    else
                    {
                        MessageBox("新建作息时间成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                        return;
                    }
                }
                else
                {
                    for (int i = 0; i < vrResult.Length; i++)
                    {
                        if (vrResult[i].dwSecIndex.ToString() != newTimeTable.dwSecIndex.ToString())
                        {
                            list.Add(vrResult[i]);
                        }
                    }
                    list.Add(newTimeTable);
                    CLASSTIMETABLE[] res2 = new CLASSTIMETABLE[(list.Count)];
                    for (int i = 0; i < list.Count; i++)
                    {
                        res2[i] = new CLASSTIMETABLE();
                        res2[i] = (CLASSTIMETABLE)list[i];
                    }
                    uResponse = m_Request.Reserve.SetClassTimeTable(res2);
                    if (uResponse != REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        MessageBox(m_Request.szErrMessage, "修改作息时间失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    }
                    else
                    {
                        MessageBox("修改作息时间成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                        return;
                    }
                }
            }
        }
        if (Request["op"] == "set")
        {
            string           szID        = Request["dwID"];
            REQUESTCODE      uResponse   = REQUESTCODE.EXECUTE_FAIL;
            CTSREQ           vrParameter = new CTSREQ();
            CLASSTIMETABLE[] vrResult;
            if (m_Request.Reserve.GetClassTimeTable(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS)
            {
                ArrayList list = new ArrayList();
                for (int i = 0; i < vrResult.Length; i++)
                {
                    if (vrResult[i].dwSecIndex.ToString() == szID)
                    {
                        PutJSObj(vrResult[i]);
                        break;
                    }
                }
            }
        }
        else
        {
        }
    }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (TextMode)
            {
                if (RoomID == 0xffffffff)
                {
                    return;
                }
                DateTime dtDate;
                if (string.IsNullOrEmpty(SetDate))
                {
                    if (!string.IsNullOrEmpty(DefaultDate))
                    {
                        DateTime.TryParse(DefaultDate, out dtDate);
                    }
                    else
                    {
                        dtDate = DateTime.Now;
                    }
                }
                else if (SetDate == "now")
                {
                    dtDate = DateTime.Now;
                }
                else
                {
                    DateTime.TryParse(SetDate, out dtDate);
                }
                CTSREQ ctsreq = new CTSREQ();

                REQUESTCODE ret1 = m_Request.Reserve.GetClassTimeTable(ctsreq, out vtSec);
                if (ret1 == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    m_colcount = vtSec.Length;
                }

                ROOMRESVSTATREQ vrRoomStatReq = new ROOMRESVSTATREQ();
                ROOMRESVSTAT[]  vtRoomStat;
                if (RoomID > 0)
                {
                    // vrRoomStatReq.dwGetType = (uint)ROOMRESVSTATREQ.DWGETTYPE.ROOMRESVSTAT_ROOMID;
                    vrRoomStatReq.szRoomIDs = RoomID.ToString();
                }
                else
                {
                    // vrRoomStatReq.dwGetType = (uint)ROOMRESVSTATREQ.DWGETTYPE.ROOMRESVSTAT_ALL;
                }
                vrRoomStatReq.dwDate = GetDate(dtDate.ToShortDateString().Replace("/", "-"));
                REQUESTCODE ret2 = m_Request.Device.GetRoomResvStat(vrRoomStatReq, out vtRoomStat);
                if (ret2 == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    m_nRoomCount = vtRoomStat.Length;
                    for (int i = 0; i < vtRoomStat.Length; i++)
                    {
                        ROOMRESVSTAT stat = vtRoomStat[i];
                        if (RoomID > 0 && RoomID != stat.dwRoomID)
                        {
                            continue;
                        }
                        for (int n = stat.szResvInfo.Length - 1; n >= 0; n--)
                        {
                            TEACHINGRESVINFO tinfo      = stat.szResvInfo[n];
                            string           szBeginSec = ((tinfo.dwTeachingTime / 100) % 100).ToString(); // GetSecName(vtSec, (uint)tinfo.dwBeginTime);
                            string           szEndSec   = (tinfo.dwTeachingTime % 100).ToString();         //GetSecName(vtSec, (uint)tinfo.dwEndTime);

                            string szText = "";
                            if (!string.IsNullOrEmpty(tinfo.szTeacherName))
                            {
                                szText += tinfo.szTeacherName + ",";
                            }
                            if (!string.IsNullOrEmpty(tinfo.szTestPlanName))
                            {
                                szText += "" + tinfo.szTestPlanName + " ";
                            }
                            if (!string.IsNullOrEmpty(tinfo.szTestName))
                            {
                                szText += "" + tinfo.szTestName + " ";
                            }
                            else if (!string.IsNullOrEmpty(tinfo.szGroupName))
                            {
                                szText += tinfo.szGroupName + " ";
                            }
                            else if (!string.IsNullOrEmpty(tinfo.szCourseName))
                            {
                                szText += tinfo.szCourseName + " ";
                            }
                            string str = "<td class='RoomName' >" + GetShortName(stat.szRoomName, 5) + "</td><td class='timeSec'>" + szBeginSec + "—" + szEndSec + "</td><td class='resvName'>" + GetShortName(szText, 10) + "</td>";
                            m_szDevTbl += "<tr class='resvItem'>" + str + "</tr>";
                        }
                        if (RoomID > 0)
                        {
                            m_nRoomCount = 1;
                            break;
                        }
                    }
                    m_szDevTbl = "<table class='resvTable' height='354px'><thead class='itemHeader'><tr><th class='RoomName'>实验室</th><th class='timeSec'>节次</th><th class='resvName'>班级</th></tr></thead><tbody>" + m_szDevTbl + "</tbody></table>";
                }
            }
            else
            {
                DateTime dtStart;
                if (string.IsNullOrEmpty(SetDate))
                {
                    SetDate = HF_StartDate.Value;
                }

                if (string.IsNullOrEmpty(SetDate))
                {
                    if (!string.IsNullOrEmpty(DefaultDate))
                    {
                        DateTime.TryParse(DefaultDate, out dtStart);
                    }
                    else
                    {
                        dtStart = DateTime.Now;
                    }
                    SetDate = dtStart.ToShortDateString().Replace("/", "-");
                }
                else if (SetDate == "now")
                {
                    dtStart = DateTime.Now;
                }
                else
                {
                    DateTime.TryParse(SetDate, out dtStart);
                }


                HF_StartDate.Value = SetDate;

                string[] szWeekName = { "日", "一", "二", "三", "四", "五", "六" };
                if (string.IsNullOrEmpty(HF_Week.Value))
                {
                    HF_Week.Value = dtStart.ToShortDateString().Replace("/", "-");
                }
                else
                {
                    DateTime dtCur;
                    DateTime.TryParse(HF_Week.Value, out dtCur);
                    if (dtCur < dtStart || dtCur >= dtStart.AddDays(7))
                    {
                        HF_Week.Value = dtStart.ToShortDateString().Replace("/", "-");
                    }
                }
                for (int i = 0; i <= 7; i++)
                {
                    DateTime d       = dtStart.AddDays(i);
                    string   szClass = "";
                    if (HF_Week.Value == d.ToShortDateString().Replace("/", "-"))
                    {
                        szClass = "class='curweek'";
                    }
                    m_szWeek += "<div data-d='" + d.ToShortDateString().Replace("/", "-") + "' " + szClass + ">" + d.Month + "月" + d.Day + "日<br/>周" + szWeekName[(int)d.DayOfWeek] + "</div>";
                }

                //----------------------------------------------------------
                CTSREQ ctsreq = new CTSREQ();

                REQUESTCODE ret1 = m_Request.Reserve.GetClassTimeTable(ctsreq, out vtSec);

                if (ret1 == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    if (SecCount > 0)
                    {
                        vtSec = GetLimitSec(vtSec, SecCount);
                    }
                    m_colcount = vtSec.Length;

                    int awidth = (Width - DevColWidth) / m_colcount + 1;
                    for (int i = 0; i < vtSec.Length; i++)
                    {
                        m_szSec        += "<div title='" + (vtSec[i].dwBeginTime / 60) + ":" + vtSec[i].dwBeginTime % 60 + "至" + (vtSec[i].dwEndTime / 60) + ":" + vtSec[i].dwEndTime % 60 + "'>" + vtSec[i].szSecName + "</div>";
                        m_szSecAreaMap += "<area data-id='" + vtSec[i].dwSecIndex + "' shape='rect' coords='" + (i * awidth) + ",0," + ((i + 1) * awidth) + "," + RowHeight + "'/>";
                    }
                }

                //----------------------------------------------------------
                if (RoomID == 0xffffffff)
                {
                    return;
                }
                int nStartLine = 0;
                int nNeedLine  = 10;
                int.TryParse(Request["DevStartLine"], out nStartLine);
                int.TryParse(Request["DevNeedLine"], out nNeedLine);
                if (nNeedLine == 0)
                {
                    nNeedLine = 10;
                }

                ROOMRESVSTATREQ vrRoomStatReq = new ROOMRESVSTATREQ();
                ROOMRESVSTAT[]  vtRoomStat;

                if (RoomID > 0)
                {
                    //vrRoomStatReq.dwGetType = (uint)ROOMRESVSTATREQ.DWGETTYPE.ROOMRESVSTAT_ROOMID;
                    vrRoomStatReq.szRoomIDs = RoomID.ToString();
                }
                else
                {
                    //vrRoomStatReq.dwGetType = (uint)ROOMRESVSTATREQ.DWGETTYPE.ROOMRESVSTAT_ALL;
                }
                vrRoomStatReq.dwDate = GetDate(HF_Week.Value);
                REQUESTCODE ret2 = m_Request.Device.GetRoomResvStat(vrRoomStatReq, out vtRoomStat);

                if (ret2 == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    m_nRoomCount = vtRoomStat.Length;
                    for (int i = 0; i < vtRoomStat.Length; i++)
                    {
                        if (i < nStartLine)
                        {
                            continue;
                        }
                        if (i >= nStartLine + nNeedLine)
                        {
                            break;
                        }

                        ROOMRESVSTAT stat = vtRoomStat[i];
                        if (RoomID > 0 && RoomID != stat.dwRoomID)
                        {
                            continue;
                        }
                        m_szDevTbl += "<tr><td><div class='DevName'>" + GetShortName(stat.szRoomName, 6) + "</div></td><td><div class='bgWeek' data-id='" + stat.dwRoomID + "'>";
                        float nLastEndSec = 0;
                        //todo演示使用
                        stat.szResvInfo    = new TEACHINGRESVINFO[2];
                        stat.szResvInfo[0] = new TEACHINGRESVINFO();
                        stat.szResvInfo[0].dwTeachingTime = 550507;
                        stat.szResvInfo[1] = new TEACHINGRESVINFO();
                        stat.szResvInfo[1].dwTeachingTime = 650204;

                        for (int n = stat.szResvInfo.Length - 1; n >= 0; n--)
                        {
                            TEACHINGRESVINFO tinfo     = stat.szResvInfo[n];
                            float            nBeginSec = (float)((tinfo.dwTeachingTime / 100) % 100); //GetSecSN((uint)tinfo.dwBeginTime);
                            float            nEndSec   = (float)(tinfo.dwTeachingTime % 100);         //GetSecSN((uint)tinfo.dwEndTime);

                            string szText = "";
                            if (!string.IsNullOrEmpty(tinfo.szTeacherName))
                            {
                                szText += tinfo.szTeacherName + ",";
                            }
                            if (!string.IsNullOrEmpty(tinfo.szTestPlanName))
                            {
                                szText += "" + tinfo.szTestPlanName + " ";
                            }
                            if (!string.IsNullOrEmpty(tinfo.szTestName))
                            {
                                szText += "" + tinfo.szTestName + " ";
                            }
                            else if (!string.IsNullOrEmpty(tinfo.szGroupName))
                            {
                                szText += tinfo.szGroupName + " ";
                            }
                            else if (!string.IsNullOrEmpty(tinfo.szCourseName))
                            {
                                szText += tinfo.szCourseName + " ";
                            }
                            if ((tinfo.dwResvStat & (uint)UNIRESERVE.DWSTATUS.RESVSTAT_DOING) != 0)
                            {
                                m_szDevTbl += "<div class='Resv ResvDOING' ";
                            }
                            else if ((tinfo.dwResvStat & (uint)UNIRESERVE.DWSTATUS.RESVSTAT_DONE) != 0)
                            {
                                m_szDevTbl += "<div class='Resv ResvDONE' ";
                            }
                            else
                            {
                                m_szDevTbl += "<div class='Resv' ";
                            }
                            m_szDevTbl += "data-ny='" + stat.dwRoomID + "' data-nxs='" + nBeginSec + "' data-nxe='" + nEndSec + "' data-p='" + (nBeginSec - nLastEndSec) + "' data-w='" + (nEndSec - nBeginSec) + "'>" + szText + "</div>";
                            nLastEndSec = nEndSec;
                        }
                        m_szDevTbl += "</div></td></tr>";
                        if (RoomID > 0)
                        {
                            m_nRoomCount = 1;
                            break;
                        }
                    }
                }
            }
        }