private void CreateTask(ref ServiceObject so) { SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0]; WizardFunctions helper = new WizardFunctions(); bool async = false; bool.TryParse(NotNull(so.Properties["ExecuteAsync"].Value), out async); config.Async = async; CRMTask task = new CRMTask(); task.Config = crmconfig; task.Category = NotNull(so.Properties["Category"].Value); task.Description = NotNull(so.Properties["Description"].Value); task.DueDate = DateTime.Parse(NotNull(so.Properties["DueDate"].Value)); task.Duration = int.Parse(NotNull(so.Properties["Duration"].Value)); task.OwnerFQN = NotNull(so.Properties["OwnerFQN"].Value); task.OwnerId = NotNull(so.Properties["OwnerId"].Value); task.Owner = NotNull(so.Properties["Owner"].Value); task.Priority = int.Parse(NotNull(so.Properties["Priority"].Value)); task.Regarding = NotNull(so.Properties["Regarding"].Value); task.RegardingId = NotNull(so.Properties["RegardingId"].Value); task.State = int.Parse(NotNull(so.Properties["State"].Value)); task.Status = int.Parse(NotNull(so.Properties["Status"].Value)); task.Subcategory = NotNull(so.Properties["Subcategory"].Value); task.Subject = NotNull(so.Properties["Subject"].Value); task.K2SerialNumber = NotNull(so.Properties["K2SerialNumber"].Value); task.K2ActivityName = NotNull(so.Properties["K2ActivityName"].Value); task.K2ProcessName = NotNull(so.Properties["K2ProcessName"].Value); task.K2ProcessInstanceId = int.Parse(NotNull(so.Properties["K2ProcessInstanceId"].Value)); try { RestResponse <CRMTask> response = helper.CreateTask(task, config); if (response != null) { so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetTaskProperties(prop, response); } so.Properties.BindPropertiesToResultTable(); } { // do something for async call } } catch (Exception ex) { throw; } }
public RestResponse<CRMTask> CreateTask(CRMTask crmTask, 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/CRMCreateTask"; request.AddBody(crmTask); RestResponse<CRMTask> response = client.Execute<CRMTask>(request); return response; }
public RestResponse <CRMTask> CreateTask(CRMTask crmTask, 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/CRMCreateTask"; request.AddBody(crmTask); RestResponse <CRMTask> response = client.Execute <CRMTask>(request); return(response); }
private void CreateTask(ref ServiceObject so) { SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0]; K2CRMHelper helper = new K2CRMHelper(); CRMTask task = new CRMTask(); task.Category = NotNull(so.Properties["Category"].Value); task.Description = NotNull(so.Properties["Description"].Value); task.DueDate = DateTime.Parse(NotNull(so.Properties["DueDate"].Value)); task.Duration = int.Parse(NotNull(so.Properties["Duration"].Value)); task.OwnerFQN = NotNull(so.Properties["OwnerFQN"].Value); task.OwnerId = NotNull(so.Properties["OwnerId"].Value); task.Owner = NotNull(so.Properties["Owner"].Value); task.Priority = int.Parse(NotNull(so.Properties["Priority"].Value)); task.Regarding = NotNull(so.Properties["Regarding"].Value); task.RegardingId = NotNull(so.Properties["RegardingId"].Value); task.State = int.Parse(NotNull(so.Properties["State"].Value)); task.Status = int.Parse(NotNull(so.Properties["Status"].Value)); task.Subcategory = NotNull(so.Properties["Subcategory"].Value); task.Subject = NotNull(so.Properties["Subject"].Value); try { RestResponse <CRMTask> response = helper.CreateTask(task, config); so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetTaskProperties(prop, response); } } catch (Exception ex) { throw; } }
private void CreateTask(ref ServiceObject so) { SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0]; K2CRMHelper helper = new K2CRMHelper(); CRMTask task = new CRMTask(); task.Category = NotNull(so.Properties["Category"].Value); task.Description = NotNull(so.Properties["Description"].Value); task.DueDate = DateTime.Parse(NotNull(so.Properties["DueDate"].Value)); task.Duration = int.Parse(NotNull(so.Properties["Duration"].Value)); task.OwnerFQN = NotNull(so.Properties["OwnerFQN"].Value); task.OwnerId = NotNull(so.Properties["OwnerId"].Value); task.Owner = NotNull(so.Properties["Owner"].Value); task.Priority = int.Parse(NotNull(so.Properties["Priority"].Value)); task.Regarding = NotNull(so.Properties["Regarding"].Value); task.RegardingId = NotNull(so.Properties["RegardingId"].Value); task.State = int.Parse(NotNull(so.Properties["State"].Value)); task.Status = int.Parse(NotNull(so.Properties["Status"].Value)); task.Subcategory = NotNull(so.Properties["Subcategory"].Value); task.Subject = NotNull(so.Properties["Subject"].Value); try { RestResponse<CRMTask> response = helper.CreateTask(task, config); so.Properties.InitResultTable(); for (int c = 0; c < meth.ReturnProperties.Count; c += 1) { Property prop = so.Properties[meth.ReturnProperties[c]]; prop = SetTaskProperties(prop, response); } } catch (Exception ex) { throw; } }