protected void Page_Load(object sender, EventArgs e) { string date = Request["date"]; string devID = Request["devID"]; uint uResvBegin = Parse(Request["BeginTime"]); uint uResvEnd = Parse(Request["EndTime"]); Response.CacheControl = "no-cache"; DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.szDates = (date); if (devID != null) { // vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_DEVID; vrGet.dwDevID = Parse(devID); } DEVRESVSTAT[] vtRes; vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL; vrGet.szReqExtInfo.dwNeedLines = 100000; vrGet.szReqExtInfo.dwStartLine = 0; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { for (int i = 0; i < vtRes.Length; i++) { uint uOpenTimeBegin = (uint)vtRes[0].szOpenInfo[0].dwBegin; uint uOpenTimeEnd = (uint)vtRes[0].szOpenInfo[0].dwEnd; if (uResvBegin < uOpenTimeBegin || uResvEnd > uOpenTimeEnd) { Response.Write("false"); return; } DEVRESVTIME[] resvInfo = vtRes[i].szResvInfo; if (resvInfo != null && resvInfo.Length > 0) { for (int j = 0; j < resvInfo.Length; j++) { uint uResvedBegin = (uint)resvInfo[j].dwBegin; uint uResvedEnd = (uint)resvInfo[j].dwEnd; if (!(uResvedEnd < uResvBegin || uResvedEnd < uResvedBegin)) { Response.Write("false"); return; } } } } } else { Response.Write("true"); return; } }
protected void Page_Load(object sender, EventArgs e) { string date = Request["date"]; string devClassKind = Request["devClassKind"]; string devID = Request["devID"]; string devKindID = Request["kindID"]; string purpose = Request["purpose"]; Response.CacheControl = "no-cache"; DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.szDates = (date); if (devID != null && devID != "0") { //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_DEVID; vrGet.dwDevID = Parse(devID); } else if (devKindID != null) { //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ROOMID; vrGet.szRoomIDs = devKindID.ToString(); } else { //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ALL; } if (devClassKind != null) { vrGet.dwClassKind = Parse(devClassKind); } DEVRESVSTAT[] vtRes; // vrGet.dwGetType = 0; vrGet.dwResvPurpose = Parse(purpose); vrGet.szReqExtInfo.dwNeedLines = 100000; vrGet.szReqExtInfo.dwStartLine = 0; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { string szDevInfo = "["; string szOpenTime = ""; string szResvInfo = "["; string szOut = ""; szOut += "["; for (int i = 0; i < vtRes.Length; i++) { szOpenTime = ""; if (vtRes[0].szOpenInfo != null && vtRes[0].szOpenInfo.Length > 0) { szOpenTime = ((uint)vtRes[0].szOpenInfo[0].dwBegin * 10000 + (uint)vtRes[0].szOpenInfo[0].dwEnd).ToString(); } string devNameTemp = vtRes[i].szDevName; string devIDTemp = vtRes[i].dwDevID.ToString(); DEVRESVTIME[] resvInfo = vtRes[i].szResvInfo; if (resvInfo != null && resvInfo.Length > 0) { for (int j = 0; j < resvInfo.Length; j++) { uint uResvTime = ((uint)resvInfo[j].dwBegin * 10000 + (uint)resvInfo[j].dwEnd); szResvInfo = szResvInfo + "{" + "\"name\":\"" + devNameTemp + "\"," + "\"value\":" + devIDTemp + "," + "\"devID\":" + devIDTemp + "," + "\"value\":" + uResvTime.ToString() + "}"; if (i < vtRes.Length - 1) { szResvInfo += ","; } } } szDevInfo = szDevInfo + "{" + "\"devName\":\"" + devNameTemp + "\"," + "\"devID\":" + devIDTemp + "}"; if (i < vtRes.Length - 1) { szDevInfo += ","; } } szDevInfo += "]"; if (szResvInfo.EndsWith(",")) { szResvInfo = szResvInfo.Substring(0, szResvInfo.Length - 1); } szResvInfo += "]"; szOut = "{" + "\"resvInfo\":" + szResvInfo + ",\"DevList\":" + szDevInfo + ",\"OpenTime\":" + szOpenTime + "}"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected override void OnLoadComplete(EventArgs e) { uint uClassKind = Parse(Request["classKind"]); uint uKindID = Parse(Request["KindId"]); uDate = Parse(Request["dwDate"]); DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ALL; if (uClassKind != 0) { vrGet.dwClassKind = uClassKind; } if (uKindID != 0) { Session["uKindIDHiden"] = uKindID; } if (uKindID == 0 && Session["uKindIDHiden"] != null) { uKindID = Parse(Session["uKindIDHiden"].ToString()); } vrGet.szKindIDs = uKindID.ToString(); if (vrGet.szKindIDs == "" || vrGet.szKindIDs == "0") { vrGet.szKindIDs = null; } vrGet.szDates = uDate.ToString(); szSearchDate = (uDate / 10000) + "-" + (((uDate % 10000) / 100)).ToString("00") + "-" + (uDate % 100).ToString("00"); vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_RESERVED + (uint)UNIRESERVE.DWPURPOSE.USEFOR_STUDYROOM; vrGet.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null) { for (int i = 0; i < vtRes.Length; i++) { if (vtRes[i].dwProperty != null) { uint uProperty = (uint)vtRes[i].dwProperty; if ((uProperty & (uint)UNIDEVICE.DWPROPERTY.DEVPROP_NORESV) > 0) { continue; } } bool bUsable = true; //是否可预约 m_szOut += "<div class=\"Item\" data-kindid=\"" + vtRes[i].dwKindID + "\" data-id=\"" + vtRes[i].dwDevID + "\">"; m_szOut += "<div class=\"LHead\">" + vtRes[i].szDevName + "</div>"; //m_szOut += "<div class=\"LContent\">"+vtRes[i].szExtInfo+"</div>"; m_szOut += "<div class=\"LGraphics\"><span>预约状态图,</span><span class=\"enableStat\">■可预约</span>"; uint uStartTime = (uint)vtRes[i].szOpenInfo[0].dwBegin; string szOpenStartTime = uStartTime / 100 + "." + uStartTime % 100; uint uEndTime = (uint)vtRes[i].szOpenInfo[0].dwEnd; string szEndTime = uEndTime / 100 + "." + uEndTime % 100; bool bIsOpen = true; DAYOPENRULE[] dayopen = vtRes[i].szOpenInfo; if (dayopen.Length > 0) { if (dayopen[0].dwBegin >= dayopen[0].dwEnd) { bIsOpen = false; } } UNIRESVRULE resv = vtRes[i].szRuleInfo; if (resv.dwRuleSN != null) { uint uEarlisteResvTime = (uint)resv.dwEarliestResvTime; uint uDateEarlist = uEarlisteResvTime / 1440; uint uDateTemp = Parse(DateTime.Now.AddDays(uDateEarlist).ToString("yyyyMMdd")); if (uDate > uDateTemp) { bIsOpen = false; } } if (bIsOpen == false) { szOpenStartTime = "8.00"; szEndTime = "21.00"; } string szResvInfo = "["; if (vtRes[i].szResvInfo != null && vtRes[i].szResvInfo.Length > 0) { for (int m = 0; m < vtRes[i].szResvInfo.Length; m++) { if ((int)vtRes[i].szResvInfo[m].dwBegin < uStartTime) { vtRes[i].szResvInfo[m].dwBegin = uStartTime; } if ((int)vtRes[i].szResvInfo[m].dwEnd > uEndTime) { vtRes[i].szResvInfo[m].dwEnd = uEndTime + 100; } szResvInfo += ((int)vtRes[i].szResvInfo[m].dwBegin * 10000 + (int)vtRes[i].szResvInfo[m].dwEnd); if ((m + 1) < (vtRes[i].szResvInfo.Length)) { szResvInfo += ","; } } } szResvInfo += "]"; if (bIsOpen == false) { szResvInfo = "[8002200]"; } m_szOut += "<canvas id='cav" + i.ToString() + "' data-start =\"" + szOpenStartTime + "\" data-end =\"" + szEndTime + "\" data-list=\"" + szResvInfo + "\"></canvas></div>"; if (bUsable && (bIsOpen != false)) { m_szOut += "<div class=\"LBtn\"><button>预约→</button></div>"; } else if (!bUsable) { m_szOut += "<div class=\"LBtn\">已被预约满</div>"; } else if (bIsOpen == false) { m_szOut += "<div class=\"LBtn\">不开放</div>"; } m_szOut += "</div>"; } } }
protected void Page_Load(object sender, EventArgs e) { base.LoadPage(); string act = Request["act"]; if (act == "form") { string rtId = ConvertStr(Request["rtSel"]); string szlabName = ConvertStr(Request["labName"]); //string szlabMan = ConvertStr(Request["labMan"]); //string szlabManId = ConvertStr(Request["labManId"]); string BeginDate = ConvertStr(Request["beginDate"]); if (DateTime.Parse(BeginDate) <= DateTime.Now) { //BeginDate = DateTime.Now.AddMinutes(1).ToString(); Response.Write("{\"ret\":0,\"msg\":\"开始时间不得早于当前时间\"}"); return; } string EndDate = ConvertStr(Request["endDate"]); //EndDate = DateTime.Parse(EndDate).AddDays(1).AddSeconds(-1).ToString(); uint isCheck = ConvertStr(Request["check"]) == "1" ? (uint)UNIRESERVE.DWPROPERTY.RESVPROP_MANDO : (uint)UNIRESERVE.DWPROPERTY.RESVPROP_SELFDO; uint isMat = ConvertStr(Request["selMat"]) == "1" ? (uint)UNIRESERVE.DWPROPERTY.RESVPROP_SELFCONSUMABLE : 0; string szMemo = ConvertStr(Request["memo"]); REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL; RTRESV setResv = new RTRESV(); setResv.dwUseMode = (uint)UNIRESERVE.DWUSEMODE.RESVUSE_USEDEV; if (rtId == "" || rtId == "0")//个人实验 { Response.Write("{\"ret\":0,\"msg\":\"系统只支持有课题的实验\"}"); return;//暂不考虑个人实验 } setResv.dwRTID = Convert.ToUInt32(rtId); setResv.szTestName = szlabName; setResv.dwBeginTime = (uint?)Get1970Seconds(BeginDate); setResv.dwEndTime = (uint?)Get1970Seconds(EndDate); setResv.dwProperty = isCheck | isMat; setResv.szMemo = szMemo; if (!string.IsNullOrEmpty(Request["sample"]))//样本 { //setResv.dwSampleNum = Convert.ToUInt32(Request["sample"]); } else { //setResv.dwSampleNum = 0; } UNIACCOUNT setAcc = new UNIACCOUNT(); if (Session["LOGIN_ACCINFO"] != null && Session["CUR_DEV"] != null) { setAcc = (UNIACCOUNT)Session["LOGIN_ACCINFO"]; setResv.dwOwner = setAcc.dwAccNo; setResv.szOwnerName = setAcc.szTrueName.ToString(); //浙大农学院 if (setAcc.dwTutorID != null && setAcc.dwTutorID != 0) { setResv.dwHolderID = setAcc.dwTutorID; setResv.szHolderName = setAcc.szTutorName; } //RESEARCHTEST[] rts = GetRTestes(rtId); //if (rts != null && rts.Length > 0) //{ // setResv.dwLeaderID = rts[0].dwLeaderID; // setResv.szLeaderName = rts[0].szLeaderName; // setResv.dwHolderID = rts[0].dwHolderID; // setResv.szHolderName = rts[0].szHolderName; //} //else //{ // Response.Write("{\"ret\":0,\"msg\":\"获取项目信息失败\"}"); // return; //} //////// UNIDEVICE setDev = (UNIDEVICE)Session["CUR_DEV"]; setResv.dwLabID = setDev.dwLabID; setResv.dwDevID = setDev.dwDevID; setResv.dwDevKind = setDev.dwKindID; setResv.dwManID = setDev.dwAttendantID; setResv.szManName = setDev.szAttendantName; } else { Response.Write("{\"ret\":0,\"msg\":\"登录超时,请重新登录!\"}"); return; } setResv.dwPurpose = 2 | (uint)UNIRESERVE.DWPURPOSE.USEFOR_RESEACH; uResponse = m_Request.Reserve.SetRTResv(setResv, out setResv); Response.ContentType = "application/Json"; if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { //默认加入课题成员组 RESEARCHTESTREQ vrRt = new RESEARCHTESTREQ(); vrRt.dwRTID = setResv.dwRTID; RESEARCHTEST[] vtRst; m_Request.Reserve.GetResearchTest(vrRt, out vtRst); if (vtRst != null && vtRst.Length > 0) { AddMemByAccNo(vtRst[0].dwGroupID.ToString(), setAcc.dwAccNo.ToString()); } Response.Write("{\"ret\":1}"); } else { Response.Write("{\"ret\":0,\"msg\":\"" + m_Request.szErrMsg + "\"}"); } } else if (act == "get") { //费用 uint useFee = 0; uint useFeeUnit = 0; uint sampleFee = 0; uint sampleFeeUnit = 0; uint subFee = 0; uint subFeeUnit = 0; string resvStat = ""; if (Session["CUR_DEV"] != null && Session["LOGIN_ACCINFO"] != null) { UNIDEVICE dev = (UNIDEVICE)Session["CUR_DEV"]; //浙大无需获取费用 //FEEREQ vrGet = new FEEREQ(); //vrGet.dwDevKind = dev.dwKindID; //UNIFEE[] vrResult; //if (m_Request.Fee.Get(vrGet, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS && vrResult != null && vrResult.Length == 1) //{ // FEEDETAIL[] fees= vrResult[0].szFeeDetail; // for (int i = 0; i < fees.Length; i++) // { // if (fees[i].dwFeeType == (uint)FEEDETAIL.DWFEETYPE.FEETYPE_USEDEV) // { // useFee = (uint)fees[i].dwUnitFee; // useFeeUnit=(uint)fees[i].dwUnitTime; // } // else if (fees[i].dwFeeType == (uint)FEEDETAIL.DWFEETYPE.FEETYPE_SAMPLE) // { // sampleFee = (uint)fees[i].dwUnitFee; // sampleFeeUnit = (uint)fees[i].dwUnitTime; // } // else if (fees[i].dwFeeType == (uint)FEEDETAIL.DWFEETYPE.FEETYPE_ENTRUST) // { // subFee = (uint)fees[i].dwUnitFee; // subFeeUnit = (uint)fees[i].dwUnitTime; // } // } //} //else //{ // Response.Write("{\"ret\":0,\"msg\":\"获取费用出错,请尝试重新登录!\"}"); // return; //} //预约情况 if (!string.IsNullOrEmpty(Request["date"])) { string date = DateTime.Parse(Request["date"]).ToString("yyyyMMdd"); DEVRESVSTATREQ resvGet = new DEVRESVSTATREQ(); resvGet.dwClassKind = (uint)UNIDEVCLS.DWKIND.CLSKIND_COMPUTER; resvGet.dwDevID = dev.dwDevID; resvGet.szDates = date; resvGet.dwResvPurpose = 2 | (uint)UNIRESERVE.DWPURPOSE.USEFOR_RESEACH; resvGet.szReqExtInfo.dwStartLine = 0; resvGet.szReqExtInfo.dwNeedLines = 10000; DEVRESVSTAT[] resvRlt; if (m_Request.Device.GetDevResvStat(resvGet, out resvRlt) == REQUESTCODE.EXECUTE_SUCCESS && resvRlt.Length > 0) { string earliest = ToTimeStr(resvRlt[0].szRuleInfo.dwEarliestResvTime); string latest = ToTimeStr(resvRlt[0].szRuleInfo.dwLatestResvTime); string max = ToTimeStr(resvRlt[0].szRuleInfo.dwMaxResvTime); string min = ToTimeStr(resvRlt[0].szRuleInfo.dwMinResvTime); string start = ToTimeStr2(resvRlt[0].szOpenInfo[0].dwBegin); string end = ToTimeStr2(resvRlt[0].szOpenInfo[0].dwEnd); resvStat = "本仪器当日开放时间:<span style='color:red;'>" + start + "</span> 到 <span style='color:red;'>" + end + "</span>;申请预约最长可提前:<span style='color:red;'>" + earliest + "</span>" + "至少提前:<span style='color:red;'>" + latest + "</span>;预约时间最长:<span style='color:red;'>" + max + "</span> 最短:<span style='color:red;'>" + min + "</span>。"; DEVRESVTIME[] ts = resvRlt[0].szResvInfo; //for (int i = 0; i < ts.Length; i++) //{ // resvStat += "从" + ts[i].dwBegin / 100 + ":" + ts[i].dwBegin % 100 + "到" + ts[i].dwEnd / 100 + ":" + ts[i].dwEnd % 100; //} } } } else { Response.Write("{\"ret\":0,\"msg\":\"登录已超时,请重新登录!\"}"); return; } string rtOpt = InitRTestes(); string manOpt = InitManInfo(); if (rtOpt == "")//临时 检测获取课题情况 { Response.Write("{\"ret\":0,\"msg\":\"没有获取到课题!\"}"); return; } //获取开放时间 Response.Write("{\"ret\":2,\"resvStat\":\"" + resvStat + "\",\"rtOpt\":\"" + rtOpt + "\",\"manOpt\":\"" + manOpt + "\",\"useFee\":\"" + useFee + "\",\"sampleFee\":\"" + sampleFee + "\",\"subFee\":\"" + subFee + "\",\"useFeeUnit\":\"" + useFeeUnit + "\",\"sampleFeeUnit\":\"" + sampleFeeUnit + "\",\"subFeeUnit\":\"" + subFeeUnit + "\",\"myTutor\":\"" + myTutor + "\"}"); } }
//http://update.unifound.net/wxnotice/qrcode.aspx?pcid=1&id=1&session=Seat&msg=座位号:001 protected void Page_Load(object sender, EventArgs e) { if (Request["ls"] == "true") { Session["LocSigned"] = DateTime.Now; } m_nLocSigned = true;//禁用位置认证 /* * if(Session["LocSigned"] == null || (DateTime.Now - (DateTime)Session["LocSigned"]).TotalSeconds > 300) * { * m_nLocSigned = false; * return; * }else{ * m_nLocSigned = true; * } */ uint dwStaSN = 1; string sta = Request["sta"]; if (string.IsNullOrEmpty(sta)) { dwStaSN = 1; } else { dwStaSN = ToUint(sta); } m_Request.m_UniDCom.StaSN = dwStaSN; string aliUserid = Request["msn"]; string szSchoolCode = Request["sysid"]; string szwxuserid = Request["wxuseridform"]; if (!string.IsNullOrEmpty(aliUserid)) { if (Request.UserAgent.IndexOf("MicroMessenger") < 0)// { Session["aliUserid"] = aliUserid; } else { Session["szwxuserid"] = aliUserid; } } if (!string.IsNullOrEmpty(szSchoolCode)) { Session["szSchoolCode"] = szSchoolCode; } if (Request["DoUserIn"] == "true") { MOBILEUSERINREQ req = new MOBILEUSERINREQ(); MOBILEUSERINRES res; req.dwUseMin = ToUint(Request["dwUseMin"]); REQUESTCODE uResponse = m_Request.Console.MobileUserIn(req, out res); Logger.trace("MobileUserIn"); if (res.szDispInfo != null && res.szDispInfo != "") { res.szDispInfo = res.szDispInfo.Replace("设备", "座位"); res.szDispInfo = res.szDispInfo.Replace("微信", "该"); } if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { m_szTitle = "操作成功"; m_szMsg = res.szDispInfo; m_szType = "1"; } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } else if (Request["DoUserDelay"] == "true") { MOBILEDELAYREQ req = new MOBILEDELAYREQ(); MOBILEDELAYRES res; req.dwDelayMin = ToUint(Request["dwDelayMin"]); REQUESTCODE uResponse = m_Request.Console.MobileDelay(req, out res); res.szDispInfo = res.szDispInfo.Replace("设备", "座位"); res.szDispInfo = res.szDispInfo.Replace("微信", "该"); Logger.trace("MobileDelay"); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { m_szTitle = "操作成功"; m_szMsg = res.szDispInfo; m_szType = "1"; } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } else if (Request["DoUserOut"] == "1") { MOBILEUSEROUTREQ req = new MOBILEUSEROUTREQ(); MOBILEUSEROUTRES res; req.dwOutType = (uint)MOBILEUSEROUTREQ.DWOUTTYPE.MSUSEROUT_LEAVE; REQUESTCODE uResponse = m_Request.Console.MobileUserOut(req, out res); res.szDispInfo = res.szDispInfo.Replace("设备", "座位"); res.szDispInfo = res.szDispInfo.Replace("微信", "该"); Logger.trace("MobileUserOut"); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { m_szTitle = "操作成功"; DateTime timenow = DateTime.Now.AddMinutes(double.Parse(res.szDispInfo)); m_szMsg = "请在【" + timenow.ToString("HH:mm") + "】前返回"; m_szType = "1"; } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } else if (Request["DoUserOut"] == "2") { MOBILEUSEROUTREQ req = new MOBILEUSEROUTREQ(); MOBILEUSEROUTRES res; req.dwOutType = (uint)MOBILEUSEROUTREQ.DWOUTTYPE.MSUSEROUT_EXIT; REQUESTCODE uResponse = m_Request.Console.MobileUserOut(req, out res); if (res.szDispInfo != null && res.szDispInfo != "") { res.szDispInfo = res.szDispInfo.Replace("设备", "座位"); res.szDispInfo = res.szDispInfo.Replace("微信", "该"); } Logger.trace("MobileUserOut2"); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { m_szTitle = "操作成功"; m_szMsg = res.szDispInfo; m_szType = "1"; } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } else { string lab = Request["lab"]; string dev = Request["dev"]; string msn = Request["msn"]; MOBILESCANREQ req = new MOBILESCANREQ(); MOBILESCANRES res; if (Request["DoLogon"] == "true") { if (Session["mobilescanreq"] == null) { m_szTitle = "开门失败"; m_szMsg = "请重试"; m_szType = "0"; Response.Redirect("WxOpenDoorMsg.aspx?type=" + m_szType + "&title=" + Server.UrlEncode(m_szTitle) + "&msg=" + Server.UrlEncode(m_szMsg)); return; } req = (MOBILESCANREQ)Session["mobilescanreq"]; req.szLogonName = Request["szLogonName"]; req.szPassword = "******" + Request["szPassword"]; if (Request["dwBind"] == "1") { req.dwProperty = (uint)MOBILEOPENDOORREQ.DWPROPERTY.MODPROP_BINDMSN; } } else { req.dwStaSN = dwStaSN; req.dwLabID = ToUint(lab); req.dwDevID = ToUint(dev); req.szMSN = msn; req.szIP = GetRealIP(); Session["mobilescanreq"] = req; } m_Request.m_UniDCom.StaSN = dwStaSN; req.szIP = GetRealIP();// "192.168.3.299"; REQUESTCODE uResponse = m_Request.Console.MobileScan(req, out res); Session["dwSessionID"] = res.dwSessionID; DEVRESVSTATREQ stareq = new DEVRESVSTATREQ(); stareq.dwDevID = req.dwDevID; stareq.dwResvPurpose = 319; stareq.szReqExtInfo.dwStartLine = 0; stareq.szReqExtInfo.dwNeedLines = 10000; stareq.szDates = DateTime.Now.ToString("yyyyMMdd"); if (Session["dwSessionID"] != null) { m_Request.m_UniDCom.SessionID = (uint)Session["dwSessionID"]; DEVRESVSTAT[] vrResult; REQUESTCODE uResponse1 = m_Request.Device.GetDevResvStat(stareq, out vrResult); if (uResponse1 == REQUESTCODE.EXECUTE_SUCCESS && vrResult[0].szResvInfo.Length > 0) { m_szResvMsg = "设备预约信息:"; for (int i = 0; i < vrResult[0].szResvInfo.Length; i++) { string bengindate = vrResult[0].szResvInfo[i].dwBegin.ToString(); string enddate = vrResult[0].szResvInfo[i].dwEnd.ToString(); string date = "[" + returndate(bengindate) + "-" + returndate(enddate) + "],"; m_szResvMsg += date; } } } string szschoolCode = Request["sysidform"]; string szUserID = Request["aluseridform"]; string szLogonName = Request["szLogonName"]; if (string.IsNullOrEmpty(szLogonName) && res.szPID != null && res.szPID != "") { szLogonName = res.szPID; } if (Session["aliUserid"] != null) { szUserID = Session["aliUserid"].ToString(); } if (Session["szSchoolCode"] != null) { szschoolCode = Session["szSchoolCode"].ToString(); } if (Session["szwxuserid"] != null) { szwxuserid = Session["szwxuserid"].ToString(); } if (Request.UserAgent.IndexOf("MicroMessenger") < 0)// { if (!string.IsNullOrEmpty(szschoolCode) && !string.IsNullOrEmpty(szUserID) && !string.IsNullOrEmpty(szLogonName) && uResponse == REQUESTCODE.EXECUTE_SUCCESS) { Logger.trace("szschoolCode=" + szschoolCode + ",szUserID=" + szUserID + ",szLogonName=" + szLogonName); if (!string.IsNullOrEmpty(szschoolCode) && !string.IsNullOrEmpty(szLogonName) && !string.IsNullOrEmpty(szLogonName)) { BindUniCloud(szLogonName, szUserID, szschoolCode, ""); } } } else { if (!string.IsNullOrEmpty(szschoolCode) && !string.IsNullOrEmpty(szwxuserid) && !string.IsNullOrEmpty(szLogonName) && uResponse == REQUESTCODE.EXECUTE_SUCCESS) { Logger.trace("szschoolCode=" + szschoolCode + ",szwxuserid=" + szwxuserid + ",szLogonName=" + szLogonName); if (!string.IsNullOrEmpty(szschoolCode) && !string.IsNullOrEmpty(szLogonName) && !string.IsNullOrEmpty(szLogonName)) { BindUniCloud(szLogonName, "", szschoolCode, szwxuserid); } } } Logger.trace("MobileScan"); if (res.dwSessionID != null && res.dwSessionID != 0) { m_Request.m_UniDCom.SessionID = (uint)res.dwSessionID; } if (uResponse == REQUESTCODE.EXECUTE_SUCCESS && (res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_SIGNOK) != 0) { m_szTitle = "签到成功"; m_szMsg = res.szDispInfo; m_szType = "1"; //if (Request["dwBind"] == "1") //{ // m_szMsg2 = "√ 已绑定此微信号"; //} } else if (uResponse == REQUESTCODE.ERR_MSN_NOBIND) { m_szType = "2"; m_szTitle = "未绑定用户"; m_szMsg = "请输入账号和密码,绑定用户"; } else if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { if ((res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_IDLE) != 0 && (res.dwMaxUseMin != 0 && res.dwMaxUseMin >= res.dwMinUseMin)) { //设备空闲(使用需调用MSREQ_MOBILE_USERIN) m_szTitle = "可用"; //m_szMsg = res.szDispInfo; if (!string.IsNullOrEmpty(m_szMsg)) { m_szMsg += ","; } m_szMsg += "空闲:请选择使用时长,离开请扫码"; m_szType = "3"; m_szOther = "&dwMinUseMin=" + res.dwMinUseMin + "&dwMaxUseMin=" + res.dwMaxUseMin + "&szTrueName=" + Server.UrlEncode(res.szTrueName) + "&szDevName=" + Server.UrlEncode(res.szDevName); } else if ((res.dwUserStat & ((uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_INUSE | (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_CANDELAY)) != 0) { //使用中(可调用MSREQ_MOBILE_USEROUT进行后续操作) m_szTitle = "当前使用中"; m_szMsg = res.szDispInfo; m_szType = "4"; if ((res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_CANDELAY) != 0) { m_szType = "8"; m_szOther = "&dwMinUseMin=" + res.dwMinUseMin + "&dwMaxUseMin=" + res.dwMaxUseMin + "&szTrueName=" + Server.UrlEncode(res.szTrueName) + "&szDevName=" + Server.UrlEncode(res.szDevName); } } else if ((res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_EXIT) != 0) { //刷卡退出成功(无需后续操作) m_szTitle = "刷卡退出成功"; m_szMsg = res.szDispInfo; m_szType = "1"; } else if ((res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_GOBACK) != 0) { //暂时离开返回成功(无需后续操作) m_szTitle = "暂时离开返回成功"; m_szMsg = res.szDispInfo; m_szType = "1"; } else if ((res.dwUserStat & (uint)MOBILESCANRES.DWUSERSTAT.MSUSERSTAT_RESVUNDO) != 0) { //预约未生效(无需后续操作) m_szTitle = "预约未生效"; m_szMsg = res.szDispInfo; m_szMsg = m_szMsg.Replace("-", null); m_status = "1"; m_szType = "0"; } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } else { m_szTitle = "操作失败"; m_szMsg = res.szDispInfo; m_szType = "0"; } } //提前预约 if (Request["Advance"] == "true") { MOBILEUSERINREQ req = new MOBILEUSERINREQ(); MOBILEUSERINRES res; REQUESTCODE uResponse = m_Request.Console.MobileUserIn(req, out res); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { m_szTitle = "提前预约成功"; m_szMsg = res.szDispInfo; m_szType = "32"; } else { m_szTitle = "提前预约失败"; m_szMsg = res.szDispInfo; m_szType = "32"; } } if (m_szType == "0") { if (string.IsNullOrEmpty(m_szMsg)) { if (string.IsNullOrEmpty(m_Request.szErrMessage) || m_Request.szErrMessage.IndexOf("Socket") > 0) { m_szMsg = "操作失败,请重试"; } else { m_szMsg = m_Request.szErrMessage; } } if (string.IsNullOrEmpty(m_szMsg)) { m_szMsg = "操作失败,请重试"; } } // Response.Write("WxSeatSignMsg.aspx?type=" + m_szType + "&title=" + Server.UrlEncode(m_szTitle) + "&msg=" + Server.UrlEncode(m_szMsg) + "&msg2=" + Server.UrlEncode(m_szMsg2) + m_szOther); // Response.End(); if (!string.IsNullOrEmpty(aliUserid) && !string.IsNullOrEmpty(szSchoolCode)) { if (Request.UserAgent.IndexOf("MicroMessenger") < 0) { Response.Redirect("WxSeatSignMsg.aspx?type=" + m_szType + "&aliUserid=" + aliUserid + "&sysid=" + szSchoolCode + "&title=" + Server.UrlEncode(m_szTitle) + "&msg=" + Server.UrlEncode(m_szMsg) + "&msg2=" + Server.UrlEncode(m_szMsg2) + m_szOther + "&ResvMsg=" + Server.UrlEncode(m_szResvMsg)); } else { Response.Redirect("WxSeatSignMsg.aspx?type=" + m_szType + "&wxUserid=" + aliUserid + "&sysid=" + szSchoolCode + "&title=" + Server.UrlEncode(m_szTitle) + "&msg=" + Server.UrlEncode(m_szMsg) + "&msg2=" + Server.UrlEncode(m_szMsg2) + m_szOther + "&ResvMsg=" + Server.UrlEncode(m_szResvMsg)); } } else { Response.Redirect("WxSeatSignMsg.aspx?type=" + m_szType + "&title=" + Server.UrlEncode(m_szTitle) + "&msg=" + Server.UrlEncode(m_szMsg) + "&msg2=" + Server.UrlEncode(m_szMsg2) + m_szOther + "&ResvMsg=" + Server.UrlEncode(m_szResvMsg) + "&status=" + m_status); } }
protected void Page_Load(object sender, EventArgs e) { uint uClassKind = Parse(Request["classKind"]); uint uDate = Parse(Request["dwDate"]); uint uDevID = Parse(Request["devID"]); uint uKindID = Parse(Request["kindID"]); if (m_Request == null) { Response.Write("{\"error\":\"\"}"); return; } DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); // vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ALL; if (uClassKind != 0) { vrGet.dwClassKind = uClassKind; } if (uKindID != 0) { vrGet.szKindIDs = uKindID.ToString(); } vrGet.szDates = uDate.ToString(); vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_SEAT; vrGet.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null) { { List <DevResvStateAjax> list = new List <DevResvStateAjax>(); for (int i = 0; i < vtRes.Length; i++) { DevResvStateAjax dev = new DevResvStateAjax(); dev.devID = (uint)vtRes[i].dwDevID; dev.DevName = vtRes[i].szDevName; dev.szMemo = ""; dev.LeftTime = 0; dev.OpenTime = (int)vtRes[i].szOpenInfo[0].dwBegin * 10000 + (int)vtRes[i].szOpenInfo[0].dwEnd; //string szResvInfo = "["; if (vtRes[i].szResvInfo != null && vtRes[i].szResvInfo.Length > 0) { int[] nResvInList = new int[vtRes[i].szResvInfo.Length]; DEVRESVTIME[] devResvTime = vtRes[i].szResvInfo; for (int m = 0; m < devResvTime.Length; m++) { nResvInList[m] = ((int)devResvTime[m].dwBegin * 10000 + (int)devResvTime[m].dwEnd); } dev.ResvList = nResvInList; } // szResvInfo += "]"; list.Add(dev); } string szRes = JsonConvert.SerializeObject(list); Response.Write(szRes); return; } } else { Response.Write("{\"error\":\"" + m_Request.szErrMessage + "\"}"); } }
protected override void OnLoadComplete(EventArgs e) { uint uClassKind = Parse(Request["classKind"]); FULLROOMREQ vrGet = new FULLROOMREQ(); vrGet.dwInClassKind = (uint)UNIDEVCLS.DWKIND.CLSKIND_SEAT; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.dwStartLine = 0; uDate = Parse(Request["dwDate"]); if (uDate == 0) { szSearchDate = DateTime.Now.ToString("yyyy-MM-dd"); uDate = Parse(DateTime.Now.ToString("yyyyMMdd")); } else { szSearchDate = uDate / 10000 + "-" + (uDate % 10000 / 100).ToString("00") + "-" + (uDate % 100).ToString("00"); } FULLROOM[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.FullRoomGet(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { for (int i = 0; i < vtRes.Length; i++) { bool bIsOpen = true; uint uBegOpenTime = 2359; uint uEndOpenTime = 0; uint uDevNum = (uint)vtRes[i].dwTotalDevNum; DEVRESVSTATREQ devResvStaReq = new DEVRESVSTATREQ(); devResvStaReq.szDates = uDate.ToString(); devResvStaReq.szRoomIDs = vtRes[i].dwRoomID.ToString(); devResvStaReq.dwResvPurpose = 47;// (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_RESERVED; devResvStaReq.szReqExtInfo.dwNeedLines = 100000; devResvStaReq.dwReqProp = (uint)DEVRESVSTATREQ.DWREQPROP.DRREQ_NEEDALLDAYOPENRULE; devResvStaReq.szReqExtInfo.dwStartLine = 0; DEVRESVSTAT[] vtDevResvState; //-1表示一天20小时,0表示开放时间(所有设备空闲),>0表示下被预约的设备数目 int[] timeDay = new int[1440]; for (int j = 0; j < timeDay.Length; j++) { timeDay[j] = -1; } if (m_Request.Device.GetDevResvStat(devResvStaReq, out vtDevResvState) == REQUESTCODE.EXECUTE_SUCCESS && vtDevResvState != null && vtDevResvState.Length > 0 && vtDevResvState[0].szOpenInfo != null) { DAYOPENRULE[] openRule = vtDevResvState[0].szOpenInfo; if (openRule == null || (openRule[0].dwBegin == openRule[0].dwEnd)) { bIsOpen = false; } if (!bIsOpen) { continue; } if (openRule != null && openRule.Length > 0) { for (int j = 0; j < openRule.Length; j++) { uint uBegin = ((uint)openRule[j].dwBegin) / 100 * 60 + ((uint)openRule[j].dwBegin) % 100; uint uEnd = ((uint)openRule[j].dwEnd) / 100 * 60 + ((uint)openRule[j].dwEnd) % 100; for (uint m = uBegin; m < uEnd; m++) { timeDay[m] = 0;//开放空闲 } if (uBegOpenTime > (uint)openRule[j].dwBegin) { uBegOpenTime = (uint)openRule[j].dwBegin; } if (uEndOpenTime < (uint)openRule[j].dwEnd) { uEndOpenTime = (uint)openRule[j].dwEnd; } } } for (int k = 0; k < vtDevResvState.Length; k++) { DEVRESVSTAT DevResvTemp = new DEVRESVSTAT(); DevResvTemp = vtDevResvState[k]; DEVRESVTIME[] resvTime = DevResvTemp.szResvInfo; if (resvTime != null && resvTime.Length > 0) { for (int n = 0; n < resvTime.Length; n++) { uint uBegin = ((uint)resvTime[n].dwBegin) / 100 * 60 + ((uint)resvTime[n].dwBegin) % 100; uint uEnd = ((uint)resvTime[n].dwEnd) / 100 * 60 + ((uint)resvTime[n].dwEnd) % 100; for (uint m = uBegin; m < uEnd; m++) { timeDay[m] = timeDay[m] + 1;//开放空闲 } } } } } //以上计算出房间一天每一分钟的预约状况 m_szOut += "<div class=\"Item\" data-kindid=\"" + vtRes[i].dwRoomID + "\" data-id=\"" + vtRes[i].dwRoomID + "\">"; m_szOut += "<div class=\"LHead\">" + vtRes[i].szRoomName + "</div>"; m_szOut += "<div class=\"LGraphics\"><span>预约状态图,</span><span class=\"enableStat\">■点击可预约</span>"; string szOpenStartTime = uBegOpenTime / 100 + "." + (uBegOpenTime % 100).ToString("00");; string szEndTime = uEndOpenTime / 100 + "." + (uEndOpenTime % 100).ToString("00");; ArrayList resvInfo = new ArrayList(); bool bIsBusy = false; uint uBeginTemp = 0; uint uEndTemp = 0; for (uint m = 0; m < timeDay.Length; m++) { if (timeDay[m] == uDevNum && bIsBusy == false) { bIsBusy = true; uBeginTemp = m; } if (timeDay[m] < uDevNum && bIsBusy == true) { bIsBusy = false; uEndTemp = m; DEVRESVTIME temp = new DEVRESVTIME(); temp.dwBegin = uBeginTemp / 60 * 100 + uBeginTemp % 60; temp.dwEnd = uEndTemp / 60 * 100 + uEndTemp % 60; resvInfo.Add(temp); } } string szResvInfo = "["; if (resvInfo != null && resvInfo.Count > 0) { for (int m = 0; m < resvInfo.Count; m++) { DEVRESVTIME temp = new DEVRESVTIME(); temp = (DEVRESVTIME)resvInfo[m]; szResvInfo += ((int)temp.dwBegin * 10000 + (int)temp.dwEnd); if ((m + 1) < (resvInfo.Count)) { szResvInfo += ","; } } } szResvInfo += "]"; m_szOut += "<canvas id='cav" + i.ToString() + "' data-start =\"" + szOpenStartTime + "\" data-end =\"" + szEndTime + "\" data-list=\"" + szResvInfo + "\"></canvas></div>"; m_szOut += "<div class=\"LBtn\"><button begintime=" + szOpenStartTime + ">预约→</button></div>"; m_szOut += "</div>"; } } }
public void LoadDefault() { string szDevID = Request["devID"]; devID.Value = szDevID; if (user == null) { user = new LOCALUSER(); } string szDate = Request["resvDate"]; if (szDate == null) { return; } uint uDateTemp = Parse(szDate); szDate = uDateTemp / 10000 + "-" + (uDateTemp % 10000) / 100 + "-" + uDateTemp % 100; DateTime da; try { da = DateTime.Parse(szDate); } catch { return; } szDate = (da.Year * 10000 + (da.Month) * 100 + (int)da.Day).ToString(); resvDateIn = da.ToString("yyyy-MM-dd"); date.Value = szDate; user = GetUser(); uint uClassKind = Parse(ConfigurationManager.AppSettings["MobileSysKind"]); uint uDate = Parse(da.ToString("yyyyMMdd")); uint uDevID = Parse(Request["devID"]); UNIDEVICE getDev; m_Request.m_UniDCom.StaSN = 1; if (getDevByID(uDevID.ToString(), out getDev)) { uClassKindTemp = (uint)getDev.dwClassKind; } DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); // vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ALL; if (uClassKind != 0) { vrGet.dwClassKind = uClassKind; } if (uDevID != 0) { // vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_DEVID; vrGet.dwDevID = uDevID; } vrGet.szDates = uDate.ToString(); vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL; vrGet.szDates = (szDate); vrGet.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { //if (uDevID != 0) { /* * for (int i = (int)vtRes[0].szOpenInfo[0].dwBegin; i <= (int)vtRes[0].szOpenInfo[0].dwEnd; i = i + 10) * { * szStartTime += GetInputItemHtml(CONSTHTML.option, "", i / 100 + ":" + (i % 100).ToString("00"), i.ToString()); * } * */ for (int m = 0; m < vtRes[0].szOpenInfo.Length; m++) { for (int i = (int)vtRes[0].szOpenInfo[m].dwBegin; i <= (int)vtRes[0].szOpenInfo[m].dwEnd; i = i + 10) { if ((i % 100) > 60) { continue; i = i + 100 - 60; } szStartTime += GetInputItemHtml(CONSTHTML.option, "", i / 100 + ":" + (i % 100).ToString("00"), i.ToString()); } } uint uBeginTime = (uint)vtRes[0].szOpenInfo[0].dwBegin; uint uEndTime = (uint)vtRes[0].szOpenInfo[0].dwEnd; OpenTime = "" + uBeginTime / 100 + ":" + (uBeginTime % 100).ToString("00") + "到" + uEndTime / 100 + ":" + (uEndTime % 100).ToString("00"); personNumLimit = vtRes[0].dwMinUsers + "人到" + vtRes[0].dwMaxUsers + "人"; if (vtRes[0].szResvInfo != null && vtRes[0].szResvInfo.Length > 0) { DEVRESVTIME[] devResvTime = vtRes[0].szResvInfo; for (int m = 0; m < devResvTime.Length; m++) { uint uBeginTime2 = (uint)devResvTime[m].dwBegin; uint uEndTime2 = (uint)devResvTime[m].dwEnd; szResvInfo += uBeginTime2 / 100 + ":" + (uBeginTime2 % 100).ToString("00") + "到" + uEndTime2 / 100 + ":" + (uEndTime2 % 100).ToString("00"); if (m < (devResvTime.Length - 1)) { szResvInfo += ","; } } } szResvInfo += ""; ResvList = szResvInfo; DevName = vtRes[0].szDevName; string szResv = ""; szResvTime = GetHourStr((uint)vtRes[0].szRuleInfo.dwMinResvTime) + "到" + GetHourStr((uint)vtRes[0].szRuleInfo.dwMaxResvTime); szPreResvTime = GetHourStr((uint)vtRes[0].szRuleInfo.dwLatestResvTime) + "到" + GetHourStr((uint)vtRes[0].szRuleInfo.dwEarliestResvTime); if (vtRes[0].szRuleInfo.dwCancelTime != null && ((uint)vtRes[0].szRuleInfo.dwCancelTime).ToString() != "0") { cancelTime = "" + vtRes[0].szRuleInfo.dwCancelTime.ToString(); } else { cancelTime = "不取消"; } return; } } }
protected void Page_Load(object sender, EventArgs e) { uint uClassKind = Parse(Request["classKind"]); uint uDate = Parse(Request["dwDate"]); uint uDevID = Parse(Request["devID"]); uint uKindID = Parse(Request["kindID"]); if (m_Request == null) { Response.Write("{\"error\":\"\"}"); return; } DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_ALL; if (uClassKind != 0) { vrGet.dwClassKind = uClassKind; } if (uDevID != 0) { //vrGet.dwGetType = (uint)DEVRESVSTATREQ.DWGETTYPE.DEVRESVSTAT_DEVID; vrGet.dwDevID = uDevID; } if (uKindID != 0) { vrGet.szKindIDs = uKindID.ToString(); } vrGet.szDates = uDate.ToString(); vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL; vrGet.dwProperty = (uint)UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null) { if (uDevID != 0) { DevResvStateSingalAjax temp = new DevResvStateSingalAjax(); temp.OpenTime = ((int)vtRes[0].szOpenInfo[0].dwBegin * 10000 + (int)vtRes[0].szOpenInfo[0].dwEnd); temp.personNumLimit = vtRes[0].dwMinUsers + "人到" + vtRes[0].dwMaxUsers + "人"; string szResvInfo = ""; if (vtRes[0].szResvInfo != null && vtRes[0].szResvInfo.Length > 0) { DEVRESVTIME[] devResvTime = vtRes[0].szResvInfo; for (int m = 0; m < devResvTime.Length; m++) { szResvInfo += ((int)devResvTime[m].dwBegin * 10000 + (int)devResvTime[m].dwEnd).ToString(); if (m < (devResvTime.Length - 1)) { szResvInfo += ","; } } } szResvInfo += ""; temp.ResvList = szResvInfo; temp.DevName = vtRes[0].szDevName; string szResv = ""; temp.szResvTime = GetHourStr((uint)vtRes[0].szRuleInfo.dwMinResvTime) + "到" + GetHourStr((uint)vtRes[0].szRuleInfo.dwMaxResvTime); temp.szPreResvTime = GetHourStr((uint)vtRes[0].szRuleInfo.dwLatestResvTime) + "到" + GetHourStr((uint)vtRes[0].szRuleInfo.dwEarliestResvTime); if (((uint)vtRes[0].szRuleInfo.dwCancelTime) == 0) { temp.cancelTime = (int)vtRes[0].szRuleInfo.dwCancelTime; } else { temp.cancelTime = 0; } string szRes = JsonConvert.SerializeObject(temp); Response.Write(szRes); return; } } else { Response.Write("{\"error\":\"" + m_Request.szErrMessage + "\"}"); } }
protected void Page_Load(object sender, EventArgs e) { string szCamp = Request["szCamp"]; string szBuilding = Request["szBuilding"]; string szDate = Request["dates"]; string szDevName = Request["devName"]; string szKinds = Request["kinds"]; string szBeginTime = Request["beginTime"]; string szEndTime = Request["endTime"]; string YardActivitySN = Request["YardActivitySN"]; DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.szDates = szDate; if (szCamp != null && szCamp != "" && szCamp != "0") { vrGet.szCampusIDs = szCamp; } if (szBuilding != null && szBuilding != "" && szBuilding != "0") { vrGet.szBuildingIDs = szBuilding; } if (szDevName != null && szDevName != "") { vrGet.szDevName = (szDevName); } if (szKinds != null && szKinds != "" && szKinds != "0") { vrGet.szClassIDs = szKinds; } if (YardActivitySN != null && YardActivitySN != "" && YardActivitySN != "0") { vrGet.dwExtRelatedID = Parse(YardActivitySN); } DEVRESVSTAT[] vtDev; Response.CacheControl = "no-cache"; MyString szOut = new MyString(); szOut += "["; vrGet.szReqExtInfo.dwNeedLines = 100000; vrGet.szReqExtInfo.dwStartLine = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtDev) == REQUESTCODE.EXECUTE_SUCCESS && vtDev != null) { uint uBeginTime = Parse(szBeginTime); //7 uint uEndTime = Parse(szEndTime); //8 for (int i = 0; i < vtDev.Length; i++) { int bRes = 0; DEVRESVTIME[] devResvTime = vtDev[i].szResvInfo; if (devResvTime == null || devResvTime.Length == 0) { szOut += "{\"id\":\"" + vtDev[i].dwDevID + "\",\"statue\": \"" + bRes + "\",\"szCampName\": \"" + vtDev[i].szCampusName + "\",\"szDevName\": \"" + vtDev[i].szDevName + "\",\"szBuildingName\": \"" + vtDev[i].szBuildingName + "\",\"szKindName\": \"" + vtDev[i].szClassName + "\",\"dwMaxUser\": \"" + vtDev[i].dwMaxUsers + "\"}"; if (i < vtDev.Length - 1) { szOut += ","; } } else { for (int j = 0; j < devResvTime.Length; j++) { uint uStateResv = (uint)devResvTime[j].dwStatus; uint uBeginTimeResv = (uint)devResvTime[j].dwBegin; //6.5 uint uEndTimeResv = (uint)devResvTime[j].dwEnd; //7 if ((uStateResv & (uint)ADMINCHECK.DWCHECKSTAT.CHECKSTAT_ADMINOK) > 0) { if (uEndTimeResv <= uBeginTime || uBeginTimeResv >= uEndTime)//classic { continue; } else { bRes = -1; break; } } szOut += "{\"id\":\"" + vtDev[i].dwDevID + "\",\"statue\": \"" + bRes + "\",\"szCampName\": \"" + vtDev[i].szCampusName + "\",\"szDevName\": \"" + vtDev[i].szDevName + "\",\"szBuildingName\": \"" + vtDev[i].szBuildingName + "\",\"szKinds\": \"" + vtDev[i].szKindName + "\",\"dwMaxUser\": \"" + vtDev[i].dwMaxUsers + "\",\"dwMinUser\": \"" + vtDev[i].dwMinUsers + "\"}"; if (i < vtDev.Length - 1) { szOut += ","; } } } } } szOut += "]"; Response.Write(szOut); }
protected override void OnLoadComplete(EventArgs e) { roomid = Parse(Request["roomid"]); szSearchDate = Request["dwDate"];// DateTime.Now.ToString("yyyyMMdd"); string szSearchTime = Request["begintime"]; DEVRESVSTATREQ devResvStaReq = new DEVRESVSTATREQ(); devResvStaReq.szDates = szSearchDate; int uBegTime = 2359; int uEndTime = 0; devResvStaReq.szRoomIDs = roomid.ToString(); devResvStaReq.dwResvPurpose = 47;// (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_RESERVED; devResvStaReq.szReqExtInfo.dwNeedLines = 10000; devResvStaReq.dwReqProp = (uint)DEVRESVSTATREQ.DWREQPROP.DRREQ_NEEDALLDAYOPENRULE; devResvStaReq.szReqExtInfo.dwStartLine = 0; DEVRESVSTAT[] vtDevResvState; m_Request.m_UniDCom.StaSN = 1; int[] timeDay = new int[1440]; for (int j = 0; j < timeDay.Length; j++) { timeDay[j] = 0; } if (m_Request.Device.GetDevResvStat(devResvStaReq, out vtDevResvState) == REQUESTCODE.EXECUTE_SUCCESS && vtDevResvState != null && vtDevResvState.Length > 0) { uint uDevNum = (uint)vtDevResvState.Length; DAYOPENRULE[] dayOpenRule = vtDevResvState[0].szOpenInfo; for (int i = 0; i < dayOpenRule.Length; i++) { if (uBegTime > (int)dayOpenRule[i].dwBegin) { uBegTime = (int)dayOpenRule[i].dwBegin; } if (uEndTime < (int)dayOpenRule[i].dwEnd) { uEndTime = (int)dayOpenRule[i].dwEnd; } } for (int k = 0; k < vtDevResvState.Length; k++) { DEVRESVSTAT DevResvTemp = new DEVRESVSTAT(); DevResvTemp = vtDevResvState[k]; DEVRESVTIME[] resvTime = DevResvTemp.szResvInfo; if (resvTime != null && resvTime.Length > 0) { for (int n = 0; n < resvTime.Length; n++) { uint uBegin = ((uint)resvTime[n].dwBegin) / 100 * 60 + ((uint)resvTime[n].dwBegin) % 100; uint uEnd = ((uint)resvTime[n].dwEnd) / 100 * 60 + ((uint)resvTime[n].dwEnd) % 100; for (uint m = uBegin; m < uEnd; m++) { timeDay[m] = timeDay[m] + 1;//开放空闲 } } } } //以上计算出房间一天每一分钟的预约状况 m_szOutResv += "<div class=\"LGraphics\"><span>预约状态图</span>"; string szOpenStartTime = uBegTime / 100 + "." + (uBegTime % 100).ToString("00");; string szEndTime = uEndTime / 100 + "." + (uBegTime % 100).ToString("00");; ArrayList resvInfo = new ArrayList(); bool bIsBusy = false; uint uBeginTemp = 0; uint uEndTemp = 0; for (uint m = 0; m < timeDay.Length; m++) { if (timeDay[m] == uDevNum && bIsBusy == false) { bIsBusy = true; uBeginTemp = m; } if (timeDay[m] < uDevNum && bIsBusy == true) { bIsBusy = false; uEndTemp = m; DEVRESVTIME temp = new DEVRESVTIME(); temp.dwBegin = uBeginTemp / 60 * 100 + uBeginTemp % 60; temp.dwEnd = uEndTemp / 60 * 100 + uEndTemp % 60; resvInfo.Add(temp); } } string szResvInfo = "["; if (resvInfo != null && resvInfo.Count > 0) { for (int m = 0; m < resvInfo.Count; m++) { DEVRESVTIME temp = new DEVRESVTIME(); temp = (DEVRESVTIME)resvInfo[m]; szResvInfo += ((int)temp.dwBegin * 10000 + (int)temp.dwEnd); if ((m + 1) < (resvInfo.Count)) { szResvInfo += ","; } } } szResvInfo += "]"; m_szOutResv += "<canvas id='cav" + "" + "' data-start =\"" + szOpenStartTime + "\" data-end =\"" + szEndTime + "\" data-list=\"" + szResvInfo + "\"></canvas></div>"; m_szOutResv += "<div class=\"LBtn\"></div>"; } string szOptionAll = ""; for (int i = uBegTime; i <= uEndTime; i = i + 10) { if (i % 100 == 60) { i = (i + 100) / 100 * 100; //continue; } szOptionAll += GetInputItemHtml(CONSTHTML.option, "", i / 100 + ":" + (i % 100).ToString("00"), i.ToString()); } if (szSearchTime == "0") { if (szSearchDate == DateTime.Now.ToString("yyyyMMdd")) { uint uNowHM = Parse(DateTime.Now.ToString("HHmm")); if (uNowHM > uBegTime) { szSelectBeginTime = (uNowHM / 100 + 1) + "00"; } else { szSelectBeginTime = uBegTime.ToString(); } } else { szSelectBeginTime = uBegTime.ToString(); } } else { if (szSearchDate == DateTime.Now.ToString("yyyyMMdd")) { uint uNowHM = Parse(DateTime.Now.ToString("HHmm")); if (uNowHM > (Parse(szSearchTime) * 100)) { szSelectBeginTime = (uNowHM / 100 + 1) + "00"; } else { szSelectBeginTime = szSearchTime + "00"; } } else { szSelectBeginTime = szSearchTime + "00"; } } szSelectEndTime = uEndTime.ToString(); m_szOut += "<div class=\"Item\" value=" + (uBegTime * 10000 + uEndTime) + ">"; m_szOut += "<div style='margin:20px'>开始时间:<select id='dwBeginTime' name='dwBeginTime'>" + szOptionAll + "</select></div>"; m_szOut += "<div style='margin:20px'>结束时间:<select id='dwEndTime' name='dwEndTime'>" + szOptionAll + "</select></div>"; m_szOut += "<div style='margin:20px'><button roomid=" + roomid + " class='btnTimeClass' id='allDay'>查询→</button></div>"; m_szOut += "</div>"; }
protected void Page_Load(object sender, EventArgs e) { string szOp = Request["op"]; uint uBeginTime = Parse(Request["dwBeginTime"]); uint uEndTime = Parse(Request["dwEndTime"]); string uResvDate = Request["resvDate"]; uint uNeedHour = Parse(Request["NeedHour"]); uint timePart = uBeginTime * 10000 + uEndTime; uint uPassBeginTime = timePart / 10000; uint uPassEndTime = timePart % 10000; string szroomid = (Request["szLabID"]); if (szOp == "getPostion") { if (m_Request == null) { Response.Write("{\"error1\":\"\"}"); return; } DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.dwReqProp = (uint)DEVRESVSTATREQ.DWREQPROP.DRREQ_NEEDALLDAYOPENRULE; if (szroomid != null && szroomid != "") { vrGet.szRoomIDs = szroomid; } if (uResvDate == "" || uResvDate == null) { vrGet.szDates = DateTime.Now.ToString("yyyyMMdd"); } else { vrGet.szDates = uResvDate.Replace("-", ""); } vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_SEAT; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null) { ArrayList listPostion = new ArrayList(); if (vtRes.Length > 0) { listPostion = GetListFromXml(vtRes[0].dwRoomID); } List <DevAjax> list = new List <DevAjax>(); for (int i = 0; i < vtRes.Length; i++) { DevAjax dev = new DevAjax(); dev.uStatus = 1;//忙碌 dev.x = "0"; dev.y = "0"; for (int k = 0; k < listPostion.Count; k++) { devPostion postionTemp = (devPostion)listPostion[k]; if (postionTemp.devid == vtRes[i].dwDevID.ToString()) { dev.x = postionTemp.x; dev.y = postionTemp.y; break; } } dev.devID = (uint)vtRes[i].dwDevID; dev.DevName = vtRes[i].szDevName; list.Add(dev); } string szRes = JsonConvert.SerializeObject(list); Response.Write(szRes); return; } } if (szOp == "get") { //当做roomid使用需要小心 if (m_Request == null) { Response.Write("{\"error\":\"\"}"); return; } DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.dwReqProp = (uint)DEVRESVSTATREQ.DWREQPROP.DRREQ_NEEDALLDAYOPENRULE; if (szroomid != null && szroomid != "") { vrGet.szRoomIDs = szroomid; } if (uResvDate == "" || uResvDate == null) { vrGet.szDates = DateTime.Now.ToString("yyyyMMdd"); } else { vrGet.szDates = uResvDate.Replace("-", ""); } vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_SEAT; vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { ArrayList listPostion = new ArrayList(); if (vtRes.Length > 0) { listPostion = GetListFromXml(vtRes[0].dwRoomID); } List <DevAjax> list = new List <DevAjax>(); for (int i = 0; i < vtRes.Length; i++) { DevAjax dev = new DevAjax(); dev.uStatus = 2;//忙碌 DAYOPENRULE[] openRuleList = vtRes[i].szOpenInfo; uint uBeginMin = 0; for (int k = 0; k < openRuleList.Length; k++) { if (uPassBeginTime < (uint)openRuleList[k].dwBegin) { uPassBeginTime = (uint)openRuleList[k].dwBegin; } if (uPassEndTime > (uint)openRuleList[k].dwEnd) { uPassEndTime = (uint)openRuleList[k].dwEnd; } } string dtNowDate = DateTime.Now.ToString("yyyMMdd"); string dateNowHour = DateTime.Now.ToString("HHmm"); uint udateNowHour = Parse(dateNowHour); if (dtNowDate == vrGet.szDates.ToString()) { if (udateNowHour > uPassBeginTime) { uPassBeginTime = udateNowHour; } } uBeginMin = uPassBeginTime / 100 * 60 + uPassBeginTime % 100; int nLen = (int)(uPassEndTime / 100 * 60 + uPassEndTime % 100) - ((int)(uPassBeginTime / 100 * 60 + uPassBeginTime % 100)); if (nLen < 0) { nLen = 0; } uint[] uOpenList = new uint[nLen]; for (int k = 0; k < nLen; k++) { uOpenList[k] = 1;//1表示空闲 } if (openRuleList != null && openRuleList.Length > 0) { string szTemp = ""; for (int m = 0; m < openRuleList.Length; m++) { szTemp += ((uint)openRuleList[m].dwBegin * 10000 + (uint)openRuleList[m].dwEnd).ToString() + ","; } dev.openTime = szTemp; } DEVRESVTIME[] resvTime = vtRes[i].szResvInfo; Logger.trace("info2" + vtRes[i].szDevName.ToString()); if (resvTime != null) { for (int m = 0; m < resvTime.Length; m++) { uint uBeginTemp = (uint)resvTime[m].dwBegin; // / 100 * 60 + (uint)resvTime[m].dwBegin%100; uint uEndTemp = (uint)resvTime[m].dwEnd; // / 100 * 60 + (uint)resvTime[m].dwEnd%100; if (uBeginTemp < uPassBeginTime) { uBeginTemp = uPassBeginTime; } if (uEndTemp > uPassEndTime) { uEndTemp = uPassEndTime; } if (dtNowDate == vrGet.szDates.ToString()) { if (udateNowHour > uBeginTemp) { uBeginTemp = udateNowHour; } } uBeginTemp = uBeginTemp / 100 * 60 + uBeginTemp % 100 - uBeginMin; if (uEndTemp / 100 * 60 + uEndTemp % 100 > uBeginMin) { uEndTemp = uEndTemp / 100 * 60 + uEndTemp % 100 - uBeginMin; } for (uint j = uBeginTemp; j < uEndTemp; j++) { if (uOpenList.Length > j) { uOpenList[j] = 0;//0表示被预约 } } } } Logger.trace("info3"); uint uCount = 0; for (uint m = 0; m < nLen; m++) { if (uOpenList[m] == 0)//0表示被预约 { uCount = uCount + 1; } } dev.x = "0"; dev.y = "0"; for (int k = 0; k < listPostion.Count; k++) { devPostion postionTemp = (devPostion)listPostion[k]; if (postionTemp.devid == vtRes[i].dwDevID.ToString()) { dev.x = postionTemp.x; dev.y = postionTemp.y; break; } } dev.devID = (uint)vtRes[i].dwDevID; dev.DevName = vtRes[i].szDevName; dev.uStatus = 1; double fResv = 1 - ((uCount * 1.0) / nLen);//ucount预约数量,n总数量 if (fResv <= 0) { dev.uStatus = 0; } else if (fResv > 0 && fResv <= 0.25) { dev.uStatus = 25; } else if (fResv > 0.25 && fResv <= 0.5) { dev.uStatus = 50; } else if (fResv > 0.5 && fResv <= 0.75) { dev.uStatus = 75; } else { dev.uStatus = 100; } list.Add(dev); } /* * for (int i = 0; i < vtRes.Length; i++) * { * DevAjax dev = new DevAjax(); * dev.uStatus = 2;//忙碌 * * DAYOPENRULE[] openRuleList = vtRes[i].szOpenInfo; * uint uBeginMin = 0; * if (uPassBeginTime < (uint)openRuleList[0].dwBegin) * { * uPassBeginTime = (uint)openRuleList[0].dwBegin; * } * if (uPassEndTime > (uint)openRuleList[0].dwEnd) * { * uPassEndTime = (uint)openRuleList[0].dwEnd; * } * * string dtNowDate = DateTime.Now.ToString("yyyMMdd"); * string dateNowHour = DateTime.Now.ToString("HHmm"); * uint udateNowHour = Parse(dateNowHour); * if (dtNowDate == vrGet.szDates.ToString()) * { * if (udateNowHour > uPassBeginTime) * { * uPassBeginTime = udateNowHour; * } * * } * uBeginMin = uPassBeginTime / 100 * 60 + uPassBeginTime % 100; * int nLen = (int)(uPassEndTime / 100 * 60 + uPassEndTime % 100) - ((int)(uPassBeginTime / 100 * 60 + uPassBeginTime % 100)); * if (nLen < 0) * { * nLen = 0; * } * uint[] uOpenList = new uint[nLen]; * for (int k = 0; k < nLen; k++) * { * uOpenList[k] = 1;//1表示空闲 * } * * if (openRuleList != null && openRuleList.Length > 0) * { * string szTemp = ""; * for (int m = 0; m < openRuleList.Length; m++) * { * szTemp += ((uint)openRuleList[m].dwBegin * 10000 + (uint)openRuleList[m].dwEnd).ToString() + ","; * } * dev.openTime = szTemp; * } * DEVRESVTIME[] resvTime = vtRes[i].szResvInfo; * if (resvTime != null) * { * * for (int m = 0; m < resvTime.Length; m++) * { * uint uBeginTemp = (uint)resvTime[m].dwBegin;// / 100 * 60 + (uint)resvTime[m].dwBegin%100; * uint uEndTemp = (uint)resvTime[m].dwEnd;// / 100 * 60 + (uint)resvTime[m].dwEnd%100; * * if (uBeginTemp < uPassBeginTime) * { * uBeginTemp = uPassBeginTime; * } * if (uEndTemp > uPassEndTime) * { * uEndTemp = uPassEndTime; * } * if (dtNowDate == vrGet.szDates.ToString()) * { * if (udateNowHour > uBeginTemp) * { * uBeginTemp = udateNowHour; * } * * } * uBeginTemp = uBeginTemp / 100 * 60 + uBeginTemp % 100 - uBeginMin; * uEndTemp = uEndTemp / 100 * 60 + uEndTemp % 100 - uBeginMin; * for (uint j = uBeginTemp; j < uEndTemp; j++) * { * if (uOpenList.Length > j) * { * uOpenList[j] = 0;//0表示被预约 * } * * } * } * } * uint uCount = 0; * for (uint m = 0; m < nLen; m++) * { * if (uOpenList[m] == 0)//0表示被预约 * { * uCount = uCount + 1; * } * } * * dev.x = "0"; * dev.y = "0"; * for (int k = 0; k < listPostion.Count; k++) * { * devPostion postionTemp = (devPostion)listPostion[k]; * if (postionTemp.devid == vtRes[i].dwDevID.ToString()) * { * dev.x = (FloatParse(postionTemp.x) + 13).ToString(); * dev.y = postionTemp.y; * break; * } * } * dev.devID = (uint)vtRes[i].dwDevID; * dev.DevName = vtRes[i].szDevName; * dev.uStatus = 1; * double fResv = 1 - ((uCount * 1.0) / nLen);//ucount预约数量,n总数量 * if (fResv <= 0) * { * dev.uStatus = 0; * } * else if (fResv > 0 && fResv <= 0.25) * { * dev.uStatus = 25; * } * else if (fResv > 0.25 && fResv <= 0.5) * { * dev.uStatus = 50; * } * else if (fResv > 0.5 && fResv <= 0.75) * { * dev.uStatus = 75; * } * else * { * dev.uStatus = 100; * } * list.Add(dev); * } */ string szRes = JsonConvert.SerializeObject(list); Response.Write(szRes); return; } else { Response.Write("{\"error\":\"" + m_Request.szErrMessage + "\"}"); } } else if (szOp == "save") { string devid = Request["devid"]; string x = Request["x"]; string y = Request["y"]; SavedevPostion(devid, x, y); } else if (szOp == "getSingnal") { uint uDevID = Parse(Request["devid"]); DEVRESVSTATREQ vrGet = new DEVRESVSTATREQ(); vrGet.dwReqProp = (uint)DEVRESVSTATREQ.DWREQPROP.DRREQ_NEEDALLDAYOPENRULE; if (uResvDate == "" || uResvDate == null) { vrGet.szDates = DateTime.Now.ToString("yyyyMMdd"); } else { vrGet.szDates = uResvDate.Replace("-", ""); } vrGet.dwResvPurpose = (uint)UNIRESERVE.DWPURPOSE.USEFOR_PERSONNAL + (uint)UNIRESERVE.DWPURPOSE.USEFOR_SEAT; if (uDevID != 0) { vrGet.dwDevID = uDevID; } else { Response.Write("获取预约信息失败"); } vrGet.szReqExtInfo.dwStartLine = 0; vrGet.szReqExtInfo.dwNeedLines = 10000; vrGet.szReqExtInfo.szOrderKey = "szDevName"; vrGet.szReqExtInfo.szOrderMode = "desc"; DEVRESVSTAT[] vtRes; m_Request.m_UniDCom.StaSN = 1; string szResvTime = "空闲"; if (m_Request.Device.GetDevResvStat(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { DEVRESVTIME[] resvTime = vtRes[0].szResvInfo; if (resvTime != null && resvTime.Length > 0) { szResvTime = ""; for (int i = 0; i < resvTime.Length; i++) { uint uEnd = (uint)resvTime[i].dwEnd; uint uBegin = (uint)resvTime[i].dwBegin; szResvTime += uBegin / 100 + ":" + (uBegin % 100).ToString("00") + "-" + uEnd / 100 + ":" + (uEnd % 100).ToString("00") + ","; } } } Response.Write(szResvTime); } }