public bool bookNextAppointments(appointment prevApp, int weekOffset, bool[] days, DateTime[] times, int[] type) { try { DateTime baseDate = Utility.GetFirstDayOfWeek(prevApp.appDate).AddDays(7 * weekOffset); appointment[] appointments = new appointment[5]; for (int i = 0; i < 5; i++) { if (days[i]) { DateTime appDate = baseDate.AddDays(i+1) + times[i].TimeOfDay; appointment app = new appointment(); app.appDate = appDate; app.appDuration = prevApp.appDuration; app.appStatusID = 0; app.docID = prevApp.docID; app.patID = prevApp.patID; app.itryID = type[i]; app.appRenewIntervalID = 0; app.appColour = prevApp.appColour; app.appDateCreate = DateTime.Today; appointments[i] = app; } } // Once all the appointments have been parsed save to database foreach (appointment app in appointments) { if(app != null) { saveAppointment(app); } } } catch (Exception e) { return false; } return true; }
/// <summary> /// Create a new appointment object. /// </summary> /// <param name="appID">Initial value of the appID property.</param> /// <param name="appDate">Initial value of the appDate property.</param> /// <param name="appDateCreate">Initial value of the appDateCreate property.</param> /// <param name="appStatusID">Initial value of the appStatusID property.</param> /// <param name="appDuration">Initial value of the appDuration property.</param> public static appointment Createappointment(global::System.Int32 appID, global::System.DateTime appDate, global::System.DateTime appDateCreate, global::System.Int32 appStatusID, global::System.Int32 appDuration) { appointment appointment = new appointment(); appointment.appID = appID; appointment.appDate = appDate; appointment.appDateCreate = appDateCreate; appointment.appStatusID = appStatusID; appointment.appDuration = appDuration; return appointment; }
public void saveAppointment(appointment app) { Context.AddToappointments(app); saveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the appointments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToappointments(appointment appointment) { base.AddObject("appointments", appointment); }