void getTimePeriods() { OperationAuthHeader opHeader = new OperationAuthHeader(); opHeader.coupon = coupon; LabSchedulingProxy lssProxy = new LabSchedulingProxy(); lssProxy.Url = lssURL; lssProxy.OperationAuthHeaderValue = opHeader; TimePeriod[] availablePeriods = lssProxy.RetrieveAvailableTimePeriods(serviceBrokerGuid, groupName, "", labServerGuid, clientGuid, startTime, endTime); if (availablePeriods == null) { string msg = "There are no available time slots for this experiment."; lblErrorMessage.Text = Utilities.FormatWarningMessage(msg); lblErrorMessage.Visible = true; btnMakeReservation.Visible = false; // btnMakeReservation1.Visible = false; cntrScheduling.Visible=false; } else{ if (availablePeriods.Length > 0) { minTime = availablePeriods[0].quantum > minRequiredTime.TotalMinutes ? TimeSpan.FromMinutes(availablePeriods[0].quantum) : minRequiredTime; } cntrScheduling.Visible = true; cntrScheduling.StartTime = startTime; cntrScheduling.EndTime = endTime; cntrScheduling.UserTZ = userTZ; cntrScheduling.Culture = culture; cntrScheduling.DataSource = availablePeriods; cntrScheduling.DataBind(); } }
public TimePeriod[] RetrieveAvailableTimePeriods(string serviceBrokerGuid, string groupName, string labServerGuid, string clientGuid, DateTime startTime, DateTime endTime) { Coupon opCoupon = new Coupon(); opCoupon.couponId = opHeader.coupon.couponId; opCoupon.passkey = opHeader.coupon.passkey; opCoupon.issuerGuid = opHeader.coupon.issuerGuid; try { UserSchedulingDB dbManager = new UserSchedulingDB(); Ticket ssTicket = dbManager.RetrieveAndVerify(opCoupon, TicketTypes.SCHEDULE_SESSION); string lssGuid = dbManager.ListLssIdByExperiment(clientGuid, labServerGuid); LSSInfo lssInfo = dbManager.GetLSSInfo(lssGuid); LabSchedulingProxy lssProxy = new LabSchedulingProxy(); lssProxy.OperationAuthHeaderValue = new OperationAuthHeader(); lssProxy.OperationAuthHeaderValue.coupon = opCoupon; lssProxy.Url = lssInfo.lssUrl; TimePeriod[] array = lssProxy.RetrieveAvailableTimePeriods( serviceBrokerGuid, groupName, ProcessAgentDB.ServiceGuid, labServerGuid, clientGuid, startTime, endTime); return array; } catch { throw; } }