private void GetCRMUser(ref ServiceObject so)
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0];

            CRMUser user = new CRMUser();

            user.Config = crmconfig;

            try
            {
                user.UserFQN = NotNull(so.Properties["UserFQN"].Value);

                CRMUser response = CRMFunctions.CRMGetUser(user);

                so.Properties.InitResultTable();

                for (int c = 0; c < meth.ReturnProperties.Count; c += 1)
                {
                    Property prop = so.Properties[meth.ReturnProperties[c]];
                    prop = SetCRMUserProperties(prop, response);
                }

                so.Properties.BindPropertiesToResultTable();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        public RestResponse <CRMUser> GetCRMUser(CRMUser crmUser, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();

            request.Method        = Method.POST;
            request.Credentials   = config.CredentialCache;
            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource      = "K2CRM/CRMGetUser";

            request.AddBody(crmUser);

            RestResponse <CRMUser> response = client.Execute <CRMUser>(request);

            return(response);
        }
        private Property SetCRMUserProperties(Property prop, CRMUser task)
        {
            if (task != null)
            {
                switch (prop.Name.ToLower())
                {
                case "userfqn":
                    prop.Value = task.UserFQN;
                    break;

                case "userid":
                    prop.Value = task.UserId;
                    break;
                }
            }
            return(prop);
        }
        public RestResponse<CRMUser> GetCRMUser(CRMUser crmUser, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();
            request.Method = Method.POST;
            request.Credentials = config.CredentialCache;
            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource = "K2CRM/CRMGetUser";

            request.AddBody(crmUser);

            RestResponse<CRMUser> response = client.Execute<CRMUser>(request);

            return response;
        }