/// <summary> /// Create a new Appointment /// </summary> /// <param name="user">The creating user</param> /// <param name="travelType">An integer defined on TravelPlan.TravelType</param> /// <param name="loc">GPS location</param> /// <param name="invitees">A list of participants</param> /// <param name="locType">The kind of location to look for, defined on Location.LocationType</param> /// <param name="msg">A message to include in the invitations</param> /// <param name="cb">The callback to pass the created Appointment to</param> /// <param name="errorCb">An error callback</param> public static void Create(Account user, int travelType, Participant[] invitees, int locType, string msg, Action<Appointment> cb, Action<ErrorInfo> errorCb) { List<string> inviteeNames = new List<string>(); foreach (Participant invitee in invitees) { inviteeNames.Add(invitee.userId); } Appointment.Create(user, travelType, invitees, inviteeNames.ToArray(), locType, msg, cb, errorCb); }
public static void Create(Account user, int travelType, Participant[] invitees, string[] inviteeNames, int locType, string msg, Action<Appointment> cb, Action<ErrorInfo> errorCb) { withGpsLocationDo((Location loc) => { ServiceCall.Invoke(ServiceCallCreate, (Response result) => { if (!result.success) { errorCb(result.error); } else { Appointment.Find(Convert.ToInt32(result.payload), cb, errorCb); }; }, user.userId, travelType, loc, inviteeNames, locType, msg); }, errorCb); }
/// <summary> /// Creates a new User account on the server. /// </summary> /// <param name="userId">The new user name</param> /// <param name="cb">A callback to pass the created account to</param> /// <param name="errorCb">An error callback that will receive ErrorInfo</param> public static void Create(string userId, Action<Account> callback, Action<ErrorInfo> errorCallback) { ServiceCall.Invoke(ServiceCallCreate, (Response result) => { if (!result.success) { errorCallback(result.error); } else { Account a = new Account(); if (result.payload != null) { var ids = from id in (result.payload as List<Object>) where (id != null) select (Convert.ToInt32(id)); a.AppointmentIds = new List<int>(ids); } else { a.AppointmentIds = new List<int>(); } a.userId = userId; a.OpenNotificationChannel(); callback(a); } }, userId, null); }
public void Decline(Account user, Action cb, Action<ErrorInfo> errorCb) { ServiceCall.Invoke(ServiceCallDecline, (Response result) => { if (!result.success) { errorCb(result.error); } else { foreach (Participant p in this.participants) { if (p.Equals(user)) { p.status = Participant.ParticipationStatus.Declined; break; } } cb(); } }, this.identifier, user.userId); }
public void Join(Account user, int travelType, Action cb, Action<ErrorInfo> errorCb) { withGpsLocationDo((Location loc) => { ServiceCall.Invoke(ServiceCallJoin, (Response result) => { if (!result.success) { errorCb(result.error); } else { foreach (Participant p in this.participants) { if (p.Equals(user)) { p.status = Participant.ParticipationStatus.Joined; break; } } cb(); } }, this.identifier, user.userId, travelType, loc); }, errorCb); }