public static List <CalendarSlot> GetSlotsByPeriod(int calendarId, string dayPeriod, string userId) { List <CalendarSlot> listCalendars = new List <CalendarSlot>(); bool appoinmentsOnly = false; string typeSerializer = "XML"; WebAppoinmentsClientLibrary.Calendars calendars = new WebAppoinmentsClientLibrary.Calendars(); listCalendars = calendars.GetSlotsByPeriod(calendarId, dayPeriod, userId); return(listCalendars); }
/// <summary> /// This method free up the reserved slots /// </summary> /// <param name="calendarId"></param> /// <param name="ordinalNumber"></param> public static void FreeUpSlots(int calendarId, int ordinalNumber) { List <int> listIntSlots = new List <int>(); //here we need to add the ordinal number an the id resarvation cause, if don'0t have reservations you should create them listIntSlots.Add(ordinalNumber); string typeSerializer = "XML"; WebAppoinmentsClientLibrary.Calendars calendars = new WebAppoinmentsClientLibrary.Calendars(); calendars.FreeUpSlots(calendarId, listIntSlots, typeSerializer); }
/// <summary> /// This method reserve an slot /// </summary> /// <param name="calendarId"></param> /// <param name="reserveId"></param> public static void ReserveSlots(int calendarId, int ordinalNumber, int reserveId) { Dictionary <int, int> myDictionary = new Dictionary <int, int>(); //here we need to add the ordinal number an the id resarvation cause, if don'0t have reservations you should create them myDictionary.Add(ordinalNumber, 1); string typeSerializer = "XML"; WebAppoinmentsClientLibrary.Calendars calendars = new WebAppoinmentsClientLibrary.Calendars(); calendars.ReserveSlots(calendarId, myDictionary, typeSerializer); }
public static List <CalendarGetSlotsResults> GetAvailablesSlots(int calendarId) { List <CalendarSlot> listCalendars = new List <CalendarSlot>(); List <CalendarGetSlotsResults> listCalendarGetSlotsResult = new List <CalendarGetSlotsResults>(); List <string> listSlotsName = new List <string>(); bool appoinmentsOnly = false; string typeSerializer = "XML"; WebAppoinmentsClientLibrary.Calendars calendars = new WebAppoinmentsClientLibrary.Calendars(); listCalendarGetSlotsResult = calendars.GetSlotsByCalendarId(calendarId, appoinmentsOnly, typeSerializer); return(listCalendarGetSlotsResult); }
/// <summary> /// Get a list of calendars by service Id and date /// </summary> /// <param name="_serviceId"></param> /// <param name="startDate"></param> /// <returns></returns> public static List <Calendar> GetCalendars(string _serviceId, string startDate) { List <Calendar> listCalendars = new List <Calendar>(); int serviceId = Convert.ToInt32(_serviceId); int appoinmentTypeId = 1; // DateTime dateFromString =DateTime.Parse(startDate, System.Globalization.CultureInfo.InvariantCulture); DateTime dateFromString = DateTime.Today; DateTime endDate = dateFromString.AddDays(3); WebAppoinmentsClientLibrary.Calendars calendar = new WebAppoinmentsClientLibrary.Calendars(); listCalendars = calendar.GetCalendars(serviceId, dateFromString, endDate, appoinmentTypeId, "XML"); return(listCalendars); }
/// <summary> /// This methos lock the specific slot by ordinal number /// </summary> /// <param name="calendarId"></param> /// <param name="ordinalNumber"></param> public static void LockSlots(int calendarId, int ordinalNumber) { List <int> listIntSlots = new List <int>(); try { //here we need to add the ordinal(s) number to lock listIntSlots.Add(ordinalNumber); WebAppoinmentsClientLibrary.Calendars calendars = new WebAppoinmentsClientLibrary.Calendars(); calendars.LockSlots(calendarId, listIntSlots, 0); } catch (Exception ex) { throw; } }
public static List <GroupCalendarSlot> GetGroupCalendarSlot(int calendarId) { List <GroupCalendarSlot> listGroupCalendarSlot = new List <GroupCalendarSlot>(); bool appointmentsOnly = false; string userName = ""; bool includeVacantTime = false; bool includeReservedTime = false; string typeSerializer = ""; try { WebAppoinmentsClientLibrary.Calendars calendarLibrary = new WebAppoinmentsClientLibrary.Calendars(); listGroupCalendarSlot = calendarLibrary.GetSlotsGrouped(calendarId, appointmentsOnly, userName, includeVacantTime, includeReservedTime, typeSerializer); } catch (Exception) { throw; } return(listGroupCalendarSlot); }
public static IForm <StatusForm> BuildForm() { OnCompletionAsyncDelegate <StatusForm> processOrder = async(context, state) => { //DEclarationof variables to consume the method bool appoinmentsOnly = false; string typeSeriaizer = "XML"; string displayEndTime = String.Empty; //Declaration of Calendar Get Slots Results oobject CalendarGetSlotsResults slotToShowInformation = new CalendarGetSlotsResults(); //Declaration of an instance of the library WebAppoinmentsClientLibrary WebAppoinmentsClientLibrary.Calendars calendar = new WebAppoinmentsClientLibrary.Calendars(); //Declaration od List for keep the CalendarGetSlotsResults, from the library List <CalendarGetSlotsResults> listCalendarSlots = calendar.GetSlotsByCalendarId(state.calendarId, appoinmentsOnly, typeSeriaizer); //Read the list for search the cappoinment id, in this case the ordinal number foreach (CalendarGetSlotsResults calendarGetSlotsResults in listCalendarSlots) { if (calendarGetSlotsResults.OrdinalNumber == state.appoinmentId) { slotToShowInformation.OrdinalNumber = calendarGetSlotsResults.OrdinalNumber; slotToShowInformation.QNumber = calendarGetSlotsResults.QNumber; slotToShowInformation.Duration = calendarGetSlotsResults.Duration; slotToShowInformation.StartTime = calendarGetSlotsResults.StartTime; slotToShowInformation.CustomerFirstName = calendarGetSlotsResults.CustomerFirstName; displayEndTime = calendarGetSlotsResults.DisplayEndTime.ToString(); slotToShowInformation.Status = calendarGetSlotsResults.Status; } } //Get the customer id saved for show it int mycustomerid; if (!context.PrivateConversationData.TryGetValue <int>("customerId", out mycustomerid)) { mycustomerid = 0; } //If the ordinal number is different of 0, means that we find it aone register if (slotToShowInformation.OrdinalNumber != 0) { await context.PostAsync($" The customer Id is: " + mycustomerid + "The actual information is \n* Status: " + slotToShowInformation.Status.ToString() + " \n* Customer name: " + slotToShowInformation.CustomerFirstName + "\n* start time: " + slotToShowInformation.DisplayStartTime.ToString() + "------ Or= " + slotToShowInformation.StartTime.ToString() + " Past midnight" + "\n* end time: " + displayEndTime + " \n* duration: " + slotToShowInformation.Duration.ToString() ); } // in other hand we dont'find a register, so ,we will send the appropiate mmesage else { await context.PostAsync($"The customer Id is: " + mycustomerid + "I don't have a register to match with calendarid: \n* " + state.calendarId + "appoinment Id: \n*" + state.appoinmentId); } }; CultureInfo ci = new CultureInfo("en"); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; var culture = Thread.CurrentThread.CurrentUICulture; var form = new FormBuilder <StatusForm>(); var yesTerms = form.Configuration.Yes.ToList(); var noTerms = form.Configuration.No.ToList(); yesTerms.Add("Yes"); noTerms.Add("No"); form.Configuration.Yes = yesTerms.ToArray(); return(form.Message("Fill the information for search the appoinment, please") .Field(nameof(calendarId)) .Field(nameof(appoinmentId)) .Confirm("Are you selected the calendar id {calendarId}, and slot {appoinmentId}: ? (yes/no)") .AddRemainingFields() //.Message("The process for create the appoinment has been started!") .OnCompletion(processOrder) .Build()); }