public DecisionMessage GetMeetingDecisions(Guid meetingId, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_decisionRepository.GetDecisionCollection(meetingId, user.InstanceId, instanceConnectionString));
        }
        public MeetingMessage CreateEmptyUserMeeting(AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_userMeetingsRepository.CreateEmptyUserMeeting(user.Email, user.InstanceId, instanceConnectionString));
        }
        public (bool condition, string message, IEnumerable <MinutzAction> data) GetMinutzActions
            (string referenceId, AuthRestModel user)
        {
            if (string.IsNullOrEmpty(referenceId))
            {
                throw new ArgumentNullException(nameof(referenceId), "Please provide a valid reference id.");
            }

            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                    _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password);

            if (referenceId != user.InstanceId)
            {
                var actions =
                    _actionRepository.GetMeetingActions(Guid.Parse(referenceId), user.InstanceId, instanceConnectionString);
                return(true, "", actions);
            }

            // check if referenceId is a meetingViewModel id
            // if id is a meetingViewModel id then check if meetingViewModel has actions for user

            // if meetingViewModel is not a meetingViewModel id [referenceId] then use it as the user Id and check for actions - these become tasks
            return(true, "", new List <MinutzAction>());
        }
Beispiel #4
0
        /// <summary>
        /// Get the user by email not the token
        /// </summary>
        /// <param name="email">Email of the user</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public AuthRestModelResponse GetUserInfo(string email)
        {
            var result = new AuthRestModelResponse {
                Condition = false
            };
            var user = _userManager.Users.SingleOrDefault(i => i.Email == email);

            if (user == null)
            {
                return(result);
            }

            result.InfoResponse = new AuthRestModel {
                Email = email
            };
            var dbUser = _userRepository.GetUserByEmail(email, "app", _applicationSetting.CreateConnectionString());

            if (dbUser == null)
            {
                return(result);
            }

            var rolesResponse = _minutzRoleManager.Roles(_userManager, email);
            var tokenResponse = GenerateJwtToken(email, user, rolesResponse.Roles);

            result.InfoResponse.FirstName = dbUser.FirstName;
            result.Code         = 200;
            result.Condition    = true;
            result.InfoResponse = dbUser.ToModel
                                      (user.EmailConfirmed, user.Id, tokenResponse.expires_in, tokenResponse.access_token);
            return(result);
        }
Beispiel #5
0
        public AttachmentMessage Get(Guid meetingId, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_meetingAttachmentRepository.Get(meetingId, user.InstanceId,
                                                    instanceConnectionString));
        }
Beispiel #6
0
        /// <summary>
        /// Get the attendees that can be used for a meeting
        /// </summary>
        /// <param name="user">Current logged in user</param>
        /// <returns>Collection of people that can be used for a meeting</returns>
        public AttendeeMessage GetAvailableAttendees(AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));
            var masterConnectionString = _applicationSetting.CreateConnectionString();

            return(_minutzAvailabilityRepository.GetAvailableAttendees(user.InstanceId, instanceConnectionString, masterConnectionString));
        }
Beispiel #7
0
        public MeetingMessage UpdateObjective(Guid meetingId, string objective, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_meetingObjectivePurposeRepository.UpdateObjective(meetingId, objective, user.InstanceId,
                                                                      instanceConnectionString));
        }
Beispiel #8
0
        public (bool condition, string message, byte[] file) CreateMinutes
            (Meeting meetingItem, IEnumerable <MeetingAttendee> attendeescollection,
            IEnumerable <MeetingAgenda> agendaCollection, IEnumerable <MeetingNote> notecollection,
            AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                    _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password);

            var agenditems = new List <dynamic>();
            var noteItems  = new List <dynamic>();
            var people     = new List <dynamic>();

            foreach (var agenda in agendaCollection)
            {
                agenditems.Add(new { agendaHeading = agenda.AgendaHeading, agendaText = agenda.AgendaText });
            }

            foreach (var note in notecollection)
            {
                noteItems.Add(new { agendaHeading = note.NoteText });
            }

            foreach (var attendee in attendeescollection)
            {
                noteItems.Add(new { name = attendee.Name, role = attendee.Role });
            }

            var meeting = new
            {
                name      = meetingItem.Name,
                date      = meetingItem.Date,
                location  = meetingItem.Location,
                time      = meetingItem.Time,
                purpose   = meetingItem.Purpose,
                outcome   = meetingItem.Outcome,
                agenda    = agenditems,
                attendees = people,
                notes     = noteItems
            };
            var jsReportResult = _reportRepository.CreateMinutesReport(meeting);

            if (jsReportResult.condition)
            {
                var createMinutesResult = _meetingRepository.CreateUpdateMeetingMinutes
                                              (user.InstanceId, instanceConnectionString, meetingItem.Id.ToString(), jsReportResult.file);
                if (!createMinutesResult.condition)
                {
                    _logService.Log(LogLevel.Error, $"JsReportService - Line:73 - _meetingRepository.CreateUpdateMeetingMinutes{ createMinutesResult.message}");
                }
            }

            return(jsReportResult);
        }
        public (bool condition, string message) ResetAcccount(AuthRestModel user)
        {
            var connectionString = _applicationSetting.CreateConnectionString(
                _applicationSetting.Server,
                _applicationSetting.Catalogue,
                _applicationSetting.Username,
                _applicationSetting.Password);

            return(this._userRepository.Reset(connectionString, user.InstanceId, user.Name));
        }
        public AgendaMessage GetMeetingAgendaCollection(Guid meetingId, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));
            var data = _minutzAgendaRepository.GetMeetingAgendaCollection(meetingId, user.InstanceId, instanceConnectionString);

            if (data.Condition)
            {
                if (data.AgendaCollection.Any())
                {
                    var updated = new List <MeetingAgenda>();
                    foreach (var agenda in data.AgendaCollection)
                    {
                        if (agenda.Order == 0)
                        {
                            agenda.Order = updated.Count;
                        }
                        updated.Add(agenda);
                    }
                    data.AgendaCollection = updated;
                    data.AgendaCollection = data.AgendaCollection.OrderBy(i => i.Order).ToList();
                }
            }
            return(new AgendaMessage {
                Condition = data.Condition, Message = data.Message, AgendaCollection = data.AgendaCollection
            });
        }
        public (bool condition, string message) Add
            (MeetingAttachment attachment, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            var result = _meetingAttachmentRepository.Add(attachment, user.InstanceId, instanceConnectionString);

            if (result)
            {
                return(true, "Success");
            }

            return(false, "Something went wrong");
        }
        public MessageBase Update(string meetingId, string title, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_minutzTitleRepository.Update(meetingId, title, user.InstanceId, instanceConnectionString));
        }
Beispiel #13
0
        public void Log(LogLevel level,
                        string log)
        {
            if (string.IsNullOrEmpty(log))
            {
                throw new ArgumentException("No log message was supplied.");
            }
            try
            {
                var connectionString = _applicationSetting.CreateConnectionString();
                if (string.IsNullOrEmpty(connectionString))
                {
                    throw new ArgumentNullException(nameof(connectionString),
                                                    "The connection string was not provided in the log service.");
                }

                var result = this._logRepository.Log(this._applicationSetting.Schema,
                                                     connectionString,
                                                     (int)level,
                                                     Enum.GetName(typeof(LogLevel), level),
                                                     log);
            }
            catch (Exception ex)
            {
                throw new Exception("Log Service found a issue.", ex.InnerException);
            }
        }
Beispiel #14
0
        public MeetingMessage GetMeeting(string instanceId, Guid meetingId)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, instanceId, _applicationSetting.GetInstancePassword(instanceId));

            return(_getMeetingRepository.Get(meetingId, instanceId, instanceConnectionString));
        }
Beispiel #15
0
        public ActionMessage Actions(AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_userActionsRepository.Actions(user.Email, user.InstanceId, instanceConnectionString));
        }
        /// <summary>
        /// checks if the user is new, uses the referenceKey to check if there are any instances where the user is in another company
        /// </summary>
        /// <returns><c>true</c>, if new user was ised, <c>false</c> otherwise.</returns>
        /// <param name="authUserId">Auth user identifier.</param>
        /// <param name="referenceKey">Reference key.</param>
        public bool IsNewUser(string authUserId, string referenceKey)
        {
            (string key, string reference)reference = (string.Empty, string.Empty);
            if (!string.IsNullOrEmpty(referenceKey))
            {
                reference = referenceKey.TupleSplit();
            }

            return(_userRepository.CheckIfNewUser(reference,
                                                  authUserId,
                                                  _applicationSetting.Schema,
                                                  _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                             _applicationSetting.Catalogue,
                                                                                             _applicationSetting.Username,
                                                                                             _applicationSetting.Password)));
        }
        public MeetingMessage UpdateMeeting(Minutz.Models.Entities.Meeting meeting, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_userManageMeetingRepository.Update(meeting, user.InstanceId, instanceConnectionString));
        }
Beispiel #18
0
        public PersonResponse GetInstancePeople(AuthRestModel user)
        {
            var result = new PersonResponse {
                Code = 500, Condition = false, Message = string.Empty, People = new List <Person>()
            };
            var masterConnectionString = _applicationSetting.CreateConnectionString();
            var peopleResult           = _instanceUserRepository.GetInstancePeople(user.InstanceId, masterConnectionString);

            result.Condition = peopleResult.Condition;
            result.Code      = peopleResult.Code;
            result.Message   = peopleResult.Message;
            if (peopleResult.Condition)
            {
                result.People = peopleResult.People;
            }
            return(result);
        }
Beispiel #19
0
        public MessageBase UpdateMeetingStatus(Guid meetingId, string status, AuthRestModel user)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            return(_meetingStatusRepository.UpdateMeetingStatus(meetingId, status, user.InstanceId,
                                                                instanceConnectionString));
        }
Beispiel #20
0
        public Instance SetInstanceDetailsForSchema(
            string token,
            Instance instance)
        {
            var auth = new AuthenticationHelper(token, _authenticationService, _instanceRepository, _applicationSetting,
                                                _userValidationService);

            auth.Instance.Colour        = instance.Colour;
            auth.Instance.Style         = instance.Style;
            auth.Instance.AllowInformal = instance.AllowInformal;

            return(_instanceRepository.SetInstanceDetailsForSchema(_applicationSetting.Schema,
                                                                   _applicationSetting.CreateConnectionString(), auth.Instance));
        }
Beispiel #21
0
        public (bool condition, string message, IEnumerable <MinutzDecision> data) GetMinutzDecisions
            (string referenceId, AuthRestModel user)
        {
            if (string.IsNullOrEmpty(referenceId))
            {
                throw new ArgumentNullException(nameof(referenceId), "Please provide a valid reference id.");
            }

            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId,
                                                                                      _applicationSetting.GetInstancePassword(user.InstanceId));

            var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                    _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password);
            var decisions =
                _decisionRepository.GetMeetingDecisions(Guid.Parse(referenceId), user.InstanceId,
                                                        instanceConnectionString);

            return(true, "", decisions);
        }
        public IActionResult SendInvitesResult(Guid meetingId)
        {
            var userInfo = User.ToRest();

            if (meetingId == Guid.Empty)
            {
                return(new BadRequestObjectResult("Meeting id is incorrect"));
            }
            var meeting = _getMeetingService.GetMeeting(userInfo.InstanceId, meetingId);
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, userInfo.InstanceId, _applicationSetting.GetInstancePassword(userInfo.InstanceId));
            var master = _applicationSetting.CreateConnectionString();

            var attendees =
                _attendeeRepository.GetMeetingAttendees(meetingId, userInfo.InstanceId, instanceConnectionString,
                                                        master);

            foreach (var meetingAttendee in attendees)
            {
                var notificationResult = _notificationService.SendMeetingInvitation(meetingAttendee, meeting.Meeting, userInfo.InstanceId);
            }
            return(Ok());
        }
 public List <NotificationType> GetList(
     string token)
 {
     return(_notificationTypeRepository.GetList(_applicationSetting.Schema, _applicationSetting.CreateConnectionString()));
 }
Beispiel #24
0
 public List <Reminder> GetList(
     string token)
 {
     return(_reminderRepository.GetList(_applicationSetting.Schema, _applicationSetting.CreateConnectionString()));
 }
        public PersonResponse GetPersonByEmail
            (string email)
        {
            var result = new PersonResponse {
                Condition = false, Message = string.Empty
            };
            var personResult =
                _userDatabaseRepository.GetUserByEmail
                    (email, "app", _applicationSetting.CreateConnectionString());

            if (personResult == null)
            {
                result.Message = "User cannot be found.";
                return(result);
            }

            result.Condition = true;
            result.Message   = "Successful.";
            result.Person    = personResult;
            return(result);
        }
        public ActionResult Invoice(Guid m, string i)
        {
            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, i, _applicationSetting.GetInstancePassword(i));
            var masterConnectionString = _applicationSetting.CreateConnectionString();

            var meetingRequest = _getMeetingRepository.Get(m, i, instanceConnectionString);


            var meeting = !meetingRequest.Condition ? new Minutz.Models.Entities.Meeting() : meetingRequest.Meeting;


            if (string.IsNullOrEmpty(meeting.Outcome))
            {
                meeting.Outcome = "Outcome not set.";
            }
            if (string.IsNullOrEmpty(meeting.Location))
            {
                meeting.Location = "Location not set.";
            }
            if (string.IsNullOrEmpty(meeting.Purpose))
            {
                meeting.Purpose = "Purpose not set.";
            }
            if (string.IsNullOrEmpty(meeting.Time))
            {
                meeting.Time = "0:00";
            }


            var agendaCollection = _agendaRepository.GetMeetingAgendaCollection(m, i, instanceConnectionString);
            var agendaItems      = new List <JsReportAgenda>();

            if (agendaCollection.Condition)
            {
                foreach (var meetingAgenda in agendaCollection.AgendaCollection)
                {
                    if (string.IsNullOrEmpty(meetingAgenda.AgendaText))
                    {
                        meetingAgenda.AgendaText = string.Empty;
                    }
                    agendaItems.Add(new JsReportAgenda
                    {
                        agendaHeading = meetingAgenda.AgendaHeading,
                        agendaText    = meetingAgenda.AgendaText.Replace("<p>", "").Replace("</p>", "")
                                        .Replace("<b>", "").Replace("</b>", "").Replace("&nbsp;", "&")
                    });
                }
            }
            var noteRequest = _noteRepository.GetNoteCollection(m, i, instanceConnectionString);
            var notes       = new List <JsReportNote>();

            if (noteRequest.Condition)
            {
                foreach (var meetingNote in noteRequest.NoteCollection)
                {
                    notes.Add(new JsReportNote
                    {
                        noteText = meetingNote.NoteText.Replace("<p>", "").Replace("</p>", "")
                                   .Replace("<b>", "").Replace("</b>", "").Replace("&nbsp;", "&")
                    });
                }
            }

            var attendees = new List <JsReportAttendee>();

            try
            {
                var attendeeResult = _minutzAttendeeRepository.GetAttendees(m, i, instanceConnectionString, masterConnectionString);
                if (attendeeResult.Condition)
                {
                    foreach (var attendee in attendeeResult.Attendees)
                    {
                        attendees.Add(new JsReportAttendee
                        {
                            name = attendee.Name,
                            role = attendee.Role
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }



            var client = new HttpClient();
            var url    = "https://minutz.jsreportonline.net/api/report";

            var data = new JsReportObject
            {
                name     = meeting.Name,
                location = meeting.Location,
                time     = meeting.Time,
                outcome  = meeting.Outcome.Replace("<p>", "").Replace("</p>", "")
                           .Replace("<b>", "").Replace("</b>", "").Replace("&nbsp;", "&"),
                purpose = meeting.Purpose.Replace("<p>", "").Replace("</p>", "")
                          .Replace("<b>", "").Replace("</b>", "").Replace("&nbsp;", "&"),
                agenda    = agendaItems,
                notes     = notes,
                attendees = attendees
            };

            var model = new SendData
            {
                options = new options {
                    timeout = 60000
                },
                data     = data,
                template = new template {
                    shortid = "SJKYFyoYM"
                }
            };
            var token   = CreateAuthHeader();
            var payload = model.ToStringContent();

            client.DefaultRequestHeaders.Add("Authorization", token);
            var reportRequest = client.PostAsync(url, payload).Result;
            var report        = reportRequest.Content.ReadAsByteArrayAsync().Result;

            return(new FileContentResult(report, "application/pdf"));
        }
 public List <Subscription> GetList(
     string token)
 {
     return(_subscriptionRepository.GetList(_applicationSetting.Schema, _applicationSetting.CreateConnectionString()));
 }
        /// <summary>
        /// Invite a attendee
        /// Validate the attendee is new, alternatively update reference to the new instance if required
        /// </summary>
        /// <param name="user" typeof="AuthRestModel">The current user / owner</param>
        /// <param name="invitee" typeof="MeetingAttendee">The new attendee</param>
        /// <param name="meeting" typeof="Minutz.Models.Entities.Meeting">The meeting entity for the invitation</param>
        /// <returns typeof="MessageBase">Result if was successful</returns>
        public MessageBase InviteUser(AuthRestModel user, MeetingAttendee invitee, Minutz.Models.Entities.Meeting meeting)
        {
            var validEmail = _emailValidationService.Valid(invitee.Email);

            if (!validEmail)
            {
                return new MessageBase {
                           Condition = false, Message = $"{invitee.Email} is a invalid email address."
                }
            }
            ;
            if (meeting.Id == Guid.Empty || string.IsNullOrEmpty(meeting.Name))
            {
                return new MessageBase
                       {
                           Condition = false,
                           Message   = "Meeting is invalid."
                       }
            }
            ;

            var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server,
                                                                                      _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId));

            var masterConnectionString = _applicationSetting.CreateConnectionString();

            var userValidation = _userRepository.CheckIfNewUser(invitee.Email, invitee.ReferenceId.ToString(), user.InstanceId, instanceConnectionString, masterConnectionString);

            switch (userValidation.Code)
            {
            case 1:
                //create person
                var createPersonResult = _userRepository.CreatePerson(invitee, masterConnectionString);

                if (!createPersonResult.Condition)
                {
                    return(new MessageBase {
                        Condition = createPersonResult.Condition, Message = createPersonResult.Message, Code = createPersonResult.Code
                    });
                }

                var createPersonAvailableResult = _availabilityRepository.CreateAvailableAttendee(invitee, user.InstanceId, instanceConnectionString);
                if (!createPersonAvailableResult.Condition)
                {
                    var message = $"Person was created but there was a issue with creating available attendee. \n {createPersonAvailableResult.Message}";
                    return(new MessageBase {
                        Condition = createPersonAvailableResult.Condition,
                        Message = message,
                        Code = createPersonAvailableResult.Code
                    });
                }

                var createPersonAttendeeResult = _attendeeRepository.AddAttendee(invitee.ReferenceId, invitee, user.InstanceId, instanceConnectionString);
                if (!createPersonAttendeeResult.Condition)
                {
                    var message = $"Person was created, and available attendee was created, but there was a issue with adding to meeting attendee. \n {createPersonAttendeeResult.Message}";
                    return(new MessageBase {
                        Condition = createPersonAttendeeResult.Condition,
                        Message = message,
                        Code = createPersonAttendeeResult.Code
                    });
                }

                break;

            case 2:
                //create available
                var createAvailableResult = _availabilityRepository.CreateAvailableAttendee(invitee, user.InstanceId, instanceConnectionString);
                if (!createAvailableResult.Condition)
                {
                    return(new MessageBase {
                        Condition = createAvailableResult.Condition, Message = createAvailableResult.Message, Code = createAvailableResult.Code
                    });
                }

                var createAvailableAttendeeResult = _attendeeRepository.AddAttendee(invitee.ReferenceId, invitee, user.InstanceId, instanceConnectionString);
                if (!createAvailableAttendeeResult.Condition)
                {
                    var message = $"Available attendee was created, but there was a issue with adding to meeting attendee. \n {createAvailableAttendeeResult.Message}";
                    return(new MessageBase {
                        Condition = createAvailableAttendeeResult.Condition,
                        Message = message,
                        Code = createAvailableAttendeeResult.Code
                    });
                }
                break;

            case  3:
                //create meeting attendee
                var createAttendeeResult = _attendeeRepository.AddAttendee(invitee.ReferenceId, invitee, user.InstanceId, instanceConnectionString);
                if (!createAttendeeResult.Condition)
                {
                    var message = $"There was a issue with adding to meeting attendee. \n {createAttendeeResult.Message}";
                    return(new MessageBase {
                        Condition = createAttendeeResult.Condition,
                        Message = message,
                        Code = createAttendeeResult.Code
                    });
                }
                break;
            }

            return(new MessageBase {
                Condition = true, Message = "Successful"
            });
        }
        public AuthenticationHelper(string token,
                                    IAuthenticationService _authenticationService,
                                    IInstanceRepository instanceRepository,
                                    IApplicationSetting applicationSetting,
                                    IUserValidationService userValidationService)
        {
            var userInfo = _authenticationService.GetUserInfo(token);

            this.UserInfo = userValidationService.GetUser(userInfo.Sub);

            if (string.IsNullOrEmpty(this.UserInfo.Related))// this will use the defasult user instance id, this is if the user is a owner
            {
                this.Instance = instanceRepository.GetByUsername(this.UserInfo.InstanceId,
                                                                 applicationSetting.CreateConnectionString(
                                                                     applicationSetting.Server,
                                                                     applicationSetting.Catalogue,
                                                                     applicationSetting.Username,
                                                                     applicationSetting.Password)).Instance;
            }
            else
            {
                if (this.UserInfo.Related.Contains("&"))
                {
                    string relatedstring = this.UserInfo.Related;
                    if (this.UserInfo.Related.Contains('|'))
                    {
                        relatedstring = this.UserInfo.Related.TupleSplit().value;
                    }

                    (string instanceId, string meetingId)relatedInstance = relatedstring.SplitToList("&", ";").FirstOrDefault(); // This is to be updated to allow multiple
                    this.Instance = instanceRepository.GetByUsername(relatedInstance.instanceId,
                                                                     applicationSetting.CreateConnectionString(
                                                                         applicationSetting.Server,
                                                                         applicationSetting.Catalogue,
                                                                         applicationSetting.Username,
                                                                         applicationSetting.Password)).Instance;
                }
                else
                {
                    this.Instance = instanceRepository.GetByUsername(this.UserInfo.Name,
                                                                     applicationSetting.CreateConnectionString(
                                                                         applicationSetting.Server,
                                                                         applicationSetting.Catalogue,
                                                                         applicationSetting.Username,
                                                                         applicationSetting.Password)).Instance;
                }
            }
            if (this.Instance == null)
            {
                this.ConnectionString = applicationSetting.CreateConnectionString(
                    applicationSetting.Server,
                    applicationSetting.Catalogue,
                    applicationSetting.Username,
                    applicationSetting.Password);
            }
            else
            {
                this.ConnectionString = applicationSetting.CreateConnectionString(
                    applicationSetting.Server,
                    applicationSetting.Catalogue,
                    this.Instance.Username,
                    this.Instance.Password);
            }
        }