public CrmWrapper Get(string authenticationToken)
        {
            lock (m_lock)
            {
                var authInfo = LoginHelper.Instance.ParseToken(authenticationToken);
                if (authInfo == null)
                    throw new ApplicationException("No Valid Auth Token");

                if (m_cache.ContainsKey(authInfo.Username))
                    return m_cache[authInfo.Username];

                var crm = new CrmWrapper(authInfo.Username, authInfo.Password, m_url);
                m_cache.Add(authInfo.Username, crm);
                return crm;
            }
        }
        public SlimIncidentWrapper(Entity incident, CrmWrapper wrapper)
        {
            Incident incidentObject = (Incident)incident;
            Id = incidentObject.Id;
            Url = "https://" + Config.MergedConfig.CrmOrg + ".crm.dynamics.com/main.aspx?etc=" + Incident.EntityTypeCode + "&id=" + incidentObject.Id + "&histKey=1&newWindow=true&pagetype=entityrecord#392649339";
            Title = incidentObject.Title;
            Company = wrapper.LookupAccount(incidentObject.CustomerId);
            Owner = wrapper.LookupUser(incidentObject.OwnerId);
            Creator = incidentObject.CreatedBy.Name;
            Description = incidentObject.Description;
            Version = incidentObject.eni_Version;
            CreatedOn = incidentObject.CreatedOn.Value;
            NetworkAttachmentsFolder = incidentObject.eni_CaseAttachments?.Trim();
            TicketNumber = incidentObject.TicketNumber;
            TFSNumber = incidentObject.eni_TFSWorkItemNumber;

            Status = MapStatusCodeToString(incidentObject.StatusCode);
            State = MapStateToString(incidentObject.StateCode);
        }
 public IncidentWrapper(Entity incident, CrmWrapper wrapper)
     : base(incident, wrapper)
 {
     Notes = wrapper.GetNotes(incident.Id).ToArray();
     NetworkAttachments = NetworkAttachment.ListAttachments(NetworkAttachmentsFolder);
 }
 public CrmConnectionManager(string username, string password, string url)
 {
     m_url = url;
     m_mattermostInstance = new CrmWrapper(username, password, url);
     m_cache.Add(username, m_mattermostInstance);
 }