示例#1
0
        public static int RevokeReservation(ReservationInfo ri)
        {
            int count = 0;
            LssCredentialSet[] sets = DBManager.GetCredentialSets(new int[] { ri.credentialSetId });
            LssExperimentInfo[] exps = DBManager.GetExperimentInfos(new int[] { ri.experimentInfoId });
            if (sets != null && sets.Length > 0 && exps != null && exps.Length > 0)
            {

                USSInfo uss = DBManager.GetUSSInfo(sets[0].ussGuid);
                if (uss != null)
                {
                    ProcessAgentDB paDB = new ProcessAgentDB();
                    UserSchedulingProxy ussProxy = new UserSchedulingProxy();
                    OperationAuthHeader header = new OperationAuthHeader();
                    header.coupon = paDB.GetCoupon(uss.couponId, uss.domainGuid);
                    ussProxy.OperationAuthHeaderValue = header;
                    ussProxy.Url = uss.ussUrl;

                    int num = ussProxy.RevokeReservation(sets[0].serviceBrokerGuid, sets[0].groupName,
                        exps[0].labServerGuid, exps[0].labClientGuid, ri.Start, ri.End, "The reservation time assigned to this reservation is being removed");
                    if (num > 0)
                    {
                        LSSSchedulingAPI.RemoveReservationInfoByIDs(new int[] { ri.reservationInfoId });
                        count += num;
                    }
                }
             }

            return count;
        }