public RestResponse <CRMPicklist> CRMGetStateStatus(CRMPicklist picklist, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();

            request.Method = Method.POST;
            if (config.CredentialCache != null)
            {
                request.Credentials = config.CredentialCache;
            }
            if (config.Credentials != null)
            {
                request.Credentials = config.Credentials;
            }

            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource      = "K2CRM/CRMGetStateStatus";

            request.AddBody(picklist);

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

            return(response);
        }
        public RestResponse<CRMPicklist> CRMGetStateStatus(CRMPicklist picklist, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();
            request.Method = Method.POST;
            if (config.CredentialCache != null)
            {
                request.Credentials = config.CredentialCache;
            }
            if (config.Credentials != null)
            {
                request.Credentials = config.Credentials;
            }

            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource = "K2CRM/CRMGetStateStatus";

            request.AddBody(picklist);

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

            return response;
        }
        private void GetStateStatusPicklist(ref ServiceObject so)
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0];
            //K2CRMHelper helper = new K2CRMHelper();
            WizardFunctions helper = new WizardFunctions();
            CRMPicklist picklist = new CRMPicklist();
            picklist.Config = crmconfig;

            try
            {
                picklist.EntityLogicalName = NotNull(so.Properties["EntityLogicalName"].Value);

                RestResponse<CRMPicklist> response = helper.CRMGetStateStatus(picklist, config);

                so.Properties.InitResultTable();
                foreach (CRMPicklistOption ret in response.Data.Picklist)
                {
                    for (int c = 0; c < meth.ReturnProperties.Count; c += 1)
                    {
                        Property prop = so.Properties[meth.ReturnProperties[c]];
                        prop = SetGetPicklistOptionProperties(prop, ret);
                    }
                    so.Properties.BindPropertiesToResultTable();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }