protected void Page_Load(object sender, EventArgs e) { for (int i = 1; i < 100; i++) { szOption += GetInputItemHtml(CONSTHTML.option, "", i.ToString(), i.ToString()); } UNIROOM[] allRoom = GetRoomByClassKind((uint)UNIDEVCLS.DWKIND.CLSKIND_COMMONS); for (int i = 0; i < allRoom.Length; i++) { if (!((((uint)allRoom[i].dwProperty) & (uint)UNIROOM.DWPROPERTY.ROOMPROP_COMBINE) > 0)) { szSubRoom += GetInputItemHtml(CONSTHTML.checkBox, "subRoom", allRoom[i].szRoomName, allRoom[i].szRoomNo.ToString()); } } UNICAMPUS[] vtCamp = GetAllCampus(); for (int i = 0; i < vtCamp.Length; i++) { szCamp += GetInputItemHtml(CONSTHTML.option, "", vtCamp[i].szCampusName, vtCamp[i].dwCampusID.ToString()); } UNIDEVICE newDev; uint? uMax = 0; uint uID = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET; if (GetMaxValue(ref uMax, uID, "dwDevSN")) { } if (IsPostBack) { GetHTTPObj(out newDev); // newDev.dwProperty = CharListToUint(Request["dwProperty"]); uint uProperty = CharListToUint(Request["dwProperty2"]); if ((uProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN) > 0) { if (newDev.dwProperty == null) { newDev.dwProperty = 0; } newDev.dwProperty = (uint)newDev.dwProperty | (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN; } string szOpen = Request["chkopen"]; if (newDev.dwProperty == null) { newDev.dwProperty = 0; } if (szOpen != null && szOpen == "1") { newDev.dwProperty = (uint)newDev.dwProperty | (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV; } else { if ((((uint)newDev.dwProperty) & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV) > 0) { newDev.dwProperty = (uint)newDev.dwProperty - (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV; } } newDev.dwManMode = CharListToUint(Request["dwManMode"]); UNIGROUP newUseGroup; if (NewGroup(newDev.szDevName.ToString() + "使用组", (uint)UNIGROUP.DWKIND.GROUPKIND_DEV, out newUseGroup)) { newDev.dwUseGroupID = newUseGroup.dwGroupID; } else { return; } UNIGROUP newManGroup; UNIROOM newRoom = new UNIROOM(); if (NewGroup(newDev.szDevName.ToString() + "管理组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newManGroup)) { newRoom.dwManGroupID = newManGroup.dwGroupID; } else { return; } if (!string.IsNullOrEmpty(newDev.szDevURL)) { newRoom.szMemo = newDev.szDevURL; } newRoom.dwLabID = newDev.dwLabID; newRoom.szRoomNo = newDev.szRoomNo; newRoom.szRoomName = newDev.szDevName; newRoom.dwOpenRuleSN = newDev.dwOpenRuleSN; newRoom.dwCampusID = Parse(Request["dwCampusID"]); string szRoom = Request["subRoom"]; if (szRoom != null && szRoom != "") { newRoom.szSubRooms = szRoom; newRoom.dwProperty = (uint)UNIROOM.DWPROPERTY.ROOMPROP_COMBINE; } else { newRoom.dwProperty = (uint)UNIROOM.DWPROPERTY.ROOMPROP_SUBROOM; } newRoom.dwManMode = newDev.dwManMode; newRoom.dwInClassKind = (uint)UNIDEVCLS.DWKIND.CLSKIND_COMMONS; for (int i = 0; i < allRoom.Length; i++) { string szRoomNameTemp = newRoom.szRoomName; string szRoomNoTemp = newRoom.szRoomNo.ToString(); if (allRoom[i].szRoomName == szRoomNameTemp) { MessageBox("房间名称已存在", "新建" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } if (allRoom[i].szRoomNo == szRoomNoTemp) { MessageBox("编号已存在", "新建" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } } if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "新建" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { newDev.dwRoomID = newRoom.dwRoomID; } uint uDevNum = Parse(Request["devNum"]); for (int i = 0; i < uDevNum; i++) { UNIDEVICE devTemp = new UNIDEVICE(); devTemp = newDev; devTemp.dwDevSN = GetDevSN(); if (uDevNum > 1) { devTemp.szDevName = devTemp.szDevName + (i + 1).ToString(); } if (m_Request.Device.Set(devTemp, out devTemp) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "新建" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { MessageBox("新建" + ConfigConst.GCSysKindRoom + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); UNIACCOUNT accInfo; if (newDev.dwAttendantID != null && GetAccByAccno(newDev.dwAttendantID.ToString(), out accInfo) == true) { DEVATTENDANT devAttendSet = new DEVATTENDANT(); devAttendSet.dwAttendantID = accInfo.dwAccNo; devAttendSet.szAttendantName = accInfo.szTrueName; devAttendSet.szAttendantTel = Request["szAttendantTel"]; devAttendSet.dwDevID = devTemp.dwDevID; devAttendSet.dwLabID = devTemp.dwLabID; m_Request.Device.AttendantSet(devAttendSet); } } } 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"); 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>"; } } m_szCtrlMode = GetAllInputHtml(CONSTHTML.option, "", "UNIDEVICE_CtrlMode"); UNIADMIN[] adminlist; if (GetAdmin(out adminlist) == true) { for (int i = 0; i < adminlist.Length; i++) { m_szManager += "<option value='" + adminlist[i].dwAccNo.ToString() + "'>" + adminlist[i].szTrueName + "</option>"; } } UNILAB[] vtLab = GetLabByClass((uint)UNIDEVCLS.DWKIND.CLSKIND_COMMONS); 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>"; } } m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true); if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); m_Title = "修改【" + vtDev[0].szPCName + "】"; } } } else { m_Title = "新建" + ConfigConst.GCSysKindRoom; } }
protected void Page_Load(object sender, EventArgs e) { UNIDEVICE newDev; uint? uMax = 0; uint uID = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET; if (GetMaxValue(ref uMax, uID, "dwDevSN")) { } if (IsPostBack) { GetHTTPObj(out newDev); newDev.dwProperty = CharListToUint(Request["dwProperty"]); newDev.dwPurchaseDate = DateToUint(Request["dwPurchaseDate"]); ViewState["dwPurchaseDate "] = Get1970Date((uint)newDev.dwPurchaseDate); newDev.szExtInfo = GetDevExt(); if (m_Request.Device.Set(newDev, out newDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCDevName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); } else { MessageBox("修改" + ConfigConst.GCDevName + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); DEVATTENDANT devAttendSet = new DEVATTENDANT(); devAttendSet.dwAttendantID = Parse(Request["dwAttendantID"]); devAttendSet.dwDevID = newDev.dwDevID; devAttendSet.dwLabID = newDev.dwLabID; devAttendSet.szAttendantName = Request["szAttendantName"]; devAttendSet.szAttendantTel = Request["szAttendantTel"]; m_Request.Device.AttendantSet(devAttendSet); return; } } UNIADMIN[] adminlist; if (GetAdmin(out adminlist) == true) { for (int i = 0; i < adminlist.Length; i++) { m_szManager += "<option value='" + adminlist[i].dwAccNo.ToString() + "'>" + adminlist[i].szTrueName + "</option>"; } } m_szCtrlMode = GetAllInputHtml(CONSTHTML.option, "", "UNIDEVICE_CtrlMode"); 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>"; } } m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true); UNIROOM[] vtRoom = GetAllRoom(); if (vtRoom != null && vtRoom.Length > 0) { for (int i = 0; i < vtRoom.Length; i++) { m_szRoom += "<option value='" + vtRoom[i].dwRoomID + "'>" + vtRoom[i].szRoomName + "</option>"; } } UNIDEVKIND[] vtDevKind = GetAllDevKind(); if (vtDevKind != null && vtDevKind.Length > 0) { for (int i = 0; i < vtDevKind.Length; i++) { m_szDevKind += "<option value='" + vtDevKind[i].dwKindID + "'>" + vtDevKind[i].szKindName + "</option>"; } } if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); ContDevExt(vtDev[0].szExtInfo.ToString()); m_Title = "修改【" + vtDev[0].szDevName + "】"; } } } else { m_Title = "新建" + ConfigConst.GCDevName; } }
protected void Page_Load(object sender, EventArgs e) { string szOpExt = ""; if (Request["opext"] == "ff") { szOpExt = "分发"; } if (Request["opext"] == "lc") { szOpExt = "流转"; } if (IsPostBack) { DEVATTENDANT devAttendSet = new DEVATTENDANT(); GetHTTPObj(out devAttendSet); REQUESTCODE uResponse = m_Request.Device.AttendantSet(devAttendSet); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(szOpExt + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); UNIDEVICE dev = new UNIDEVICE(); if (Request.Files.Count > 0 && getDevByID(devAttendSet.dwDevID.ToString(), out dev)) { string fileName = Request.Files["fileurl"].FileName; string szFileExtName = ""; szFileExtName = fileName.Substring(fileName.LastIndexOf('.')); string szTempPath = MyVPath + "Upload/Assert/" + dev.szDevName.ToString() + dev.dwDevID.ToString() + szFileExtName; dev.szDevURL = szTempPath; m_Request.Device.Set(dev, out dev); string szTempRawPath = Server.MapPath(szTempPath); Request.Files[0].SaveAs(szTempRawPath); } } else { MessageBox(m_Request.szErrMessage, szOpExt + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } } if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); m_Title = szOpExt + "【" + vtDev[0].szDevName + "】"; } } } else { m_Title = szOpExt + ""; } }
protected void Page_Load(object sender, EventArgs e) { UNIDEVICE newDev; uint? uMax = 0; uint uID = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET; if (GetMaxValue(ref uMax, uID, "dwDevSN")) { } if (IsPostBack) { GetHTTPObj(out newDev); // newDev.dwDevSN = GetDevSN(); // newDev.dwProperty = CharListToUint(Request["dwProperty"]); uint uProperty = CharListToUint(Request["dwProperty2"]); if ((uProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN) > 0) { if (newDev.dwProperty == null) { newDev.dwProperty = 0; } newDev.dwProperty = (uint)newDev.dwProperty | (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN; } else if (((uProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN) == 0)) { UNIDEVICE devGet; if (getDevByID(newDev.dwDevID.ToString(), out devGet)) { if ((devGet.dwProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN) > 0) { newDev.dwProperty = 0;// (uint)devGet.dwProperty - (uint)UNIDEVICE.DWPROPERTY.DEVPROP_ACTIVITYPLAN; } } } string szOpen = Request["chkopen"]; if (newDev.dwProperty == null) { newDev.dwProperty = 0; } if (szOpen != null && szOpen == "1") { newDev.dwProperty = (uint)newDev.dwProperty | (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV; } else { if ((((uint)newDev.dwProperty) & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV) > 0) { newDev.dwProperty = (uint)newDev.dwProperty - (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV; } } newDev.dwManMode = CharListToUint(Request["dwManMode"]); UNIROOM newRoom = new UNIROOM(); newRoom.dwRoomID = newDev.dwRoomID; newRoom.dwLabID = newDev.dwLabID; newRoom.szRoomNo = newDev.szRoomNo; newRoom.szRoomName = newDev.szDevName; newRoom.dwOpenRuleSN = newDev.dwOpenRuleSN; newRoom.dwManMode = newDev.dwManMode; if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { newDev.dwRoomID = newRoom.dwRoomID; } if (m_Request.Device.Set(newDev, out newDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCSysKindRoom + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { MessageBox("修改" + ConfigConst.GCSysKindRoom + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); UNIACCOUNT accInfo; if (newDev.dwAttendantID != null && GetAccByAccno(newDev.dwAttendantID.ToString(), out accInfo) == true) { DEVATTENDANT devAttendSet = new DEVATTENDANT(); devAttendSet.dwAttendantID = accInfo.dwAccNo; devAttendSet.szAttendantName = accInfo.szTrueName; devAttendSet.szAttendantTel = Request["szAttendantTel"]; devAttendSet.dwDevID = newDev.dwDevID; devAttendSet.dwLabID = newDev.dwLabID; m_Request.Device.AttendantSet(devAttendSet); 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"); 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>"; } } m_szCtrlMode = GetAllInputHtml(CONSTHTML.option, "", "UNIDEVICE_CtrlMode"); UNIADMIN[] adminlist; if (GetAdmin(out adminlist) == true) { for (int i = 0; i < adminlist.Length; i++) { m_szManager += "<option value='" + adminlist[i].dwAccNo.ToString() + "'>" + adminlist[i].szTrueName + "</option>"; } } 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>"; } } m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true); if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); ViewState["dwProperty2"] = vtDev[0].dwProperty; ViewState["chkopen"] = vtDev[0].dwProperty; m_Title = "修改【" + vtDev[0].szDevName + "】"; } } } else { m_Title = "修改" + ConfigConst.GCSysKindRoom; } }
protected void Page_Load(object sender, EventArgs e) { UNIDEVICE newDev; uint? uMax = 0; uint uID = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET; if (GetMaxValue(ref uMax, uID, "dwDevSN")) { } if (IsPostBack) { GetHTTPObj(out newDev); newDev.dwProperty = CharListToUint(Request["dwProperty"]); newDev.dwPurchaseDate = DateToUint(Request["dwPurchaseDate"]); newDev.szExtInfo = GetDevExt(); UNIDEVKIND devKind = new UNIDEVKIND(); if (GetDevKindByID(newDev.dwKindID.ToString(), out devKind)) { devKind.dwClassID = newDev.dwClassID; if (m_Request.Device.DevKindSet(devKind, out devKind) != REQUESTCODE.EXECUTE_SUCCESS) { return; } } //newDev.dwKindID = devKind.dwKindID; if (m_Request.Device.Set(newDev, out newDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCDevName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); } else { /* * if (!NewDevKind(out devKind)) * { * MessageBox(m_Request.szErrMessage, "修改" + ConfigConst.GCDevName + "失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); * return; * } * */ MessageBox("修改" + ConfigConst.GCDevName + "成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); DEVATTENDANT devAttendSet = new DEVATTENDANT(); devAttendSet.dwAttendantID = Parse(Request["dwAttendantID"]); devAttendSet.dwDevID = newDev.dwDevID; devAttendSet.dwLabID = newDev.dwLabID; if (devAttendSet.dwAttendantID != null) { UNIACCOUNT acc; if (GetAccByAccno(devAttendSet.dwAttendantID.ToString(), out acc)) { devAttendSet.szAttendantName = acc.szTrueName; } } devAttendSet.szAttendantTel = Request["szAttendantTel"]; m_Request.Device.AttendantSet(devAttendSet); return; } } m_szCtrlMode = GetAllInputHtml(CONSTHTML.option, "", "UNIDEVICE_CtrlMode"); ACCREQ accGet = new ACCREQ(); accGet.dwIdent = (uint)UNIACCOUNT.DWIDENT.EXTIDENT_MANAGER; UNIACCOUNT[] vtAcc; m_Request.Account.Get(accGet, out vtAcc); if (vtAcc != null && vtAcc.Length > 0) { for (int i = 0; i < vtAcc.Length; i++) { m_szManager += "<option value='" + vtAcc[i].dwAccNo.ToString() + "'>" + vtAcc[i].szTrueName + "</option>"; } } UNIADMIN[] adminlist; if (GetAdmin(out adminlist) == true) { } 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>"; } } UNIROOM[] vtRoom = GetAllRoom(); if (vtRoom != null && vtRoom.Length > 0) { for (int i = 0; i < vtRoom.Length; i++) { m_szRoom += "<option value='" + vtRoom[i].dwRoomID + "'>" + vtRoom[i].szRoomName + "</option>"; } } UNIDEVCLS[] vtDevCls = GetAllDevCls(); if (vtDevCls != null && vtDevCls.Length > 0) { for (int i = 0; i < vtDevCls.Length; i++) { m_szDevCls += "<option value='" + vtDevCls[i].dwClassID + "'>" + vtDevCls[i].szClassName + "</option>"; } } UNIDEVKIND[] vtDevKind = GetAllDevKind(); if (vtDevKind != null && vtDevKind.Length > 0) { for (int i = 0; i < vtDevKind.Length; i++) { m_szDevKind += "<option value='" + vtDevKind[i].dwKindID + "'>" + vtDevKind[i].szKindName + "</option>"; } } m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true); m_szKindPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwKindProperty", "DevKind_dwProperty", true); if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); ContDevExt(vtDev[0].szExtInfo.ToString()); UNIDEVKIND getDevKind = new UNIDEVKIND(); if (vtDev[0].dwKindID != null && GetDevKindByID(vtDev[0].dwKindID.ToString(), out getDevKind)) { ViewState["dwKindProperty"] = UintToCharList(getDevKind.dwProperty, "DevKind_dwProperty"); ViewState["dwUsableNum"] = getDevKind.dwUsableNum.ToString(); ViewState["szProducer"] = getDevKind.szProducer.ToString(); ViewState["szNation"] = getDevKind.dwNationCode.ToString(); } m_Title = "修改【" + vtDev[0].szPCName + "】"; } } } else { m_Title = "新建" + ConfigConst.GCDevName; } }
protected void Page_Load(object sender, EventArgs e) { UNIDEVICE newDev; uint? uMax = 0; uint uID = PRDevice.DEVICE_BASE | PRDevice.MSREQ_DEVICE_SET; if (GetMaxValue(ref uMax, uID, "dwDevSN")) { } if (IsPostBack) { GetHTTPObj(out newDev); newDev.dwDevSN = GetDevSN(); // newDev.dwProperty = CharListToUint(Request["dwProperty"]); uint uProperty = CharListToUint(Request["dwProperty2"]); if ((uProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN) > 0) { if (newDev.dwProperty == null) { newDev.dwProperty = 0; } newDev.dwProperty = (uint)newDev.dwProperty | (uint)UNIDEVICE.DWPROPERTY.DEVPROP_MAIN; } newDev.dwManMode = CharListToUint(Request["dwManMode"]); UNIGROUP newUseGroup; if (NewGroup(newDev.szDevName.ToString() + "使用组", (uint)UNIGROUP.DWKIND.GROUPKIND_DEV, out newUseGroup)) { newDev.dwUseGroupID = newUseGroup.dwGroupID; } else { return; } UNIGROUP newManGroup; UNIROOM newRoom = new UNIROOM(); if (NewGroup(newDev.szDevName.ToString() + "管理组", (uint)UNIGROUP.DWKIND.GROUPKIND_MAN, out newManGroup)) { newRoom.dwManGroupID = newManGroup.dwGroupID; } else { return; } newRoom.dwLabID = newDev.dwLabID; newRoom.szRoomNo = newDev.szRoomNo; newRoom.szRoomName = newDev.szDevName; newRoom.dwOpenRuleSN = newDev.dwOpenRuleSN; newRoom.dwManMode = newDev.dwManMode; newRoom.dwInClassKind = (uint)UNIDEVCLS.DWKIND.CLSCOMMONS_MULTIPLE; if (m_Request.Device.RoomSet(newRoom, out newRoom) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "新建资源失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { newDev.dwRoomID = newRoom.dwRoomID; } if (m_Request.Device.Set(newDev, out newDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "新建资源失败", MSGBOX.ERROR, MSGBOX_ACTION.NONE); return; } else { MessageBox("新建资源成功", "提示", MSGBOX.SUCCESS, MSGBOX_ACTION.OK); UNIACCOUNT accInfo; if (newDev.dwAttendantID != null && GetAccByAccno(newDev.dwAttendantID.ToString(), out accInfo) == true) { DEVATTENDANT devAttendSet = new DEVATTENDANT(); devAttendSet.dwAttendantID = accInfo.dwAccNo; devAttendSet.szAttendantName = accInfo.szTrueName; devAttendSet.dwDevID = newDev.dwDevID; devAttendSet.dwLabID = newDev.dwLabID; m_Request.Device.AttendantSet(devAttendSet); 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"); 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>"; } } m_szCtrlMode = GetAllInputHtml(CONSTHTML.option, "", "UNIDEVICE_CtrlMode"); UNIADMIN[] adminlist; if (GetAdmin(out adminlist) == true) { for (int i = 0; i < adminlist.Length; i++) { m_szManager += "<option value='" + adminlist[i].dwAccNo.ToString() + "'>" + adminlist[i].szTrueName + "</option>"; } } UNILAB[] vtLab = GetAllLab(); if (vtLab != null && vtLab.Length > 0) { for (int i = 0; i < vtLab.Length; i++) { if ((((uint)vtLab[i].dwLabClass) & 1024) == 0) { continue; } m_szLab += "<option value='" + vtLab[i].dwLabID + "'>" + vtLab[i].szLabName + "</option>"; } } m_szPorperty = GetInputHtmlFromXml(0, CONSTHTML.checkBox, "dwProperty", "UNIDEVICE_Property", true); if (Request["op"] == "set") { bSet = true; DEVREQ vrDevReq = new DEVREQ(); vrDevReq.dwDevID = Parse(Request["id"]); UNIDEVICE[] vtDev; if (m_Request.Device.Get(vrDevReq, out vtDev) != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { if (vtDev.Length == 0) { MessageBox("获取失败", "获取失败", MSGBOX.ERROR, MSGBOX_ACTION.CANCEL); } else { PutJSObj(vtDev[0]); m_Title = "修改【" + vtDev[0].szPCName + "】"; } } } else { m_Title = "新建资源"; } }