public async Task <ObjectAPI> GetChienDichByDate(string start, string end)
        {
            ObjectAPI obj = new ObjectAPI();

            if (DateTime.TryParse(start, out DateTime newStart) && DateTime.TryParse(end, out DateTime newEnd))
            {
                var rel = await chienDichServices.GetListChienDich(newStart, newEnd);

                if (rel != null && rel.Count() > 0)
                {
                    obj.Message    = "Lấy danh sách thông tin chiến dịch thành công!";
                    obj.StatusCode = "200";
                    obj.Success    = true;
                    obj.Data       = rel;
                }
                else
                {
                    obj.Message    = "Sai thông tin truy vấn hoặc dữ liệu không tồn tại";
                    obj.StatusCode = "404";
                    obj.Success    = false;
                    obj.Data       = new object();
                }
            }
            return(obj);
        }
Exemple #2
0
        public static List <ObjectAPI> GetObjectData(string developerName, ObjectAPI objectData, bool required)
        {
            List <ObjectAPI> listData = null;

            if (objectData != null &&
                objectData.properties != null &&
                objectData.properties.Count > 0)
            {
                foreach (PropertyAPI property in objectData.properties)
                {
                    if (property.developerName.Equals(developerName, StringComparison.OrdinalIgnoreCase))
                    {
                        listData = property.objectData;
                        break;
                    }
                }
            }

            if (required &&
                (listData == null || listData.Count == 0))
            {
                throw new ArgumentException("listData", developerName + " cannot be null.");
            }

            return(listData);
        }
Exemple #3
0
        public static string GetContentValue(string developerName, ObjectAPI objectData, bool required)
        {
            string contentValue = null;

            if (objectData != null &&
                objectData.properties != null &&
                objectData.properties.Count > 0)
            {
                foreach (PropertyAPI property in objectData.properties)
                {
                    if (property.developerName.Equals(developerName, StringComparison.OrdinalIgnoreCase))
                    {
                        contentValue = property.contentValue;
                        break;
                    }
                }
            }

            if (required &&
                string.IsNullOrWhiteSpace(contentValue))
            {
                throw new ArgumentNullException("contentValue", developerName + " cannot be null or blank.");
            }

            return(contentValue);
        }
Exemple #4
0
        public static ObjectAPI GetObjectData(string developerName, List <EngineValueAPI> engineValues, bool required)
        {
            ObjectAPI objectData = null;

            // Get the message input
            if (engineValues != null &&
                engineValues.Count > 0)
            {
                // Go through the inputs to find the message
                foreach (EngineValueAPI engineValue in engineValues)
                {
                    // Check to see if this is the post
                    if (engineValue.developerName.Equals(developerName, StringComparison.OrdinalIgnoreCase))
                    {
                        // Grab the message
                        if (engineValue.objectData != null &&
                            engineValue.objectData.Count > 0)
                        {
                            objectData = engineValue.objectData[0];
                        }

                        // Break out of this loop
                        break;
                    }
                }
            }

            if (required &&
                objectData == null)
            {
                throw new ArgumentNullException("objectData", developerName + " cannot be null.");
            }

            return(objectData);
        }
        private static ObjectAPI Convert(Type type, String externalId, object source, List <ValueElementIdReferenceAPI> valueElementIdReferences)
        {
            ObjectAPI objectAPI = null;

            if (source != null)
            {
                // If we have a value element identifier, we need to translate it over
                if (type.Name.Equals("ValueElementIdAPI", StringComparison.OrdinalIgnoreCase) == true)
                {
                    type = new ValueElementIdReferenceAPI().GetType();
                }

                objectAPI = new ObjectAPI();
                objectAPI.developerName = GetCleanObjectName(type.Name);
                objectAPI.externalId    = externalId;
                objectAPI.properties    = new List <PropertyAPI>();

                foreach (PropertyInfo propertyInfo in type.GetRuntimeProperties())
                {
                    PropertyAPI propertyAPI = Convert(source, propertyInfo, valueElementIdReferences);
                    if (propertyAPI != null)
                    {
                        objectAPI.properties.Add(propertyAPI);
                    }
                }
            }

            return(objectAPI);
        }
Exemple #6
0
        public async Task <ObjectAPI> GetListByDate(string date)
        {
            ObjectAPI obj = new ObjectAPI();


            if (DateTime.TryParse(date, out DateTime newDate))
            {
                var rel = await localServices.GetList(newDate);

                if (rel.Count() > 0)
                {
                    obj.Message    = "Lấy thành công danh sách vị trí";
                    obj.StatusCode = "200";
                    obj.Success    = true;
                }
                else
                {
                    obj.Message    = "Lấy danh sách vị trí thất bại";
                    obj.StatusCode = "404";
                    obj.Success    = false;
                }
                obj.Data = rel;
            }

            return(obj);
        }
        public List<ObjectAPI> CreateMatter(string authenticationUrl, string ebikkoSessionId, string cookieJSESSIONID, string recordNumber, string description)
        {
            DocordoNodeCreateResponse docordoNodeCreateResponse = DocordoAPI.DocordoService.GetInstance().CreateMatter<DocordoMatterData>(authenticationUrl, ebikkoSessionId, cookieJSESSIONID, DocordoCreateRecordBean.New(string.Empty, recordNumber, description, string.Empty), DocordoMatterData.New(description));
            List<ObjectAPI> returnedObjects = new List<ObjectAPI>();
            ObjectAPI objectAPI = new ObjectAPI();
            objectAPI.developerName = "NodeId";
            objectAPI.externalId = docordoNodeCreateResponse.NodeId;

            returnedObjects.Add(objectAPI);

            return returnedObjects;
        }
        public ObjectAPI Login(string userName, string password)
        {
            var id = userServices.Authenticate(userName, password);

            ObjectAPI obj = new ObjectAPI();

            if (id == Guid.Empty)
            {
                obj.Message    = "Tài khoản hoặc mật khẩu không đúng";
                obj.Success    = false;
                obj.Data       = new object();
                obj.StatusCode = "500";
            }
            else
            {
                obj.Message    = "Đăng nhập thành công";
                obj.Success    = true;
                obj.Data       = tokenService.GenToken(id.ToString());
                obj.StatusCode = "200";
            }
            return(obj);
        }
        public static ObjectAPI CreateUserObject(IAuthenticatedWho authenticatedWho)
        {
            ObjectAPI userObject = null;

            userObject = new ObjectAPI();
            userObject.developerName = ManyWhoConstants.MANYWHO_USER_DEVELOPER_NAME;
            userObject.properties = new List<PropertyAPI>();

            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_DIRECTORY_ID, authenticatedWho.DirectoryId));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_DIRECTORY_NAME, authenticatedWho.DirectoryName));

            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_COUNTRY, null));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_EMAIL, authenticatedWho.Email));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_USERNAME, authenticatedWho.Email));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_FIRST_NAME, null));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_LANGUAGE, null));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_LAST_NAME, null));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_LOCATION, null));
            userObject.properties.Add(CreateProperty(ManyWhoConstants.MANYWHO_USER_PROPERTY_USER_ID, authenticatedWho.UserId));

            return userObject;
        }
        public async Task <ObjectAPI> GetChienDichByID(string id)
        {
            ObjectAPI obj = new ObjectAPI();

            var rel = await chienDichServices.GetListChienDich(Guid.Parse(id));

            if (rel != null && rel.Count() > 0)
            {
                obj.Message    = "Lấy danh sách thông tin chiến dịch thành công!";
                obj.StatusCode = "200";
                obj.Success    = true;
                obj.Data       = rel;
            }
            else
            {
                obj.Message    = "Sai thông tin truy vấn hoặc dữ liệu không tồn tại";
                obj.StatusCode = "404";
                obj.Success    = false;
                obj.Data       = new object();
            }
            return(obj);
        }
Exemple #11
0
        public async Task <ObjectAPI> GetListByID(string id)
        {
            ObjectAPI obj = new ObjectAPI();

            var rel = await localServices.GetList(Guid.Parse(id));

            if (rel.Count() > 0)
            {
                obj.Message    = "Lấy thành công danh sách vị trí";
                obj.StatusCode = "200";
                obj.Success    = true;
            }
            else
            {
                obj.Message    = "Lấy danh sách vị trí thất bại";
                obj.StatusCode = "404";
                obj.Success    = false;
            }
            obj.Data = rel;

            return(obj);
        }
        public async Task <ObjectAPI> GetInfo(string id)
        {
            ObjectAPI obj = new ObjectAPI();

            var nv = await nvServices.GetInfo(Guid.Parse(id));

            if (!string.IsNullOrEmpty(nv.ID.ToString()))
            {
                obj.StatusCode = "200";
                obj.Message    = "Thành công";
                obj.Success    = true;
                obj.Data       = nv;
            }
            else
            {
                obj.StatusCode = "404";
                obj.Message    = "Không tìm thấy nhân viên này";
                obj.Success    = false;
                obj.Data       = new Object();
            }

            return(obj);
        }
Exemple #13
0
        public async Task <ObjectAPI> UpdateLocation([FromBody] Location_Tracking location)
        {
            ObjectAPI obj = new ObjectAPI();

            var rel = await localServices.UpdateLocation(location);

            obj.Data = rel;
            if (rel)
            {
                obj.Message    = "Thành công!";
                obj.Success    = true;
                obj.StatusCode = "200";
            }
            else
            {
                obj.Message    = "Thất bại";
                obj.StatusCode = "404";
                obj.Success    = false;
            }


            return(obj);
        }
        /// <summary>
        /// Get vị trị hiện tại của nhân viên
        /// </summary>
        /// <param name="nvID"></param>
        /// <returns></returns>
        public async Task <ObjectAPI> GetLocation(Guid nvID)
        {
            var clt = await db.CurrentLocationTrackings.Where(n => n.NVID.Equals(nvID)).FirstOrDefaultAsync();

            ObjectAPI obj = new ObjectAPI();

            if (clt == null)
            {
                obj.StatusCode = "404";
                obj.Success    = false;
                obj.Message    = "Lấy vị trí thất bại";
                obj.Data       = new object();
            }
            else
            {
                obj.StatusCode = "200";
                obj.Success    = true;
                obj.Message    = "Lấy vị trí thành công!";
                obj.Data       = clt;
            }

            return(obj);
        }
        public static ObjectAPI CreateAttributeObject(String label, String value)
        {
            ObjectAPI attributeObject = null;
            PropertyAPI attributeProperty = null;

            attributeObject = new ObjectAPI();
            attributeObject.externalId = value;
            attributeObject.developerName = ManyWhoConstants.AUTHENTICATION_AUTHENTICATION_ATTRIBUTE_OBJECT_DEVELOPER_NAME;
            attributeObject.properties = new List<PropertyAPI>();

            attributeProperty = new PropertyAPI();
            attributeProperty.developerName = ManyWhoConstants.AUTHENTICATION_ATTRIBUTE_LABEL;
            attributeProperty.contentValue = label;

            attributeObject.properties.Add(attributeProperty);

            attributeProperty = new PropertyAPI();
            attributeProperty.developerName = ManyWhoConstants.AUTHENTICATION_ATTRIBUTE_VALUE;
            attributeProperty.contentValue = value;

            attributeObject.properties.Add(attributeProperty);

            return attributeObject;
        }
        public static ObjectAPI CreateAttributeObject(String label, String value)
        {
            ObjectAPI   attributeObject   = null;
            PropertyAPI attributeProperty = null;

            attributeObject               = new ObjectAPI();
            attributeObject.externalId    = value;
            attributeObject.developerName = ManyWhoConstants.AUTHENTICATION_AUTHENTICATION_ATTRIBUTE_OBJECT_DEVELOPER_NAME;
            attributeObject.properties    = new List <PropertyAPI>();

            attributeProperty = new PropertyAPI();
            attributeProperty.developerName = ManyWhoConstants.AUTHENTICATION_ATTRIBUTE_LABEL;
            attributeProperty.contentValue  = label;

            attributeObject.properties.Add(attributeProperty);

            attributeProperty = new PropertyAPI();
            attributeProperty.developerName = ManyWhoConstants.AUTHENTICATION_ATTRIBUTE_VALUE;
            attributeProperty.contentValue  = value;

            attributeObject.properties.Add(attributeProperty);

            return(attributeObject);
        }
Exemple #17
0
        public ServiceResponseAPI InvokeCreateEvent(INotifier notifier, IAuthenticatedWho authenticatedWho, ServiceRequestAPI serviceRequest)
        {
            List <ObjectDataTypePropertyAPI> objectDataTypeProperties = null;
            ServiceResponseAPI serviceResponse   = null;
            DateTime           whenDate          = DateTime.Now;
            List <ObjectAPI>   eventObjects      = null;
            ObjectAPI          eventObject       = null;
            String             authenticationUrl = null;
            String             username          = null;
            String             password          = null;
            String             securityToken     = null;
            String             adminEmail        = null;
            String             when        = null;
            String             duration    = null;
            String             description = null;
            String             subject     = null;
            String             eventId     = null;

            // Grab the configuration values from the service request
            authenticationUrl = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_VALUE_AUTHENTICATION_URL, serviceRequest.configurationValues, true);
            username          = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_VALUE_USERNAME, serviceRequest.configurationValues, true);
            password          = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_VALUE_PASSWORD, serviceRequest.configurationValues, true);
            securityToken     = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_VALUE_SECURITY_TOKEN, serviceRequest.configurationValues, false);
            adminEmail        = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_VALUE_ADMIN_EMAIL, serviceRequest.configurationValues, true);

            if (serviceRequest.authorization != null)
            {
                // Get the message from the inputs
                when        = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_INPUT_WHEN, serviceRequest.inputs, true);
                duration    = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_INPUT_DURATION, serviceRequest.inputs, true);
                description = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_INPUT_DESCRIPTION, serviceRequest.inputs, true);
                subject     = ValueUtils.GetContentValue(SalesforceServiceSingleton.SERVICE_INPUT_SUBJECT, serviceRequest.inputs, true);

                // Get the when date for the provided command
                whenDate = DateUtils.CreateDateFromWhenCommand(notifier, authenticatedWho, when, adminEmail);
                // Set the calendar event for a day in the week at 10am
                whenDate = DateUtils.GetDayInWeek(whenDate, 10);

                // Add the link to the flow in the description
                description += "  Link to Flow: " + serviceRequest.joinPlayerUri;

                // Create a event object to save back to the system
                eventObject = new ObjectAPI();
                eventObject.developerName = "Event";
                eventObject.properties    = new List <PropertyAPI>();
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "ActivityDateTime", contentValue = whenDate.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffZ")
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "Description", contentValue = description
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "DurationInMinutes", contentValue = duration
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "Subject", contentValue = subject
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsAllDayEvent", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsArchived", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsChild", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsGroupEvent", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsPrivate", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsRecurrence", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsReminderSet", contentValue = "false"
                });
                eventObject.properties.Add(new PropertyAPI()
                {
                    developerName = "IsVisibleInSelfService", contentValue = "false"
                });

                // Add the object to the list of objects to save
                eventObjects = new List <ObjectAPI>();
                eventObjects.Add(eventObject);

                // Create the object data type properties for this object so the system knows what we're selecting
                objectDataTypeProperties = new List <ObjectDataTypePropertyAPI>();
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "ActivityDateTime"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "Description"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "DurationInMinutes"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "Subject"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsAllDayEvent"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsArchived"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsChild"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsGroupEvent"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsPrivate"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsRecurrence"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsReminderSet"
                });
                objectDataTypeProperties.Add(new ObjectDataTypePropertyAPI()
                {
                    developerName = "IsVisibleInSelfService"
                });

                // Save the event object to salesforce
                eventObjects = SalesforceDataSingleton.GetInstance().Save(notifier, authenticatedWho, serviceRequest.configurationValues, objectDataTypeProperties, eventObjects);

                // Check to see if anything came back as part of the save - it should unless there was a fault
                if (eventObjects != null &&
                    eventObjects.Count > 0)
                {
                    // Grab the first object from the returned event objects
                    eventObject = eventObjects[0];

                    // Grab the id from that object - this needs to be returned in our outputs
                    eventId = eventObject.externalId;
                }
                else
                {
                    // If we didn't get any objects back, we need to throw an error
                    String errorMessage = "Event could not be created for an unknown reason.";

                    ErrorUtils.SendAlert(notifier, authenticatedWho, ErrorUtils.ALERT_TYPE_FAULT, errorMessage);

                    throw new ArgumentNullException("BadRequest", errorMessage);
                }
            }
            else
            {
                // Alert the admin that no one is in the authorization context
                ErrorUtils.SendAlert(notifier, authenticatedWho, ErrorUtils.ALERT_TYPE_WARNING, "The service request does not have an authorization context, so there's no one to notify.");
            }

            // Construct the service response
            serviceResponse            = new ServiceResponseAPI();
            serviceResponse.invokeType = ManyWhoConstants.INVOKE_TYPE_FORWARD;
            serviceResponse.token      = serviceRequest.token;
            serviceResponse.outputs    = new List <EngineValueAPI>();
            serviceResponse.outputs.Add(new EngineValueAPI()
            {
                contentType = ManyWhoConstants.CONTENT_TYPE_STRING, contentValue = eventId, developerName = SalesforceServiceSingleton.SERVICE_OUTPUT_ID
            });

            return(serviceResponse);
        }
Exemple #18
0
        public static string SerializeObjectData(ObjectAPI objectAPI, TypeElementResponseAPI typeElementResponse)
        {
            string xml        = null;
            string internalId = null;
            string externalId = null;

            if (objectAPI.internalId != null &&
                objectAPI.internalId.Trim().Length > 0)
            {
                internalId = objectAPI.internalId;
            }
            else
            {
                internalId = Fuid.NewGuid().ToString();
            }

            if (objectAPI.externalId != null &&
                objectAPI.externalId.Trim().Length > 0)
            {
                externalId = objectAPI.externalId;
            }
            else
            {
                externalId = Fuid.NewGuid().ToString();
            }

            xml  = "";
            xml += "<complextype internalid=\"" + internalId + "\" externalid=\"" + externalId + "\" typeelementid=\"" + typeElementResponse.id + "\">";

            if (objectAPI.properties != null &&
                objectAPI.properties.Count > 0)
            {
                foreach (PropertyAPI propertyAPI in objectAPI.properties)
                {
                    bool   typeElementEntryFound = false;
                    string typeElementEntryId    = null;
                    string contentType           = null;

                    if (typeElementResponse.properties != null &&
                        typeElementResponse.properties.Count > 0)
                    {
                        foreach (TypeElementPropertyAPI typeElementEntryAPI in typeElementResponse.properties)
                        {
                            if (typeElementEntryAPI.developerName.Equals(propertyAPI.developerName, StringComparison.OrdinalIgnoreCase))
                            {
                                typeElementEntryId = typeElementEntryAPI.id;
                                contentType        = typeElementEntryAPI.contentType;

                                typeElementEntryFound = true;
                                break;
                            }
                        }
                    }

                    Validation.Instance.IsTrue(typeElementEntryFound, "TypeElementEntry", "Type element entry could not be found.");

                    xml += "<complextypeentry typeelemententryid=\"" + typeElementEntryId + "\" contenttype=\"" + contentType + "\">";

                    if (contentType.Equals(ManyWhoConstants.CONTENT_TYPE_OBJECT, StringComparison.OrdinalIgnoreCase))
                    {
                        throw new ArgumentException("contentType", "Object properties not supported yet.");
                    }

                    if (contentType.Equals(ManyWhoConstants.CONTENT_TYPE_LIST, StringComparison.OrdinalIgnoreCase))
                    {
                        throw new ArgumentException("contentType", "List properties not supported yet.");
                    }

                    // Wrap primitive values in cdata so we don't screw up the xml document with invalid markup
                    xml += "<![CDATA[" + propertyAPI.contentValue + "]]>";

                    xml += "</complextypeentry>";
                }
            }

            xml += "</complextype>";

            return(xml);
        }
        public async Task<ServiceResponseAPI> InvokeCreateMatter(IAuthenticatedWho authenticatedWho, ServiceRequestAPI serviceRequest)
        {
            ServiceResponseAPI serviceResponse = null;
            DateTime whenDate = DateTime.Now;
            List<ObjectAPI> taskObjects = null;
            ObjectAPI taskObject = null;

            string authenticationUrl = null;
            string username = null;
            string password = null;

            string recordNumber = null;
            string description = null;

            string matterId = null;

            // Grab the configuration values from the service request
            authenticationUrl = SettingUtils.GetConfigurationValue(DocordoServiceSingleton.SERVICE_VALUE_DOCORDO_DOMAIN, serviceRequest.configurationValues, true);
            username = SettingUtils.GetConfigurationValue(DocordoServiceSingleton.SERVICE_VALUE_DOCORDO_USERNAME, serviceRequest.configurationValues, true);
            password = SettingUtils.GetConfigurationValue(DocordoServiceSingleton.SERVICE_VALUE_DOCORDO_PASSWORD, serviceRequest.configurationValues, true);            

            if (serviceRequest.authorization != null)
            {
                // Get the message from the inputs
                recordNumber = ValueUtils.GetContentValue(DocordoServiceSingleton.SERVICE_INPUT_RECORD_NUMBER, serviceRequest.inputs, true);
                description = ValueUtils.GetContentValue(DocordoServiceSingleton.SERVICE_INPUT_MATTER_DESCRIPTION, serviceRequest.inputs, true);

                // Create a task object to save back to the system
                taskObject = new ObjectAPI();
                taskObject.developerName = "Matter";
                taskObject.properties = new List<PropertyAPI>();
                taskObject.properties.Add(new PropertyAPI() { developerName = "RecordNumber", contentValue = description });                
                taskObject.properties.Add(new PropertyAPI() { developerName = "Description", contentValue = description });                

                // Add the object to the list of objects to save
                taskObjects = new List<ObjectAPI>();
                taskObjects.Add(taskObject);
                
                // Save the task object to docordo
                DocordoLoginResponse docordoLoginResponse = DocordoAPI.DocordoService.GetInstance().Login(authenticationUrl, username, password);

                taskObjects = DocordoDataSingleton.GetInstance().CreateMatter(authenticationUrl, docordoLoginResponse.EbikkoSessionId, docordoLoginResponse.CookieJSESSIONID, recordNumber, description);

                // Check to see if anything came back as part of the save - it should unless there was a fault
                if (taskObjects != null &&
                    taskObjects.Count > 0)
                {
                    // Grab the first object from the returned task objects
                    taskObject = taskObjects[0];

                    // Grab the id from that object - this needs to be returned in our outputs
                    matterId = taskObject.externalId;
                }
                else
                {
                    // If we didn't get any objects back, we need to throw an error
                    String errorMessage = "Task could not be created for an unknown reason.";

                    ErrorUtils.SendAlert(authenticatedWho, ErrorUtils.ALERT_TYPE_FAULT, "*****@*****.**", "DocordoPlugin", errorMessage);

                    throw ErrorUtils.GetWebException(HttpStatusCode.InternalServerError, errorMessage);
                }

            }
            else
            {
                // Alert the admin that no one is in the authorization context
                ErrorUtils.SendAlert(authenticatedWho, ErrorUtils.ALERT_TYPE_WARNING, "*****@*****.**", "DocordoPlugin", "The service request does not have an authorization context, so there's no one to notify.");
            }

            // Construct the service response
            serviceResponse = new ServiceResponseAPI();
            serviceResponse.invokeType = ManyWhoConstants.INVOKE_TYPE_FORWARD;
            serviceResponse.token = serviceRequest.token;
            serviceResponse.outputs = new List<EngineValueAPI>();
            serviceResponse.outputs.Add(new EngineValueAPI() { contentType = ManyWhoConstants.CONTENT_TYPE_STRING, contentValue = matterId, developerName = DocordoServiceSingleton.SERVICE_OUTPUT_ID });

            return serviceResponse;
        }
 public static T Convert <T>(ObjectAPI objectApi)
 {
     return(Convert <T>(new List <ObjectAPI> {
         objectApi
     }).FirstOrDefault());
 }