public int RevokeReservation(string serviceBrokerGuid, string groupName, string labServerGuid, string labClientGuid, DateTime startTime, DateTime endTime, string message) { bool status = false; bool fromISB = false; int count = 0; Coupon opCoupon = new Coupon(); opCoupon.couponId = opHeader.coupon.couponId; opCoupon.passkey = opHeader.coupon.passkey; opCoupon.issuerGuid = opHeader.coupon.issuerGuid; UserSchedulingDB dbManager = new UserSchedulingDB(); try { Ticket retrievedTicket = dbManager.RetrieveAndVerify(opCoupon, TicketTypes.REVOKE_RESERVATION); if (retrievedTicket.payload != null && retrievedTicket.payload.Length > 0) { XmlQueryDoc revokeDoc = new XmlQueryDoc(retrievedTicket.payload); string sourceStr = revokeDoc.Query("RevokeReservationPayload/source"); if (sourceStr != null && sourceStr.CompareTo("ISB") == 0) { fromISB = true; } } DateTime targetStart = new DateTime(startTime.Year, startTime.Month, startTime.Day, startTime.Hour, startTime.Minute, 0, startTime.Kind); if (targetStart.Kind != DateTimeKind.Utc) targetStart = targetStart.ToUniversalTime(); DateTime targetEnd = new DateTime(endTime.Year, endTime.Month, endTime.Day, endTime.Hour, endTime.Minute, 0, endTime.Kind); if (targetEnd.Kind != DateTimeKind.Utc) targetEnd = targetEnd.ToUniversalTime(); if (fromISB) { // Need to forward to LSS string lssUrl = dbManager.ListLssUrlByExperiment(labClientGuid, labServerGuid); if (lssUrl != null && lssUrl.Length > 0) { LabSchedulingProxy lssProxy = new LabSchedulingProxy(); lssProxy.OperationAuthHeaderValue = new OperationAuthHeader(); lssProxy.OperationAuthHeaderValue.coupon = opCoupon; lssProxy.Url = lssUrl; int rCount = lssProxy.RemoveReservation(serviceBrokerGuid, groupName, ProcessAgentDB.ServiceGuid, labServerGuid, labClientGuid, targetStart, targetEnd); } } ReservationData[] ris = dbManager.GetReservations(serviceBrokerGuid, null, groupName, labServerGuid, labClientGuid, targetStart, targetEnd); if (ris != null && ris.Length > 0) { InteractiveSBProxy sbProxy = new InteractiveSBProxy(); ProcessAgentInfo sbInfo = dbManager.GetProcessAgentInfo(ProcessAgentDB.ServiceAgent.domainGuid); AgentAuthHeader header = new AgentAuthHeader(); header.coupon = sbInfo.identOut; header.agentGuid = ProcessAgentDB.ServiceGuid; sbProxy.AgentAuthHeaderValue = header; sbProxy.Url = sbInfo.webServiceUrl; foreach (ReservationData rd in ris) { status = dbManager.RevokeReservation(rd.sbGuid, rd.groupName, rd.lsGuid, rd.clientGuid, rd.startTime, rd.endTime, message); if (status) { count++; status = sbProxy.RevokeReservation(rd.sbGuid, rd.userName, rd.groupName, rd.lsGuid, rd.clientGuid, rd.startTime, rd.endTime, message); } } } } catch (Exception e) { throw new Exception("USS: RevokeReservation -> ",e); } return count; }