Esempio n. 1
0
        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;
            }
        }