Exemplo n.º 1
0
        CLASSTIMETABLE[] GetLimitSec(CLASSTIMETABLE[] sec, int nSecCount)
        {
            if (sec.Length > nSecCount)
            {
                int  curSec = 0;
                uint dwTime = (uint)((DateTime.Now.Hour * 60) + DateTime.Now.Minute);
                for (int i = 0; i < sec.Length; i++)
                {
                    if (sec[i].dwBeginTime <= dwTime && dwTime <= sec[i].dwEndTime)
                    {
                        curSec = i;
                        break;
                    }
                }
                if (sec.Length - curSec < nSecCount)
                {
                    curSec = sec.Length - nSecCount;
                }

                CLASSTIMETABLE[] vtSec2 = new CLASSTIMETABLE[nSecCount];
                Array.Copy(sec, curSec, vtSec2, 0, nSecCount);
                return(vtSec2);
            }
            else
            {
                return(sec);
            }
        }
Exemplo n.º 2
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);
        }
    }
Exemplo n.º 3
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
        {
        }
    }