Ejemplo n.º 1
0
    private void DelLab(string szID)
    {
        REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL;
        UNILAB      lab       = new UNILAB();

        lab.dwLabID = Parse(szID);
        uResponse   = m_Request.Device.LabDel(lab);
        if (uResponse != REQUESTCODE.EXECUTE_SUCCESS)
        {
            MessageBox(m_Request.szErrMessage, "提示", MSGBOX.ERROR);
        }
    }
Ejemplo n.º 2
0
    public bool GetLabByID(uint?uLabID, out UNILAB lab)
    {
        LABREQ vrParameter = new LABREQ();

        vrParameter.dwLabID = uLabID;
        UNILAB[] vrResult;
        lab = new UNILAB();
        if (m_Request.Device.LabGet(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS && vrResult != null && vrResult.Length > 0)
        {
            lab = vrResult[0];
            return(true);
        }
        return(false);
    }
Ejemplo n.º 3
0
    private void InitLab()
    {
        LABREQ req = new LABREQ();

        UNILAB[] rlt;
        if (m_Request.Device.LabGet(req, out rlt) == REQUESTCODE.EXECUTE_SUCCESS)
        {
            itemList = "<div class='line'></div><h2>" + GetConfig("LabName") + "列表</h2><ul>";
            for (int i = 0; i < rlt.Length; i++)
            {
                UNILAB lab = rlt[i];
                itemList += "<li>" + lab.szLabName + "(ID:" + lab.dwLabID + ")&nbsp;<a href='editcontent.aspx?name=" + Server.UrlEncode(lab.szLabName + "(介绍)") + "&type=lab_intro&id=" + lab.dwLabID + "' target='_blank'>介绍</a> / <a href='editcontent.aspx?name=" + Server.UrlEncode(lab.szLabName + "(硬件配置)") + "&type=lab_hard&id=" + lab.dwLabID + "' target='_blank'>硬件配置</a> / <a href='editcontent.aspx?name=" + Server.UrlEncode(lab.szLabName + "(相册)") + "&type=lab_slide&id=" + lab.dwLabID + "' target='_blank'>相册</a>" +
                            " / <a href='editcontent.aspx?name=" + Server.UrlEncode(lab.szLabName + "(预约须知)") + "&type=lab_rule&id=" + lab.dwLabID + "' target='_blank'>须知</a>" + ((availMobile & 5) > 0?" / <a href='editcontent.aspx?name=" + Server.UrlEncode(lab.szLabName + "(移动端介绍)") + "&type=lab_mIntro&id=" + lab.dwLabID + "' target='_blank'>(移动端)介绍</a>":"") + "</li>";
            }
            itemList += "</ul>";
        }
    }
Ejemplo n.º 4
0
    private void DelRoom(string szID)
    {
        REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL;
        UNIROOM     room      = new UNIROOM();

        if (GetRoomID(szID, out room))
        {
            UNILAB labDel = new UNILAB();
            labDel.dwLabID = room.dwLabID;
            uResponse      = m_Request.Device.LabDel(labDel);
            if (uResponse == REQUESTCODE.EXECUTE_SUCCESS)
            {
                room.dwRoomID = Parse(szID);
                uResponse     = m_Request.Device.RoomDel(room);

                if (uResponse != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, "提示", MSGBOX.ERROR);
                }
            }
        }
    }
Ejemplo n.º 5
0
    private string GetLabs()
    {
        LABREQ req = new LABREQ();

        req.dwLabClass = classkind;
        //if (purpose > 0)
        //    req.dwPurpose = purpose;
        UNILAB[] rlt;
        string   ret = "<div class='content-block-title'>位置</div>";

        if (m_Request.Device.LabGet(req, out rlt) == REQUESTCODE.EXECUTE_SUCCESS)
        {
            ret += "<div class='list-block'><ul>";
            for (int i = 0; i < rlt.Length; i++)
            {
                UNILAB lab = rlt[i];
                ret += "<li><label class='label-checkbox item-content'><input type='checkbox' name='lab_id' class='ck_lab' value='" + lab.dwLabID + "'/><div class='item-media'>" +
                       "<i class='icon icon-form-checkbox'></i></div><div class='item-inner'><div class='item-title'>" + lab.szLabName + "</div></div></label></li>";
            }
            ret += "</ul></div>";
        }
        return(ret);
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UNIROOM newRoom;
        uint?   uMax = 0;
        uint    uID  = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET;

        if (GetMaxValue(ref uMax, uID, "szRoomNo"))
        {
        }
        if (IsPostBack)
        {
            GetHTTPObj(out newRoom);
            string szManMode = Request["dwManMode"];
            newRoom.dwManMode = CharListToUint(szManMode);
            if (newRoom.dwManGroupID == null || newRoom.dwManGroupID.ToString() == "0")
            {
                UNIGROUP newGroup = new UNIGROUP();
                if (!NewGroup(newRoom.szRoomName + "管理员组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newGroup))
                {
                    MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    DelGroup(newGroup.dwGroupID);
                    return;
                }
                newRoom.dwManGroupID = newGroup.dwGroupID;
            }
            UNILAB setLab = new UNILAB();
            setLab.dwLabID      = newRoom.dwLabID;
            setLab.dwManGroupID = newRoom.dwManGroupID;
            setLab.dwDeptID     = newRoom.dwDeptID;
            setLab.szDeptName   = newRoom.szDeptName;
            setLab.szLabName    = newRoom.szRoomName;
            setLab.szLabSN      = newRoom.szRoomNo;

            if (m_Request.Device.LabSet(setLab, out setLab) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            }
            else
            {
                if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                }
                else
                {
                    MessageBox("修改" + ConfigConst.GCRoomName + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                    return;
                }
            }
        }
        DOORCTRLREQ vrParameter = new DOORCTRLREQ();
        uint        uRoomMode   = (uint)(UNIROOM.DWMANMODE.ROOMMAN_CAMERA | UNIROOM.DWMANMODE.ROOMMAN_DOORLOCK | UNIROOM.DWMANMODE.ROOMMAN_FREEINOUT);

        m_szRoomMode          = GetInputHtml(uRoomMode, CONSTHTML.checkBox, "dwManMode", "Room_dwManMode");
        vrParameter.dwDCSKind = (uint)UNIDOORCTRL.DWCTRLKIND.DCKIND_ROOM;
        vrParameter.dwGetType = (uint)DOORCTRLREQ.DWGETTYPE.DOORCTRLGET_BYALL;

        UNILAB[] vtLab = GetAllLab();
        if (vtLab != null && vtLab.Length > 0)
        {
            for (int i = 0; i < vtLab.Length; i++)
            {
                m_szLab += "<option value='" + vtLab[i].dwLabID + "'>" + vtLab[i].szLabName + "</option>";
            }
        }
        DEVOPENRULE[] vtOpenRule = GetAllOpenRule();
        if (vtOpenRule != null && vtOpenRule.Length > 0)
        {
            for (int i = 0; i < vtOpenRule.Length; i++)
            {
                m_szOpenRule += "<option value='" + vtOpenRule[i].dwRuleSN + "'>" + vtOpenRule[i].szRuleName + "</option>";
            }
        }

        if (Request["op"] == "set")
        {
            bSet = true;

            ROOMREQ vrRoomReq = new ROOMREQ();
            vrRoomReq.dwRoomID = ToUint(Request["roomid"]);
            UNIROOM[] vtRoom;
            if (m_Request.Device.RoomGet(vrRoomReq, out vtRoom) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
            }
            else
            {
                if (vtRoom.Length == 0)
                {
                    MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
                }
                else
                {
                    PutJSObj(vtRoom[0]);
                    m_Title = "修改【" + vtRoom[0].szRoomName + "】";
                }
            }
        }
        else
        {
            UNISTATION station = new UNISTATION();
            station.dwStaSN = uMax;
            PutJSObj(station);
            m_Title = "新建" + ConfigConst.GCRoomName;
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL;
        uint        uDevCount = 0;
        uint        uPrice    = 0;
        string      szPostion = "";
        COMPANYREQ  campGet   = new COMPANYREQ();

        UNICOMPANY[] vtCamp;
        if (m_Request.Assert.GetCompany(campGet, out vtCamp) == REQUESTCODE.EXECUTE_SUCCESS && vtCamp != null && vtCamp.Length > 0)
        {
            for (int i = 0; i < vtCamp.Length; i++)
            {
                if ((vtCamp[i].dwComKind & (uint)UNICOMPANY.DWCOMKIND.COM_PRODUCER) > 0)
                {
                    m_sKindPro += GetInputItemHtml(CONSTHTML.option, "", vtCamp[i].szComName, vtCamp[i].dwComID.ToString());
                }
                else if ((vtCamp[i].dwComKind & (uint)UNICOMPANY.DWCOMKIND.COM_SELLER) > 0)
                {
                    m_sKindSell += GetInputItemHtml(CONSTHTML.option, "", vtCamp[i].szComName, vtCamp[i].dwComID.ToString());
                }
                else if ((vtCamp[i].dwComKind & (uint)UNICOMPANY.DWCOMKIND.COM_SERVICE) > 0)
                {
                    m_sKindSer += GetInputItemHtml(CONSTHTML.option, "", vtCamp[i].szComName, vtCamp[i].dwComID.ToString());
                }
            }
        }
        UNIDEVCLS[] vtDevCls = GetAllDevCls();
        UNIDEPT[]   vtdept   = GetAllDept();
        for (int i = 0; i < vtdept.Length; i++)
        {
            szDept += GetInputItemHtml(CONSTHTML.option, "", vtdept[i].szName, vtdept[i].dwID.ToString());
        }
        // szDevSN = GetDevSN().ToString();
        if (vtDevCls != null && vtDevCls.Length > 0)
        {
            for (int i = 0; i < vtDevCls.Length; i++)
            {
                szDevCLS += GetInputItemHtml(CONSTHTML.option, "", vtDevCls[i].szClassName, vtDevCls[i].dwClassID.ToString());
            }
        }
        UNIROOM[] vtRoom = GetAllRoom();
        if (vtRoom != null && vtRoom.Length > 0)
        {
            for (int i = 0; i < vtRoom.Length; i++)
            {
                szRoom += GetInputItemHtml(CONSTHTML.option, "", vtRoom[i].szRoomName, vtRoom[i].dwRoomID.ToString());
            }
        }
        CODINGTABLE[] vtCodeTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_DEVFUNC);
        if (vtCodeTable != null && vtCodeTable.Length > 0)
        {
            for (int i = 0; i < vtCodeTable.Length; i++)
            {
                szFunction += GetInputItemHtml(CONSTHTML.option, "", vtCodeTable[i].szCodeName.ToString(), vtCodeTable[i].szCodeSN.ToString());
            }
        }
        if (IsPostBack)
        {
            uint   szPurchaseDate = GetDate(Request["dwPurchaseDate"]);
            DEVREQ devGet         = new DEVREQ();
            devGet.szAssertSN = szPurchaseDate.ToString();
            devGet.szReqExtInfo.dwNeedLines = 1;
            devGet.szReqExtInfo.dwStartLine = 0;
            devGet.szReqExtInfo.szOrderKey  = "szAssertSN";
            devGet.szReqExtInfo.szOrderMode = "desc";
            UNIDEVICE[] vtDevList;
            int         iStart = 0;
            if (m_Request.Device.Get(devGet, out vtDevList) == REQUESTCODE.EXECUTE_SUCCESS && vtDevList != null && vtDevList.Length > 0)
            {
                //string szAssertSN = vtDevList[0].szAssertSN.ToString();
                //uint uStart = Parse(szAssertSN.Substring(8,4));
                iStart = szGetMaxValue(vtDevList[0].szAssertSN.ToString());
            }

            iStart = iStart + 1;
            string  szDept = Request["dwdept"];
            UNIDEPT deptValue;
            string  szDeptMemo = "";
            if (GetDeptByID(szDept, out deptValue))
            {
                szDeptMemo = deptValue.szMemo;
            }

            uint   uNum          = Parse(Request["dwNum"]);
            int    NextLen       = IntParse(Request["dwNextLen"]);
            string LenFix        = Request["LenFix"];
            string szPreName     = Request["szPreName"];//为assertsn
            string szPreNameTemp = szPreName;

            string szPreOriginSN     = Request["szPreName"];  // Request["szPreOriginSN"];//原厂序列号
            string szNextOriginSN    = Request["szNextName"]; //后缀编号
            uint   uNextOriginSN     = Parse(szNextOriginSN);
            string szPreOriginSNTemp = szPreOriginSN;
            string dwOriginSNLenFix  = Request["LenFix"];              // Request["dwOriginSNLenFix"];
            int    dwOriginSNLen     = IntParse(Request["dwNextLen"]); //; IntParse(Request["dwOriginSNLen"]);

            uint uNextName = Parse(Request["szNextName"]);
            uint uRoomID   = Parse(Request["dwRoomID"]);
            uint uLabID    = Parse(Request["dwLabID"]);
            uint uKindID   = Parse(Request["dwKindID"]);
            uint uStartNum = Parse(Request["dwStartNum"]);
            uint uCtrlMode = Parse(Request["dwCtrlMode"]);

            string    szPreDevName   = Request["szPreDevName"];
            string    szNextNameTemp = szPreDevName;
            uint      uNextDevName   = (uint)iStart; // Parse(Request["szNextDevName"].ToString());
            int       uNextDevLen    = 0;            //暂时取消,为了资产名能够自由编辑 IntParse(Request["dwNextDevLen"].ToString());
            string    uDevLenFix     = (Request["DevLenFix"]);
            UNIASSERT newDev         = new UNIASSERT();
            GetHTTPObj(out newDev);
            string  szRoomMemo   = "";
            string  szDevClsMemo = "";
            UNIROOM roomGet;
            if (GetRoomID(newDev.dwRoomID.ToString(), out roomGet))
            {
                szRoomMemo = roomGet.szMemo;
            }
            newDev.szDevName = szPreDevName;
            string szKindName  = newDev.szDevName + "-" + newDev.szModel + "-" + newDev.szFuncCode;
            uint   uKindIDTemp = GetDevKindByName(szKindName);
            if (uKindIDTemp > 0)
            {
                newDev.dwKindID = uKindIDTemp;
                UNIDEVKIND kindValue;
                if (GetDevKindByID(uKindIDTemp.ToString(), out kindValue))
                {
                    kindValue.dwClassID = newDev.dwClassID;
                    UNIDEVCLS setDevCls;
                    if (GetDevCLSByID(kindValue.dwClassID.ToString(), out setDevCls))
                    {
                        szDevClsMemo = setDevCls.szMemo;
                    }
                }
            }
            else
            {
                UNIDEVKIND kindValue;
                GetHTTPObj(out kindValue);
                kindValue.dwClassID = newDev.dwClassID;
                UNIDEVCLS setDevCls;
                if (GetDevCLSByID(kindValue.dwClassID.ToString(), out setDevCls))
                {
                    szDevClsMemo = setDevCls.szMemo;
                }
                kindValue.dwMaxUsers = 1;
                kindValue.dwMinUsers = 1;
                kindValue.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE + (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_KINDRESV;
                kindValue.szKindName = newDev.szDevName + "-" + newDev.szModel + "-" + newDev.szFuncCode;
                if (m_Request.Device.DevKindSet(kindValue, out kindValue) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    uKindIDTemp = (uint)kindValue.dwKindID;
                }
                else
                {
                    return;
                }
            }
            //for (uint i = uNextName; i <= (uNum + uNextName - 1); i++)
            for (uint i = uNextName; i <= (uNum + uNextName - 1); i++)
            {
                newDev.dwPurchaseDate = GetDate(Request["dwPurchaseDate"]);
                if (LenFix == "true")
                {
                    szPreName = szPreNameTemp + i.ToString().PadLeft(NextLen, '0');
                }
                else
                {
                    szPreName = szPreNameTemp + i.ToString();
                }

                /*
                 * if (uDevLenFix == "true")
                 * {
                 * szPreDevName = szNextNameTemp + uNextDevName.ToString().PadLeft(uNextDevLen, '0');
                 * }
                 * else
                 * {
                 * szPreDevName = szNextNameTemp + uNextDevName.ToString();
                 * }
                 */
                if (dwOriginSNLenFix == "true")
                {
                    szPreOriginSN = szPreOriginSNTemp + uNextOriginSN.ToString().PadLeft(dwOriginSNLen, '0');
                    szPreDevName  = szNextNameTemp + uNextOriginSN.ToString().PadLeft(dwOriginSNLen, '0');
                }
                else
                {
                    szPreOriginSN = szPreOriginSNTemp + uNextOriginSN.ToString();
                    szPreDevName  = szNextNameTemp + uNextOriginSN.ToString();
                }

                newDev.szDevName = szPreDevName;
                string szLabEX = "";
                UNILAB lab     = new UNILAB();
                if (GetLabByID((uint?)uLabID, out lab))
                {
                    szLabEX = lab.szMemo.ToString();
                }
                //newDev.szAssertSN = szPurchaseDate + iStart.ToString("0000") + szDeptMemo + szRoomMemo; //GetDevSN().ToString();//szPreName;
                //newDev.szAssertSN = szPurchaseDate + iStart.ToString("0000") + szDeptMemo + szRoomMemo; //GetDevSN().ToString();//szPreName;
                // newDev.szAssertSN = szPurchaseDate +szDevClsMemo+ iStart.ToString("0000");
                newDev.szAssertSN = szPreOriginSN;
                // newDev.szAssertSN = szPurchaseDate + szLabEX + iStart.ToString("0000");


                newDev.dwLabID      = uLabID;
                newDev.dwKindID     = uKindIDTemp;
                newDev.dwRoomID     = uRoomID;
                newDev.dwSellerID   = Parse(Request["dwSellerID"]);
                newDev.dwProducerID = Parse(Request["dwProducerID"]);
                newDev.dwServiceID  = Parse(Request["dwServiceID"]);
                newDev.dwProperty   = CharListToUint(Request["dwProperty"]);
                UNIACCOUNT vrAccInfo = ((ADMINLOGINRES)Session["LoginResult"]).AccInfo;
                newDev.dwKeeperID = vrAccInfo.dwAccNo;
                newDev.dwDevID    = null;
                if (m_Request.Assert.AssertWarehousing(newDev, out newDev) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    UNIROOM getRoom;
                    if (GetRoomID(newDev.dwRoomID.ToString(), out getRoom))
                    {
                        szPostion = getRoom.szRoomName.ToString();
                    }
                    iStart        = iStart + 1;
                    uNextDevName  = uNextDevName + 1;
                    uStartNum     = uStartNum + 1;
                    uDevCount     = uDevCount + 1;
                    uNextOriginSN = uNextOriginSN + 1;
                    uPrice        = uPrice + (uint)newDev.dwUnitPrice;
                }
            }
            MessageBox("批量新建" + ConfigConst.GCDevName + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
            PrintAssign(uDevCount, uPrice, szPostion);

            return;
        }
        m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true);
        m_Title      = "批量新建" + ConfigConst.GCDevName;
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UNIROOM newRoom;
        uint?   uMax = 0;
        uint    uID  = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET;

        if (GetMaxValue(ref uMax, uID, "szRoomNo"))
        {
        }
        if (IsPostBack)
        {
            GetHTTPObj(out newRoom);
            string szManMode = Request["dwManMode"];
            newRoom.dwManMode = CharListToUint(szManMode);
            UNIGROUP newGroup = new UNIGROUP();
            if (!NewGroup(newRoom.szRoomName + "管理员组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newGroup))
            {
                MessageBox(m_Request.szErrMessage, "新建" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                DelGroup(newGroup.dwGroupID);
                return;
            }
            newRoom.dwManGroupID = newGroup.dwGroupID;

            CAMPUSREQ campGet = new CAMPUSREQ();
            UNILAB    setLab  = new UNILAB();
            setLab.dwManGroupID = newGroup.dwGroupID;
            setLab.dwDeptID     = newRoom.dwDeptID;
            setLab.szDeptName   = newRoom.szDeptName;
            setLab.szLabName    = newRoom.szRoomName;
            setLab.szLabSN      = newRoom.szRoomNo;
            UNICAMPUS[] vtCampres;
            if (m_Request.Account.CampusGet(campGet, out vtCampres) == REQUESTCODE.EXECUTE_SUCCESS && vtCampres != null && vtCampres.Length > 0)
            {
                //setLab.dwCampusID = vtCampres[0].dwCampusID;
            }
            if (m_Request.Device.LabSet(setLab, out setLab) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "新建" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            }
            else
            {
                newRoom.dwLabID = setLab.dwLabID;
                if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, "新建" + ConfigConst.GCRoomName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    m_Request.Device.LabDel(setLab);
                }
                else
                {
                    MessageBox("新建" + ConfigConst.GCRoomName + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                    if (Session["LoginResult"] != null)
                    {
                        ADMINLOGINRES admin = (ADMINLOGINRES)Session["LoginResult"];
                        AddGroupMember(newGroup.dwGroupID, admin.AdminInfo.dwAccNo, (uint)GROUPMEMBER.DWKIND.MEMBERKIND_PERSONAL);
                    }
                    return;
                }
            }
        }
        uint uRoomMode = (uint)(UNIROOM.DWMANMODE.ROOMMAN_CAMERA | UNIROOM.DWMANMODE.ROOMMAN_DOORLOCK | UNIROOM.DWMANMODE.ROOMMAN_FREEINOUT);

        m_szRoomMode = GetInputHtml(uRoomMode, CONSTHTML.checkBox, "dwManMode", "Room_dwManMode");
        UNILAB[] vtLab = GetAllLab();
        if (vtLab != null && vtLab.Length > 0)
        {
            for (int i = 0; i < vtLab.Length; i++)
            {
                m_szLab += "<option value='" + vtLab[i].dwLabID + "'>" + vtLab[i].szLabName + "</option>";
            }
        }
        DEVOPENRULE[] vtOpenRule = GetAllOpenRule();
        if (vtOpenRule != null && vtOpenRule.Length > 0)
        {
            for (int i = 0; i < vtOpenRule.Length; i++)
            {
                m_szOpenRule += "<option value='" + vtOpenRule[i].dwRuleSN + "'>" + vtOpenRule[i].szRuleName + "</option>";
            }
        }

        if (Request["op"] == "set")
        {
            bSet = true;

            ROOMREQ vrRoomReq = new ROOMREQ();
            vrRoomReq.dwRoomID = ToUint(Request["id"]);
            UNIROOM[] vtRoom;
            if (m_Request.Device.RoomGet(vrRoomReq, out vtRoom) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
            }
            else
            {
                if (vtRoom.Length == 0)
                {
                    MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
                }
                else
                {
                    PutJSObj(vtRoom[0]);
                    m_Title = "修改【" + vtRoom[0].szRoomName + "】";
                }
            }
        }
        else
        {
            UNISTATION station = new UNISTATION();
            station.dwStaSN = uMax;
            PutJSObj(station);
            m_Title = "新建" + ConfigConst.GCRoomName;
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string szlab      = Request["lab"];
        string szCampus   = Request["campus"];
        string szRunState = Request["dwRunStat"];
        string szRoom     = Request["szRoom"];
        string szDevCls   = Request["szDevCls"];
        string szOp       = Request["op"];
        string szID       = Request["dwID"];

        if (szOp == "limit")
        {
            SetLimit(szID);
        }
        else if (szOp == "open")
        {
            SetOpen(szID);
        }
        //=========================
        UNILAB[] lab = GetAllLab();
        if (lab != null && lab.Length > 0)
        {
            for (int i = 0; i < lab.Length; i++)
            {
                m_szLab += "<label><input class=\"enum\" type=\"" + "checkbox" + "\" name=\"" + "lab" + "\" value=\"" + lab[i].dwLabID.ToString() + "\" /> " + lab[i].szLabName.ToString() + "</label>";
            }
        }
        UNICAMPUS[] camp = GetAllCampus();
        if (camp != null && camp.Length > 0)
        {
            for (int i = 0; i < camp.Length; i++)
            {
                m_szCamp += "<label><input class=\"enum\" type=\"" + "checkbox" + "\" name=\"" + "campus" + "\" value=\"" + camp[i].dwCampusID.ToString() + "\" /> " + camp[i].szCampusName.ToString() + "</label>";
            }
        }
        UNIDEVCLS[] devCls = GetDevCLS(0);
        if (devCls != null && devCls.Length > 0)
        {
            for (int i = 0; i < devCls.Length; i++)
            {
                m_szDevCls += "<label><input class=\"enum\" type=\"" + "checkbox" + "\" name=\"" + "szDevCls" + "\" value=\"" + devCls[i].dwClassID.ToString() + "\" /> " + devCls[i].szClassName.ToString() + "</label>";
            }
        }
        UNIDEVKIND[] devKind = GetAllDevKind();
        if (devKind != null && devKind.Length > 0)
        {
            for (int i = 0; i < devKind.Length; i++)
            {
                m_szDevKind += "<label><input class=\"enum\" type=\"" + "checkbox" + "\" name=\"" + "szKindIDs" + "\" value=\"" + devKind[i].dwKindID.ToString() + "\" /> " + devKind[i].szKindName.ToString() + "</label>";
            }
        }


        FULLROOM[] roomList = GetAllFullRoom();
        if (roomList != null && roomList.Length > 0)
        {
            for (int i = 0; i < roomList.Length; i++)
            {
                if ((uint)roomList[i].dwTotalDevNum > 0)
                {
                    m_szRoom += "<label><input class=\"enum\" type=\"" + "checkbox" + "\" name=\"" + "szRoom" + "\" value=\"" + roomList[i].dwRoomID.ToString() + "\" /> " + roomList[i].szRoomName.ToString() + "</label>";
                }
            }
        }
        REQUESTCODE uResponse   = REQUESTCODE.EXECUTE_FAIL;
        DEVREQ      vrParameter = new DEVREQ();

        GetHTTPObj(out vrParameter);
        if (szlab != null && szlab != "")
        {
            vrParameter.szLabIDs = szlab;
        }
        if (szCampus != null && szCampus != "")
        {
            vrParameter.szCampusIDs = szCampus;
        }
        if (szlab != null && szlab != "")
        {
            vrParameter.szLabIDs = szlab;
        }
        if (szRoom != null && szRoom != "")
        {
            vrParameter.szRoomIDs = szRoom;
        }
        if (szRunState != null && szRunState != "")
        {
            vrParameter.dwRunStat = CharListToUint(szRunState);
        }
        if (szDevCls != null && szDevCls != "")
        {
            vrParameter.szClassIDs = (szDevCls);
        }
        GetPageCtrlValue(out vrParameter.szReqExtInfo);
        UNIDEVICE[] vrResult;
        ArrayList   labList = new ArrayList();

        uResponse = m_Request.Device.Get(vrParameter, out vrResult);
        if (uResponse == REQUESTCODE.EXECUTE_SUCCESS)
        {
            UpdatePageCtrl(m_Request.Device);
            for (int i = 0; i < vrResult.Length; i++)
            {
                uint uState         = (uint)vrResult[i].dwDevStat;
                uint uRunState      = 0;
                uint uRunStateConst = (uint)vrResult[i].dwRunStat;
                if (vrResult[i].dwRunStat != null)
                {
                    uRunState = (uint)vrResult[i].dwRunStat;
                }
                string szRunStateTitle = "";
                if ((uRunState & (uint)UNIDEVICE.DWRUNSTAT.DEVSTAT_INUSE) > 0)
                {
                    uRunState       = (uint)UNIDEVICE.DWRUNSTAT.DEVSTAT_INUSE;
                    szRunStateTitle = GetJustName((uint)UNIDEVICE.DWRUNSTAT.DEVSTAT_INUSE, "DEVICE_RunState");
                }
                else
                {
                    if (vrResult[i].dwRunStat != null)
                    {
                        uRunState = (uint)vrResult[i].dwRunStat;
                    }
                    else
                    {
                        uRunState = 0;
                    }
                    szRunStateTitle = GetJustName(uRunState, "DEVICE_RunState");
                }
                string szState = "devRunState" + uRunState.ToString();
                if (szRunStateTitle == "")
                {
                    szRunStateTitle = GetJustNameEqual(0, "DEVICE_RunState");
                }
                m_szOut += "<tr>";
                //m_szOut += "<td  data-roomno=\"" + vrResult[i].szRoomNo.ToString() + "\" data-groupid=\"" + vrResult[i].dwUseGroupID.ToString() + "\"  data-name=\"" + vrResult[i].szDevName.ToString() + "\"  data-labid=\"" + vrResult[i].dwLabID.ToString() + "\" data-id=\"" + vrResult[i].dwDevID.ToString() + "\">" + "<img src=\"../../../themes/icon_s/" + szState + ".ico\" class=\"imgico\" />" + "</td>";
                m_szOut += "<td data-szRoomName='" + vrResult[i].szRoomName + "' data-assertsn='" + vrResult[i].szAssertSN + "'  style='text-decoration:underline' class='setDev' data-roomno=\"" + vrResult[i].szRoomNo.ToString() + "\" data-groupid=\"" + vrResult[i].dwUseGroupID.ToString() + "\"  data-name=\"" + vrResult[i].szDevName.ToString() + "\"  data-labid=\"" + vrResult[i].dwLabID.ToString() + "\" data-id=\"" + vrResult[i].dwDevID.ToString() + "\">" + vrResult[i].szAssertSN.ToString() + "</td>";
                m_szOut += "<td>" + vrResult[i].szDevName.ToString() + "</td>";
                m_szOut += "<td >" + vrResult[i].szClassName + "</td>";//类型
                string szModel = vrResult[i].szModel + vrResult[i].szSpecification;

                string szModelRes = "";

                if (GetMinStr(szModel, out szModelRes))
                {
                    //型号规格
                    m_szOut += "<td title=\"" + szModel + "\">" + szModelRes + "</td>";
                }
                else
                {
                    m_szOut += "<td>" + szModel + "</td>";
                }
                m_szOut += "<td >" + vrResult[i].dwUnitPrice + "</td>";               //单价
                m_szOut += "<td>" + GetDateStr(vrResult[i].dwPurchaseDate) + "</td>"; //采购日期
                m_szOut += "<td>" + vrResult[i].szRoomName.ToString() + "</td>";

                m_szOut += "<td>" + GetJustNameEqual(vrResult[i].dwDevStat, "UNIDEVICE_DevStat", true) + "</td>";
                if (((uint)vrResult[i].dwCtrlMode & ((uint)UNIDEVICE.DWCTRLMODE.DEVCTRL_POWERCTRL)) > 0)
                {
                    m_szOut += "<td>" + GetJustName((uint)vrResult[i].dwRunStat, "UNIDEVICE_DevStat") + "</td>";
                }
                else
                {
                    string szDevRunState = GetJustName(uRunState, "DEVICE_RunState");
                    if (szDevRunState == "")
                    {
                        szDevRunState = GetJustNameEqual(0, "DEVICE_RunState");
                    }
                    m_szOut += "<td>" + szDevRunState + "</td>";
                }

                /*门禁状态
                 * string szRoomState = GetJustName(uRunStateConst, "Unidcs_dwStatusDev");
                 * if (szRoomState == "")
                 * {
                 *  m_szOut += "<td>" + "未启用" + "</td>";
                 * }
                 * else
                 * {
                 *  m_szOut += "<td>" + szRoomState + "</td>";
                 * }
                 */


                // m_szOut += "<td>" + vrResult[i].szLabName.ToString() + "</td>";

                /*管理员
                 * UNIACCOUNT accAttend;
                 * if (vrResult[i].dwAttendantID!=null)
                 * {
                 *  m_szOut += "<td class='lnkAccount' data-id='" + vrResult[i].dwAttendantID.ToString() + "'>" + vrResult[i].szAttendantName.ToString() + "</td>";
                 * }
                 * else
                 * {
                 *  m_szOut += "<td class='lnkAccount' data-id='" + vrResult[i].dwAttendantID.ToString() + "'>" + ""+ "</td>";
                 * }
                 */

                DEVUSEINFO[] vtDevUseInfo = vrResult[i].DevUse;
                bool         bIsUse       = true;
                if (vtDevUseInfo == null || vtDevUseInfo.Length > 0)
                {
                    bIsUse = false;
                }
                if (bIsUse)
                {
                    m_szOut += "<td class='lnkAccount' data-id='" + vtDevUseInfo[0].dwAccNo + "'>" + vtDevUseInfo[0].szTrueName + "</td>";
                }
                else
                {
                    m_szOut += "<td>" + "" + "</td>";
                }
                string        szTotalUseMin = "";
                CODINGTABLE[] vtCodingTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_LABFROM);
                if (ConfigConst.GCDevLoginTime == 1)
                {
                    if (bIsUse && vtDevUseInfo[0].dwBeginTime != null && (uint)vtDevUseInfo[0].dwBeginTime != 0)
                    {
                        uint uTotalUseMin = (Get1970Seconds(DateTime.Now.ToString("yyyy-MM-dd HH:mm")) - (uint)vtDevUseInfo[0].dwBeginTime);
                        if (uTotalUseMin > 0 && uTotalUseMin <= 5184000)
                        {
                            szTotalUseMin = GetTimeForSecond(uTotalUseMin);
                        }
                        m_szOut += "<td>" + szTotalUseMin + "</td>";
                    }
                    else
                    {
                        m_szOut += "<td></td>";
                    }
                }
                else
                {
                    if (bIsUse)
                    {
                        szTotalUseMin = Get1970Date(vtDevUseInfo[0].dwBeginTime, "MM-dd HH:mm");
                        m_szOut      += "<td>" + szTotalUseMin + "</td>";
                    }
                    else
                    {
                        m_szOut += "<td>" + "" + "</td>";
                    }
                }

                if (ConfigConst.GCDevListCol == 1)
                {
                    if (bIsUse && (uint)vtDevUseInfo[0].dwBeginTime != 0)
                    {
                        m_szOut += "<td>" + Get1970Date((uint)vtDevUseInfo[0].dwBeginTime, "MM-dd HH:mm") + "到" + Get1970Date((uint)vtDevUseInfo[0].dwLeaveTime, "MM-dd HH:mm") + "</td>";
                    }
                    else
                    {
                        m_szOut += "<td></td>";
                    }
                }
                // m_szOut += "<td class='thCenter'><div class='OPTD'></div></td>";
                // m_szOut += "<td class='thCenter'><div class='OPTD OPTDBtnSet'></div></td>";
                string szLabCode = "";
                bool   bIsAdd    = true;
                for (int k = 0; k < labList.Count; k++)
                {
                    UNILAB labTemp = (UNILAB)labList[k];
                    if (labTemp.dwLabID == vrResult[i].dwLabID)
                    {
                        szLabCode = labTemp.szLabFromCode;
                        bIsAdd    = false;
                        break;
                    }
                }
                if (bIsAdd)
                {
                    UNILAB labGet;
                    if (GetLabByID(vrResult[i].dwLabID, out labGet))
                    {
                        szLabCode = labGet.szLabFromCode;
                        labList.Add(labGet);
                    }
                }
                string szCodeName = "";
                for (int m = 0; vtCodingTable != null && m < vtCodingTable.Length; m++)
                {
                    if (vtCodingTable[m].szCodeSN == szLabCode)
                    {
                        szCodeName = vtCodingTable[m].szCodeName;
                    }
                }
                m_szOut += "<td >" + szCodeName + "</td>";//类型
                m_szOut += "<td class='thCenter'><div class='OPTD OPTDBtnRec'></div></td>";
                m_szOut += "</tr>";
            }
        }
        PutBackValue();
    }
Ejemplo n.º 10
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        UNIROOM newRoom;
        uint?   uMax = 0;
        uint    uID  = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET;

        if (GetMaxValue(ref uMax, uID, "szRoomNo"))
        {
        }
        UNICAMPUS[] vtCamp = GetAllCampus();
        for (int i = 0; i < vtCamp.Length; i++)
        {
            szCamp += GetInputItemHtml(CONSTHTML.option, "", vtCamp[i].szCampusName, vtCamp[i].dwCampusID.ToString());
        }
        if (IsPostBack)
        {
            GetHTTPObj(out newRoom);
            string szManMode = Request["dwManMode"];
            string scprop    = Request["scprop"];
            uint   usxprop   = CharListToUint(scprop);

            newRoom.dwManMode = CharListToUint(szManMode);
            if (newRoom.dwManGroupID == null || newRoom.dwManGroupID.ToString() == "0")
            {
                UNIGROUP newGroup = new UNIGROUP();
                if (!NewGroup(newRoom.szRoomName + "管理员组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newGroup))
                {
                    MessageBox(m_Request.szErrMessage, "修改区域失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    DelGroup(newGroup.dwGroupID);
                    return;
                }
                newRoom.dwManGroupID = newGroup.dwGroupID;
            }
            UNILAB setLab = new UNILAB();
            setLab.dwLabID      = newRoom.dwLabID;
            setLab.dwManGroupID = newRoom.dwManGroupID;
            setLab.dwDeptID     = newRoom.dwDeptID;
            setLab.szDeptName   = newRoom.szDeptName;
            setLab.szLabName    = newRoom.szRoomName;
            setLab.szLabSN      = newRoom.szRoomNo;
            setLab.dwLabClass   = newRoom.dwInClassKind;

            newRoom.dwCampusID = Parse(Request["dwCampusID"]);

            uint        uLabID   = 0;
            REQUESTCODE uRespnse = REQUESTCODE.DBERR_FAILED;
            if (ConfigConst.GCICLabRoom == 1)
            {
                uRespnse = REQUESTCODE.EXECUTE_SUCCESS;
                uLabID   = Parse(Request["dwLabID"]);
            }
            else
            {
                uRespnse = m_Request.Device.LabSet(setLab, out setLab);
                if (uRespnse != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, "修改区域失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                }
            }
            if (uRespnse == REQUESTCODE.EXECUTE_SUCCESS)
            {
                newRoom.dwLabID = uLabID;
                uint uPropMode = 0;
                if (newRoom.dwProperty != null)
                {
                    uPropMode = (uint)newRoom.dwProperty;
                }
                uPropMode          = uPropMode | Parse(Request["propyMode"]) | Parse(Request["prop"]);
                uPropMode          = uPropMode | usxprop;
                newRoom.dwProperty = uPropMode;
                newRoom.szFloorNo  = (Parse(Request["floorNOPre"]) * 1000 + Parse(Request["floorNONext"])).ToString();
                if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, "修改区域失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                }
                else
                {
                    MessageBox("修改区域成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                    return;
                }
            }
        }
        DOORCTRLREQ vrParameter = new DOORCTRLREQ();
        uint        uRoomMode   = (uint)(UNIROOM.DWMANMODE.ROOMMAN_CAMERA | UNIROOM.DWMANMODE.ROOMMAN_DOORLOCK | UNIROOM.DWMANMODE.ROOMMAN_FREEINOUT);

        m_szRoomMode          = GetInputHtml(uRoomMode, CONSTHTML.checkBox, "dwManMode", "Room_dwManMode");
        vrParameter.dwDCSKind = (uint)UNIDOORCTRL.DWCTRLKIND.DCKIND_ROOM;
        vrParameter.dwGetType = (uint)DOORCTRLREQ.DWGETTYPE.DOORCTRLGET_BYALL;

        UNILAB[] vtLab = GetAllLab();
        if (vtLab != null && vtLab.Length > 0)
        {
            for (int i = 0; i < vtLab.Length; i++)
            {
                m_szLab += "<option value='" + vtLab[i].dwLabID + "'>" + vtLab[i].szLabName + "</option>";
            }
        }
        DEVOPENRULE[] vtOpenRule = GetAllOpenRule();
        if (vtOpenRule != null && vtOpenRule.Length > 0)
        {
            for (int i = 0; i < vtOpenRule.Length; i++)
            {
                m_szOpenRule += "<option value='" + vtOpenRule[i].dwRuleSN + "'>" + vtOpenRule[i].szRuleName + "</option>";
            }
        }

        if (Request["op"] == "set")
        {
            bSet = true;

            ROOMREQ vrRoomReq = new ROOMREQ();
            vrRoomReq.dwRoomID = ToUint(Request["roomid"]);
            UNIROOM[] vtRoom;
            if (m_Request.Device.RoomGet(vrRoomReq, out vtRoom) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
            }
            else
            {
                if (vtRoom.Length == 0)
                {
                    MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
                }
                else
                {
                    PutJSObj(vtRoom[0]);
                    m_Title = "修改【" + vtRoom[0].szRoomName + "】";
                    uint uRoomProp = (uint)vtRoom[0].dwProperty;
                    uint uRoomPrp2 = (uint)vtRoom[0].dwProperty;
                    uint uPropMode = 0;
                    if ((uRoomProp & ((uint)UNIROOM.DWPROPERTY.ROOMPROPHP_AUTOGATE)) > 0)
                    {
                        uPropMode = (uint)UNIROOM.DWPROPERTY.ROOMPROPHP_AUTOGATE;
                    }
                    else if ((uRoomProp & ((uint)UNIROOM.DWPROPERTY.ROOMPROPHP_IP)) > 0)
                    {
                        uPropMode = (uint)UNIROOM.DWPROPERTY.ROOMPROPHP_IP;
                    }
                    if (vtRoom[0].szFloorNo != null)
                    {
                        uint uFloorNo = Parse((vtRoom[0].szFloorNo));
                        PutMemberValue("floorNOPre", (uFloorNo / 1000).ToString());
                        PutMemberValue("floorNONext", (uFloorNo % 1000).ToString());
                    }
                    PutMemberValue("propyMode", uPropMode.ToString());
                    PutMemberValue("prop", (uRoomProp & 0x800000).ToString());
                    PutMemberValue("noresv", (uRoomPrp2 & 16).ToString());
                    PutMemberValue("nocheck", (uRoomPrp2 & 32).ToString());
                    PutMemberValue("noleaveout", (uRoomProp & 64).ToString());
                    PutMemberValue("noend", (uRoomPrp2 & 128).ToString());
                }
            }
        }
        else
        {
            UNISTATION station = new UNISTATION();
            station.dwStaSN = uMax;
            PutJSObj(station);
            m_Title = "新建区域";
        }
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string szOpName = "新建";

        if (Request["op"] == "set")
        {
            bSet     = true;
            szOpName = "修改";
        }
        UNIROOM newRoom;

        CODINGTABLE[] vtCodeTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_LABKIND);
        if (vtCodeTable != null && vtCodeTable.Length > 0)
        {
            for (int i = 0; i < vtCodeTable.Length; i++)
            {
                m_szLabKind += GetInputItemHtml(CONSTHTML.option, "", vtCodeTable[i].szCodeName, vtCodeTable[i].szCodeSN.ToString());
            }
        }
        vtCodeTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_LABFROM);
        if (vtCodeTable != null && vtCodeTable.Length > 0)
        {
            for (int i = 0; i < vtCodeTable.Length; i++)
            {
                m_szLabFromCode += GetInputItemHtml(CONSTHTML.option, "", vtCodeTable[i].szCodeName, vtCodeTable[i].szCodeSN.ToString());
            }
        }
        vtCodeTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_ACADEMICSUBJECT);
        if (vtCodeTable != null && vtCodeTable.Length > 0)
        {
            for (int i = 0; i < vtCodeTable.Length; i++)
            {
                m_dwDecam += GetInputItemHtml(CONSTHTML.option, "", vtCodeTable[i].szCodeName, vtCodeTable[i].szCodeSN.ToString());
            }
        }
        vtCodeTable = getCodeTableByType((uint)CODINGTABLE.DWCODETYPE.CODE_LABLEVEL);
        if (vtCodeTable != null && vtCodeTable.Length > 0)
        {
            for (int i = 0; i < vtCodeTable.Length; i++)
            {
                m_szLabLevelCode += GetInputItemHtml(CONSTHTML.option, "", vtCodeTable[i].szCodeName, vtCodeTable[i].szCodeSN.ToString());
            }
        }

        if (IsPostBack)
        {
            GetHTTPObj(out newRoom);
            UNILAB setLab = new UNILAB();
            GetHTTPObj(out setLab);
            string szManMode = Request["dwManMode"];
            newRoom.dwManMode = CharListToUint(szManMode);
            if (bSet == true)
            {
                UNIGROUP newGroup = new UNIGROUP();
                if (!NewGroup(newRoom.szRoomName + "管理员组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newGroup))
                {
                    MessageBox(m_Request.szErrMessage, "新建实验室失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    DelGroup(newGroup.dwGroupID);
                    return;
                }
                newRoom.dwManGroupID = newGroup.dwGroupID;
                setLab.dwManGroupID  = newGroup.dwGroupID;
            }
            CAMPUSREQ campGet = new CAMPUSREQ();

            setLab.dwDeptID   = newRoom.dwDeptID;
            setLab.szDeptName = newRoom.szDeptName;
            setLab.szLabName  = newRoom.szRoomName;
            setLab.szLabSN    = newRoom.szRoomNo;
            setLab.dwLabClass = newRoom.dwInClassKind;
            UNICAMPUS[] vtCampres;
            if (!bSet)
            {
                if (m_Request.Account.CampusGet(campGet, out vtCampres) == REQUESTCODE.EXECUTE_SUCCESS && vtCampres != null && vtCampres.Length > 0)
                {
                    newRoom.dwCampusID = vtCampres[0].dwCampusID;
                }
            }
            if (m_Request.Device.LabSet(setLab, out setLab) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, szOpName + "实验室失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
            }
            else
            {
                if (Request["dwRoomSize"] != null && newRoom.dwRoomSize != null)
                {
                    newRoom.dwRoomSize = (uint)newRoom.dwRoomSize;
                }
                newRoom.dwLabID = setLab.dwLabID;
                if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS)
                {
                    MessageBox(m_Request.szErrMessage, szOpName + "实验室失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                    m_Request.Device.LabDel(setLab);
                }
                else
                {
                    UNIDEVICE[] devTempList = GetDevByRoomId(newRoom.dwRoomID);
                    bool        bIsAllNew   = false;
                    if (devTempList != null && devTempList.Length == 1)
                    {
                        bIsAllNew = true;
                    }
                    string szNewDevic = Request["chkNewDev"];
                    if (szNewDevic != null && szNewDevic == "1")
                    {
                        UNIDEVCLS newDevCls = new UNIDEVCLS();
                        if (bIsAllNew)
                        {
                            newDevCls.dwClassID = devTempList[0].dwClassID;
                        }
                        newDevCls.dwKind      = (uint)UNIDEVCLS.DWKIND.CLSKIND_COMMONS;
                        newDevCls.szClassName = setLab.szLabName;
                        if (m_Request.Device.DevClsSet(newDevCls, out newDevCls) == REQUESTCODE.EXECUTE_SUCCESS)
                        {
                            UNIDEVKIND newDevKind = new UNIDEVKIND();
                            if (bIsAllNew)
                            {
                                newDevKind.dwKindID = devTempList[0].dwKindID;
                            }
                            newDevKind.dwClassID  = newDevCls.dwClassID;
                            newDevKind.szKindName = setLab.szLabName;
                            newDevKind.dwMaxUsers = 1;
                            newDevKind.dwMinUsers = 1;
                            if (m_Request.Device.DevKindSet(newDevKind, out newDevKind) == REQUESTCODE.EXECUTE_SUCCESS)
                            {
                                UNIDEVICE newDevAll = new UNIDEVICE();
                                if (bIsAllNew)
                                {
                                    newDevAll.dwDevID = devTempList[0].dwDevID;
                                }
                                else
                                {
                                    newDevAll.dwDevSN    = GetDevSN();
                                    newDevAll.szAssertSN = GetDevSN().ToString();
                                }
                                newDevAll.szDevName = newDevKind.szKindName;
                                newDevAll.dwKindID  = newDevKind.dwKindID;
                                newDevAll.dwRoomID  = newRoom.dwRoomID;

                                if (m_Request.Device.Set(newDevAll, out newDevAll) == REQUESTCODE.EXECUTE_SUCCESS)
                                {
                                    MessageBox(szOpName + "实验室成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                                    return;
                                }
                                else
                                {
                                    MessageBox(m_Request.szErrMessage, szOpName + "实验室失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                                    m_Request.Device.DevClsDel(newDevCls);
                                    m_Request.Device.LabDel(setLab);
                                    m_Request.Device.RoomDel(newRoom);
                                    m_Request.Device.DevKindDel(newDevKind);
                                }
                            }
                            else
                            {
                                m_Request.Device.DevClsDel(newDevCls);
                                m_Request.Device.LabDel(setLab);
                                m_Request.Device.RoomDel(newRoom);
                                MessageBox(m_Request.szErrMessage, szOpName + "实验室失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE);
                            }
                        }

                        return;
                    }
                    MessageBox(szOpName + "实验室成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK);
                    if (Session["LoginResult"] != null)
                    {
                        ADMINLOGINRES admin = (ADMINLOGINRES)Session["LoginResult"];
                        if (!bSet)
                        {
                            AddGroupMember(newRoom.dwManGroupID, admin.AdminInfo.dwAccNo, (uint)GROUPMEMBER.DWKIND.MEMBERKIND_PERSONAL);
                        }
                    }
                    return;
                }
            }
        }
        uint uRoomMode = (uint)(UNIROOM.DWMANMODE.ROOMMAN_CAMERA | UNIROOM.DWMANMODE.ROOMMAN_DOORLOCK | UNIROOM.DWMANMODE.ROOMMAN_FREEINOUT);

        m_szRoomMode = GetInputHtml(uRoomMode, CONSTHTML.checkBox, "dwManMode", "Room_dwManMode");
        UNILAB[] vtLab = GetAllLab();
        if (vtLab != null && vtLab.Length > 0)
        {
            for (int i = 0; i < vtLab.Length; i++)
            {
                m_szLab += "<option value='" + vtLab[i].dwLabID + "'>" + vtLab[i].szLabName + "</option>";
            }
        }
        DEVOPENRULE[] vtOpenRule = GetAllOpenRule();
        if (vtOpenRule != null && vtOpenRule.Length > 0)
        {
            for (int i = 0; i < vtOpenRule.Length; i++)
            {
                m_szOpenRule += "<option value='" + vtOpenRule[i].dwRuleSN + "'>" + vtOpenRule[i].szRuleName + "</option>";
            }
        }

        if (Request["op"] == "set")
        {
            ROOMREQ vrRoomReq = new ROOMREQ();
            vrRoomReq.dwRoomID = ToUint(Request["roomid"]);
            UNIROOM[] vtRoom;
            if (m_Request.Device.RoomGet(vrRoomReq, out vtRoom) != REQUESTCODE.EXECUTE_SUCCESS)
            {
                MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
            }
            else
            {
                if (vtRoom.Length == 0)
                {
                    MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL);
                }
                else
                {
                    PutJSObj(vtRoom[0]);
                    UNIDEVICE[] devList = GetDevByRoomId(vtRoom[0].dwRoomID);
                    if (devList != null && devList.Length == 1)
                    {
                        PutMemberValue("chkNewDev", "1");
                    }
                    m_Title = "修改【" + vtRoom[0].szRoomName + "】";
                }
            }
        }
        else
        {
            UNISTATION station = new UNISTATION();
            //station.dwStaSN = uMax;
            PutJSObj(station);
            m_Title = szOpName + "实验室";
        }
    }
Ejemplo n.º 12
0
    private void SyRoom(DataSet dsTable)
    {
        int            uAll        = 0;
        int            uUnSy       = 0;
        int            uADD        = 0;
        int            uAddSuccse  = 0;
        int            uAddFail    = 0;
        int            uSet        = 0;
        int            uSetSuccse  = 0;
        int            uSetFail    = 0;
        DEVOPENRULE    setOpenRule = new DEVOPENRULE();
        DEVOPENRULEREQ vrOpenRule  = new DEVOPENRULEREQ();

        DEVOPENRULE[] devOpenRule;
        if (m_Request.Device.DevOpenRuleGet(vrOpenRule, out devOpenRule) == REQUESTCODE.EXECUTE_SUCCESS && devOpenRule != null && devOpenRule.Length > 0)
        {
            setOpenRule = devOpenRule[0];
        }
        else
        {
            Logger.trace("对应的开放规则不存在");
        }
        UNICAMPUS[]   camp        = GetAllCampus();
        UNIBUILDING[] allBuilding = getAllBuilding();
        UNIDEPT[]     allDept     = GetAllDept();
        UNIROOM[]     allRoom     = GetAllRoom();
        UNILAB[]      allLab      = GetAllLab();
        UNIDEVCLS[]   allDevClass = GetAllDevCls();
        UNIDEVKIND[]  allDevKind  = GetAllDevKind();
        UNIDEVICE[]   allDev;
        GetAllDev(out allDev);
        if (camp == null || camp.Length == 0)
        {
            Logger.trace("校区内容为空 不同步房间");
            return;
        }
        if (allLab == null || allLab.Length == 0)
        {
            Logger.trace("实验室内容为空 不同步房间");
            return;
        }
        if (allBuilding == null || allBuilding.Length == 0)
        {
            Logger.trace("楼宇内容为空 不同步房间");
            return;
        }
        if (allDevClass == null || allDevClass.Length == 0)
        {
            Logger.trace("楼宇类型为空 不同步房间");
            return;
        }
        DataTable dtRoom = new DataTable();

        dtRoom = dsTable.Tables[0];
        uAll   = dtRoom.Rows.Count;
        Logger.trace("allroomList" + allRoom.Length);
        for (int op = 0; op < allRoom.Length; op++)
        {
            UNIROOM setRoom = new UNIROOM();
            setRoom = allRoom[op];
            if (setRoom.dwBuildingID != null && setRoom.dwBuildingID.ToString() != "" && setRoom.dwBuildingID.ToString() != "0")
            {
                continue;
            }
            Logger.trace("房间需要设置楼宇" + setRoom.szRoomName);
            string szRoomNameObj = setRoom.szRoomName;
            for (int i = 0; i < dtRoom.Rows.Count; i++)
            {
                string szRoomName = "";
                if (dtRoom.Rows[i]["room_name"] != null)
                {
                    szRoomName = dtRoom.Rows[i]["room_name"].ToString();
                }
                string szRoomNo = "";
                if (dtRoom.Rows[i]["room_no"] != null)
                {
                    szRoomNo = dtRoom.Rows[i]["room_no"].ToString();
                }
                if (!(szRoomName.IndexOf(szRoomNo) > -1))
                {
                    szRoomName = szRoomName + szRoomNo;
                }
                string szBulidingName = "";
                if (szRoomNameObj == szRoomName)
                {
                    szBulidingName = dtRoom.Rows[i]["house_name"].ToString();
                }
                bool bRead = false;
                if (szBulidingName != "")
                {
                    Logger.trace("房间需要设置楼宇" + setRoom.szRoomName + szBulidingName);
                    for (int n = 0; n < allBuilding.Length; n++)
                    {
                        if (szBulidingName == allBuilding[n].szBuildingName.ToString())
                        {
                            Logger.trace("找到对应房间需要设置楼宇" + setRoom.szRoomName + szBulidingName);
                            setRoom.dwBuildingID = allBuilding[n].dwBuildingID;
                            m_Request.Device.RoomSet(setRoom, out setRoom);
                            Logger.trace("房间所在楼宇设置成功");
                            bRead = true;
                            break;
                        }
                    }
                }
                if (bRead)
                {
                    break;
                }
            }
        }
        // return;


        Logger.trace("dtRoom.Rows.Count.ToString()" + dtRoom.Rows.Count.ToString());
        for (int i = 0; i < dtRoom.Rows.Count; i++)
        {
            string szRoomName = "";
            if (dtRoom.Rows[i]["room_name"] != null)
            {
                szRoomName = dtRoom.Rows[i]["room_name"].ToString();
            }
            string szRoomNo = "";
            if (dtRoom.Rows[i]["room_no"] != null)
            {
                szRoomNo = dtRoom.Rows[i]["room_no"].ToString();
            }
            if (!(szRoomName.IndexOf(szRoomNo) > -1))
            {
                szRoomName = szRoomName + szRoomNo;
            }
            string szRoomNameCamp = szRoomName + "(" + dtRoom.Rows[i]["campus_name"].ToString() + ")";
            bool   bbread         = false;
            for (int j = 0; j < allRoom.Length; j++)
            {
                UNIROOM setRoom = new UNIROOM();

                setRoom = allRoom[j];
                //Logger.trace("房间所在楼宇设置已存在"+setRoom.szRoomName);
                if (setRoom.dwBuildingID != null)
                {
                    //Logger.trace("房间所在楼宇设置已存在");
                    continue;
                }
                if (GetRoomByName(szRoomName, out setRoom))
                {
                    // Logger.trace("房间所在楼宇设置开始" + setRoom.szRoomName);

                    string szBuilding = dtRoom.Rows[i]["house_name"].ToString();
                    for (int n = 0; n < allBuilding.Length; n++)
                    {
                        if (szBuilding == allBuilding[n].szBuildingName.ToString())
                        {
                            Logger.trace("找到房间所在楼宇设置开始" + setRoom.szRoomName);
                            setRoom.dwBuildingID = allBuilding[n].dwBuildingID;
                            m_Request.Device.RoomSet(setRoom, out setRoom);
                            // Logger.trace("房间所在楼宇设置成功");
                            break;
                        }
                    }
                }
                else
                {
                    //  szRoomName = szRoomName + "(" + dtRoom.Rows[i]["campus_name"].ToString() + ")";
                    string szBuilding = dtRoom.Rows[i]["house_name"].ToString();
                    if (GetRoomByName(szRoomNameCamp, out setRoom))
                    {
                    }
                }
                if (bbread)
                {
                    break;
                }
            }
        }
        //return;
        //
        for (int i = 0; i < dtRoom.Rows.Count; i++)
        {
            string szCampName = "";
            if (dtRoom.Rows[i]["campus_name"] != null)
            {
                szCampName = dtRoom.Rows[i]["campus_name"].ToString();
            }
            string szDeptName = "";
            if (dtRoom.Rows[i]["department_name"] != null)
            {
                szDeptName = dtRoom.Rows[i]["department_name"].ToString();
            }
            if (szDeptName == "")
            {
                uUnSy = uUnSy + 1;
                Logger.trace("房间对应的实验室名称为空 不同步房间,第三方部门名称:" + dtRoom.Rows[i]["room_name"].ToString() + "保存为其他" + szDeptName);
                szDeptName = "上海财经大学";
                //continue;
            }
            string szBuidlName = "";
            if (dtRoom.Rows[i]["house_name"] != null)
            {
                szBuidlName = dtRoom.Rows[i]["house_name"].ToString();
            }
            if (szBuidlName == "")
            {
                uUnSy = uUnSy + 1;
                Logger.trace("房间对应的楼宇名称为空 不同步房间,第三方房间名称:" + szBuidlName);
                continue;
            }
            UNILAB setLab      = new UNILAB();
            UNILAB setOtherLab = new UNILAB();
            for (int m = 0; m < allLab.Length; m++)
            {
                if (allLab[m].szLabName.ToString() == szDeptName)
                {
                    setLab = allLab[m];
                    break;
                }
                if (allLab[m].szLabName.ToString() == "其他")
                {
                    setOtherLab = allLab[m];
                }
            }
            if (setLab.dwLabID == null)
            {
                if (setOtherLab.dwLabID != null)
                {
                    setLab = setOtherLab;
                }
                else
                {
                    /*
                     * UNILAB tempLab;
                     * if (GetLabByID(100661724, out tempLab))
                     * {
                     *  uUnSy = uUnSy + 1;
                     *  Logger.trace("房间对应的实验室不存在 不同步房间,第三方部门名称:" + szDeptName);
                     *  setLab = tempLab;
                     * }
                     */
                    uUnSy = uUnSy + 1;
                    Logger.trace("房间对应的实验室不存在 不同步房间,第三方部门名称:" + szDeptName);
                    continue;
                }
            }
            UNIBUILDING setBuliding = new UNIBUILDING();
            for (int m = 0; m < allBuilding.Length; m++)
            {
                if (allBuilding[m].szBuildingName.ToString() == szBuidlName)
                {
                    setBuliding = allBuilding[m];
                    break;
                }
            }
            if (setBuliding.dwBuildingID == null)
            {
                uUnSy = uUnSy + 1;
                Logger.trace("房间对应的楼宇名称为空 不同步房间,第三方房间名称:" + szBuidlName);
                continue;
            }
            string szDevClssName = "";
            if (dtRoom.Rows[i]["classroom_type_name"] != null)
            {
                if (dtRoom.Rows[i]["classroom_type_name"].ToString() == "")
                {
                    szDevClssName = "空白";
                }
                else
                {
                    szDevClssName = dtRoom.Rows[i]["classroom_type_name"].ToString();
                }
            }
            UNIDEVCLS setDevClass = new UNIDEVCLS();
            for (int m = 0; m < allDevClass.Length; m++)
            {
                if (allDevClass[m].szClassName.ToString() == szDevClssName)
                {
                    setDevClass = allDevClass[m];
                    break;
                }
            }
            if (setDevClass.dwClassID == null)
            {
                uUnSy = uUnSy + 1;
                Logger.trace("房间对应的类型不存在 不同步房间:" + szDevClssName);
                continue;
            }

            string szRoomName = "";
            if (dtRoom.Rows[i]["room_name"] != null)
            {
                szRoomName = dtRoom.Rows[i]["room_name"].ToString();
            }

            uint uMaxUser = 1;
            if (dtRoom.Rows[i]["seat_amt"] != null)
            {
                uMaxUser = Parse(dtRoom.Rows[i]["seat_amt"].ToString());
            }
            string szRoomNo = "";
            if (dtRoom.Rows[i]["room_no"] != null)
            {
                szRoomNo = dtRoom.Rows[i]["room_no"].ToString();
            }
            if (!(szRoomName.IndexOf(szRoomNo) > -1))
            {
                szRoomName = szRoomName + szRoomNo;
            }
            UNIDEVKIND setDevKind         = new UNIDEVKIND();
            UNIDEVKIND setDevKindCampName = new UNIDEVKIND();
            bool       bAddKind           = true;
            bool       bAddKindCampName   = true;
            for (int m = 0; allDevKind != null && m < allDevKind.Length; m++)
            {
                if (allDevKind[m].szProducer == dtRoom.Rows[i]["room_code"].ToString())
                {
                    for (int k = 0; k < allDevKind.Length; k++)
                    {
                        if (allDevKind[k].szKindName == szRoomName)
                        {
                            bAddKind         = false;
                            bAddKindCampName = false;
                            setDevKind       = allDevKind[k];
                            break;
                        }
                    }
                }
            }
            if (bAddKind)
            {
                setDevKind.dwClassID  = setDevClass.dwClassID;
                setDevKind.dwMaxUsers = uMaxUser;
                setDevKind.dwMinUsers = 1;
                setDevKind.szKindName = szRoomName;
                setDevKind.szProducer = dtRoom.Rows[i]["room_code"].ToString();
                setDevKind.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE;
                setDevKindCampName    = setDevKind;
                if (m_Request.Device.DevKindSet(setDevKind, out setDevKind) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    //uAddSuccse = uAddSuccse + 1;
                    Logger.trace("房间对应的类型新建成功:" + szRoomName);
                    allDevKind = GetAllDevKind();
                }
                else
                {
                    // uAddFail = uAddFail + 1;
                    Logger.trace("房间对应的类型新建失败:" + m_Request.szErrMessage.ToString());
                    if (m_Request.szErrMessage.ToString().IndexOf("已存在") > -1)
                    {
                        szRoomName            = szRoomName + "(" + szCampName + ")";
                        setDevKind.szKindName = szRoomName;
                        if (m_Request.Device.DevKindSet(setDevKindCampName, out setDevKindCampName) == REQUESTCODE.EXECUTE_SUCCESS)
                        {
                            Logger.trace("房间对应的类型新建成功-添加校区名:" + szRoomName);
                            allDevKind = GetAllDevKind();
                        }
                        else
                        {
                            Logger.trace("房间对应的类型新建失败-添加校区名:" + szRoomName);
                            continue;
                        }
                    }
                }
            }
            else
            {
                if (!((((uint)setDevKind.dwProperty) & (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_SHARE) > 0))
                {
                    if (uMaxUser > 0)
                    {
                        setDevKind.dwMaxUsers = uMaxUser;
                    }
                    else
                    {
                        setDevKind.dwMaxUsers = 1;
                    }
                    setDevKind.dwMinUsers = 1;
                    setDevKind.dwMaxUsers = uMaxUser;
                    setDevKind.szProducer = dtRoom.Rows[i]["room_code"].ToString();
                    if (m_Request.Device.DevKindSet(setDevKind, out setDevKind) == REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        Logger.trace(setDevKind.dwKindID + "房间类型修改成功:" + setDevKind.dwMaxUsers + szRoomName);

                        allDevKind = GetAllDevKind();
                    }
                    else
                    {
                        Logger.trace("房间类型修改失败:" + m_Request.szErrMessage + szRoomName);
                    }
                }
                else
                {
                    setDevKind.dwMinUsers = 1;
                    setDevKind.szProducer = dtRoom.Rows[i]["room_code"].ToString();

                    setDevKind.szKindName = szRoomName;
                    if (m_Request.Device.DevKindSet(setDevKind, out setDevKind) == REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        Logger.trace("房间类型修改成功:" + szRoomName);
                        allDevKind = GetAllDevKind();
                    }
                    else
                    {
                        Logger.trace("房间类型修改失败:" + m_Request.szErrMessage + szRoomName);
                    }
                }
                //  uSet = uSet + 1;
            }
            string szRoomCode = "";
            if (dtRoom.Rows[i]["room_code"] != null)
            {
                szRoomCode = dtRoom.Rows[i]["room_code"].ToString();
            }
            uint uRoomSize = 0;
            if (dtRoom.Rows[i]["build_area"] != null)
            {
                uRoomSize = Parse(dtRoom.Rows[i]["build_area"].ToString());
            }
            UNIROOM newRoom         = new UNIROOM();
            UNIROOM newRoomCampName = new UNIROOM();
            bool    bNewRoom        = true;
            UNIROOM bExistRoom      = new UNIROOM();
            for (int k = 0; k < allRoom.Length; k++)
            {
                if (allRoom[k].szRoomNo == szRoomCode)
                {
                    //if (allRoom[k].szRoomNo == szRoomCode)
                    {
                        bExistRoom = allRoom[k];
                        bNewRoom   = false;
                        break;
                    }
                }
            }
            if (!bNewRoom)
            {
                uint   uOldBuilding = (uint)bExistRoom.dwBuildingID;
                string szOldName    = bExistRoom.szRoomName;
                if (bExistRoom.dwBuildingID != setBuliding.dwBuildingID)
                {
                    bExistRoom.dwBuildingID = setBuliding.dwBuildingID;
                    if (m_Request.Device.RoomSet(bExistRoom, out bExistRoom) == REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        Logger.trace("房间所在楼宇变动" + uOldBuilding.ToString() + "改为" + setBuliding.dwBuildingID.ToString());
                    }
                }
                if (bExistRoom.szRoomName != szRoomName)
                {
                    bExistRoom.szRoomName   = szRoomName;
                    bExistRoom.dwBuildingID = setBuliding.dwBuildingID;
                    if (m_Request.Device.RoomSet(bExistRoom, out bExistRoom) == REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        Logger.trace("房间名称变动" + szOldName.ToString() + "改为" + szRoomName.ToString());
                    }
                }
            }
            if (bNewRoom)
            {
                newRoom.szRoomName   = szRoomName;
                newRoom.dwBuildingID = setBuliding.dwBuildingID;
                //newRoom.dwCampusID = setBuliding.dwCampusID;
                newRoom.dwCampusID = Parse(dtRoom.Rows[i]["CAMPUS_CODE"].ToString());
                newRoom.dwLabID    = setLab.dwLabID;

                newRoom.dwRoomSize = uRoomSize;
                newRoom.szRoomNo   = szRoomCode;
                DEVOPENRULE newOpenRule = new DEVOPENRULE();
                if (newOpenRuleSN(setOpenRule, out newOpenRule, szRoomName))
                {
                    newRoom.dwOpenRuleSN = newOpenRule.dwRuleSN;
                }
                else
                {
                    Logger.trace("开放规则新建成功:" + m_Request.szErrMessage);
                    newRoom.dwOpenRuleSN = setOpenRule.dwRuleSN;
                }
                UNIGROUP manGroup = new UNIGROUP();
                if (NewGroup(szRoomName, (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out manGroup))
                {
                    Logger.trace("房间对应的管理员新建成功:");
                    newRoom.dwManGroupID = manGroup.dwGroupID;
                }
                else
                {
                    Logger.trace("房间对应的管理员新建失败" + ";" + m_Request.szErrMessage.ToString());
                    continue;
                }
                newRoomCampName = newRoom;

                if (m_Request.Device.RoomSet(newRoom, out newRoom) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    Logger.trace("房间新建成功" + szRoomName);
                    allRoom = GetAllRoom();
                }
                else
                {
                    uAddFail = uAddFail + 1;
                    Logger.trace("房间新建失败:" + szRoomName + ";" + m_Request.szErrMessage.ToString());
                    szRoomName = szRoomName + "(" + szCampName + ")";
                    newRoomCampName.szRoomName = szRoomName;
                    if (m_Request.szErrMessage.IndexOf("已存在") > -1)
                    {
                        if (m_Request.Device.RoomSet(newRoomCampName, out newRoomCampName) == REQUESTCODE.EXECUTE_SUCCESS)
                        {
                            Logger.trace("房间新建成功" + szRoomName);
                            allRoom = GetAllRoom();
                        }
                        else
                        {
                            Logger.trace("房间新建失败:" + szRoomName + ";" + m_Request.szErrMessage.ToString());

                            continue;
                        }
                    }
                }
            }
            GetAllDev(out allDev);
            UNIDEVICE setDev  = new UNIDEVICE();
            bool      bAddDev = true;
            for (int m = 0; m < allDev.Length; m++)
            {
                if (allDev[m].dwDevSN.ToString() == szRoomCode)
                {
                    setDev  = allDev[m];
                    bAddDev = false;
                    break;
                }
            }
            if (bAddDev)
            {
                setDev.szDevName = szRoomName;
                setDev.dwRoomID  = newRoom.dwRoomID;
                setDev.dwKindID  = setDevKind.dwKindID;
                uint uDevSN = Parse(szRoomCode);
                if (uDevSN == 0)
                {
                    uDevSN = (uint)newRoom.dwRoomID;
                }
                setDev.dwDevSN    = uDevSN;
                setDev.szAssertSN = uDevSN.ToString();
                if (setDev.dwRoomID == null || setDev.dwRoomID == 0)
                {
                    Logger.trace("房间编号为空或者0:" + setDev.szDevName.ToString());
                    continue;
                }
                if (m_Request.Device.Set(setDev, out setDev) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    uAddSuccse = uAddSuccse + 1;
                    Logger.trace("房间新建成功:" + setDev.szDevName.ToString());
                }
                else
                {
                    uAddFail = uAddFail + 1;
                    Logger.trace("房间新建失败:" + szRoomName + m_Request.szErrMessage.ToString());
                }
            }
            else
            {
                setDev.dwRoomID = newRoom.dwRoomID;
                setDev.dwKindID = setDevKind.dwKindID;
                uint uDevSN = Parse(szRoomCode);
                if (uDevSN == 0)
                {
                    uDevSN = (uint)newRoom.dwRoomID;
                }
                setDev.dwDevSN    = uDevSN;
                setDev.szDevName  = szRoomName;
                setDev.szAssertSN = uDevSN.ToString();
                if (m_Request.Device.Set(setDev, out setDev) == REQUESTCODE.EXECUTE_SUCCESS)
                {
                    uSetSuccse = uSetSuccse + 1;
                    Logger.trace("房间更新成功:" + setDev.szDevName.ToString());
                }
                else
                {
                    uSetFail = uSetFail + 1;
                    Logger.trace("房间更新失败:" + m_Request.szErrMessage.ToString());
                }
            }
        }
        Logger.trace("房间总共需同步数据:" + uAll + ";新建数据" + uADD + ";新建成功:" + uAddSuccse + ";新建失败:" + uAddFail + ";更新总数据:" + uSet + ";更新成功:" + uSetSuccse + ";更新失败:" + uSetFail);
    }
Ejemplo n.º 13
0
    private void SyLab(UNIDEPT[] deptList)//同步实验室
    {
        UNILAB[] allLab     = GetAllLab();
        int      uAll       = 0;
        int      uADD       = 0;
        int      uAddSuccse = 0;
        int      uAddFail   = 0;
        int      uSet       = 0;
        int      uSetSuccse = 0;
        int      uSetFail   = 0;

        if (deptList != null && deptList.Length > 0)
        {
            uAll = deptList.Length;
            for (int i = 0; i < deptList.Length; i++)
            {
                bool   bAdd       = true;
                UNILAB setLab     = new UNILAB();
                string szDeptName = deptList[i].szName.ToString();
                if (allLab == null || allLab.Length == 0)
                {
                    bAdd = true;
                }
                else
                {
                    for (int j = 0; j < allLab.Length; j++)
                    {
                        if (allLab[j].szLabName.ToString() == szDeptName)
                        {
                            setLab = allLab[j];
                            bAdd   = false;
                            break;
                        }
                    }
                }
                if (bAdd)
                {
                    uADD = uADD + 1;
                    UNIGROUP manGroup = new UNIGROUP();
                    if (NewGroup(deptList[i].szName.ToString(), (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out manGroup))
                    {
                        UNILAB newLab = new UNILAB();
                        newLab.szLabName = deptList[i].szName.ToString();
                        if (deptList[i].szDeptSN != null)
                        {
                            newLab.szLabSN = deptList[i].szDeptSN.ToString();
                        }
                        else
                        {
                            newLab.szLabSN = deptList[i].dwID.ToString();
                        }
                        newLab.dwDeptID     = deptList[i].dwID;
                        newLab.dwManGroupID = manGroup.dwGroupID;
                        string szLabNameTemp = newLab.szLabName.ToString();
                        if (m_Request.Device.LabSet(newLab, out newLab) == REQUESTCODE.EXECUTE_SUCCESS)
                        {
                            uAddSuccse = uAddSuccse + 1;
                            Logger.trace("新建实验室成功" + newLab.szLabName.ToString());
                            allLab = GetAllLab();
                        }
                        else
                        {
                            uAddFail = uAddFail + 1;
                            Logger.trace("新建实验室失败:" + szLabNameTemp + ":" + m_Request.szErrMessage.ToString());
                        }
                    }
                    else
                    {
                        uAddFail = uAddFail + 1;
                        Logger.trace("新建实验室失败:" + deptList[i].szName.ToString() + "管理员组新建失败:" + m_Request.szErrMessage.ToString());
                    }
                }
                else//修改
                {
                    uSet = uSet + 1;
                    if (deptList[i].szDeptSN != null)
                    {
                        setLab.szLabSN = deptList[i].szDeptSN.ToString();
                        if (m_Request.Device.LabSet(setLab, out setLab) == REQUESTCODE.EXECUTE_SUCCESS)
                        {
                            uSetSuccse = uSetSuccse + 1;
                            Logger.trace("更新实验室成功" + setLab.szLabName.ToString());
                        }
                        else
                        {
                            uSetFail = uSetFail + 1;
                            Logger.trace("更新实验室失败:" + deptList[i].szName.ToString() + ":" + m_Request.szErrMessage.ToString());
                        }
                    }
                }
            }
        }
        Logger.trace("实验室总共需同步数据:" + uAll + ";新建数据" + uADD + ";新建成功:" + uAddSuccse + ";新建失败:" + uAddFail + ";更新总数据:" + uSet + ";更新成功:" + uSetSuccse + ";更新失败:" + uSetFail);
    }