Пример #1
0
        protected override void OnSave(ISerializationInfo content)
        {
            base.OnSave(content);

            if (!K2Field.IsNullOrEmpty(SmartObjectServer))
            {
                content.SetProperty("SmartObjectServer", SmartObjectServer);
            }
            if (!K2Field.IsNullOrEmpty(CRMFunctionsSmartObject))
            {
                content.SetProperty("CRMFunctionsSmartObject", CRMFunctionsSmartObject);
            }
            if (!K2Field.IsNullOrEmpty(CRMServerURL))
            {
                content.SetProperty("CRMServerURL", CRMServerURL);
            }
            if (!K2Field.IsNullOrEmpty(CRMOrganisation))
            {
                content.SetProperty("CRMOrganisation", CRMOrganisation);
            }
            if (!K2Field.IsNullOrEmpty(CRMEntityId))
            {
                content.SetProperty("CRMEntityId", CRMEntityId);
            }
            if (!K2Field.IsNullOrEmpty(CRMEntityType))
            {
                content.SetProperty("CRMEntityType", CRMEntityType);
            }
            //if (!K2Field.IsNullOrEmpty(CustomServiceURL))
            //{
            //    content.SetProperty("CustomServiceURL", CustomServiceURL);
            //}
        }
Пример #2
0
        protected override void OnLoad(ISerializationInfo content)
        {
            base.OnLoad(content);

            if (content.HasProperty("CRMServerURL"))
            {
                this.CRMServerURL = (K2Field)content.GetPropertyAsPersistableObject("CRMServerURL");
            }
            if (content.HasProperty("CRMOrganisation"))
            {
                this.CRMOrganisation = (K2Field)content.GetPropertyAsPersistableObject("CRMOrganisation");
            }
            if (content.HasProperty("CRMEntityId"))
            {
                this.CRMEntityId = (K2Field)content.GetPropertyAsPersistableObject("CRMEntityId");
            }
            if (content.HasProperty("CRMEntityType"))
            {
                this.CRMEntityType = (K2Field)content.GetPropertyAsPersistableObject("CRMEntityType");
            }
            //if (content.HasProperty("CustomServiceURL"))
            //{
            //    this.CustomServiceURL = (K2Field)content.GetPropertyAsPersistableObject("CustomServiceURL");
            //}
            if (content.HasProperty("SmartObjectServer"))
            {
                this.SmartObjectServer = (K2Field)content.GetPropertyAsPersistableObject("SmartObjectServer");
            }
            if (content.HasProperty("CRMFunctionsSmartObject"))
            {
                this.CRMFunctionsSmartObject = (K2Field)content.GetPropertyAsPersistableObject("CRMFunctionsSmartObject");
            }
        }
Пример #3
0
        protected override void OnSave(ISerializationInfo content)
        {
            base.OnSave(content);

            if (!K2Field.IsNullOrEmpty(_powerShellScript))
            {
                content.SetProperty(POWERSHELLSCRIPT, _powerShellScript);
            }

            if (_inputVariables != null && _inputVariables.Count > 0)
            {
                content.SetListProperty(INPUTVARIABLES, _inputVariables);
            }

            if (_outputVariables != null && _outputVariables.Count > 0)
            {
                content.SetListProperty(OUTPUTVARIABLES, _outputVariables);
            }
        }
Пример #4
0
        protected override void OnLoad(ISerializationInfo content)
        {
            base.OnLoad(content);

            if (content.HasProperty(POWERSHELLSCRIPT))
            {
                PowerShellScript = (K2Field)content.GetPropertyAsPersistableObject(POWERSHELLSCRIPT);
            }

            if (content.HasProperty(INPUTVARIABLES))
            {
                InputVariables.Clear();
                content.GetListProperty(INPUTVARIABLES, InputVariables);
            }

            if (content.HasProperty(OUTPUTVARIABLES))
            {
                OutputVariables.Clear();
                content.GetListProperty(OUTPUTVARIABLES, OutputVariables);
            }
        }
Пример #5
0
        /// <summary>
        /// Gets the appropriate serialization information object for the chosen method.
        /// </summary>
        /// <param name="contractMethod">The contract method.</param>
        /// <returns>The serialization info object to use.</returns>
        private static ISerializationInfo GetSerializationInfo(MethodInfo contractMethod)
        {
            ISerializationInfo ans = null;

            WcfSerializationInfoClass wcf = new WcfSerializationInfoClass();

            if (wcf.Supports(contractMethod))
            {
                Debug.Assert(ans == null, "ContractMethod supports more than one serialization method, which is not allowed");
                ans = wcf;
            }

            AsmxSerializationInfoClass asmx = new AsmxSerializationInfoClass();

            if (asmx.Supports(contractMethod))
            {
                Debug.Assert(ans == null, "ContractMethod supports more than one serialization method, which is not allowed");
                ans = asmx;
            }

            Debug.Assert(ans != null, "Contract method found not to support any known serialization method");
            return(ans);
        }
        void SerializeAutoSerializable(object instance, TypeSerializationArgs args)
        {
            TypeSerializationArgs callerArgs = args;

            args = args.Clone();

            if (this.IsInline)
            {
                //  Inline objects are serialized with only a 2-byte length prefix
                //  No version info or anything else
                int  length         = 0;
                long lengthPosition = args.Writer.BaseStream.Position;
                long endPosition    = -1;

                args.Writer.Write((byte)length);

                if (instance != null)
                {
                    args.Header                = new TypeSerializationHeader();
                    args.Header.DataVersion    = 1;
                    args.Header.DataMinVersion = 1;

                    this.autoSerializeMethod(instance, args);
                    endPosition = args.Writer.BaseStream.Position;

                    length = (int)((endPosition - lengthPosition) - InlineHeaderSize);
                    if (length > MaxInlineSize)
                    {
                        throw new NotSupportedException(string.Format(
                                                            "Inline classes must be {0} bytes or less. Class {1} serialized to {2} bytes.",
                                                            MaxInlineSize,
                                                            instance.GetType().FullName,
                                                            length
                                                            ));
                    }

                    args.Writer.BaseStream.Position = lengthPosition;
                    args.Writer.Write((byte)length);
                    args.Writer.BaseStream.Position = endPosition;
                }
            }
            else if (instance == null)
            {
                args.Writer.Write(NullVersion);
            }
            else
            {
                args.Header                = new TypeSerializationHeader();
                args.Header.DataVersion    = (byte)this.CurrentVersion;
                args.Header.DataMinVersion = (byte)this.MinVersion;

                //  If min version is less than or equal legacy version then write
                //  out legacy version + 1 as the min version in the data stream.This
                //  is to prevent older class definitions from attempting to
                //  deserialize the new data using IVersionSerializable
                if ((this.LegacyVersion > 0) && (this.LegacyVersion >= this.MinVersion))
                {
                    args.Header.DataMinVersion = (byte)(this.LegacyVersion + 1);
                }

                //  If this isn't a base class invocation then make sure
                //  SerializationInfo is initialized for the first time.
                //  If it is a base class then get the base class info
                //  from the parent's SerializationInfo
                if (callerArgs.IsBaseClass == false)
                {
                    ISerializationInfo info = instance as ISerializationInfo;

                    if (info != null)
                    {
                        args.SerializationInfo = info.SerializationInfo;
                    }
                    else
                    {
                        //  SerializationInfo may not be null in this case
                        //  because this may be an object contained in a parent
                        //  class. We need to make sure the child object doesn't
                        //  use the serialization info from the container
                        args.SerializationInfo = null;
                    }
                }
                else if (args.SerializationInfo != null)
                {
                    args.SerializationInfo = callerArgs.SerializationInfo.BaseClassInfo;
                }

                //  Handled cached serialization info if original data
                //  was newer than the class definition that deserialized it
                if (
                    (args.SerializationInfo != null) &&
                    (args.SerializationInfo.Version > this.CurrentVersion)
                    )
                {
                    args.Header.DataVersion    = (byte)args.SerializationInfo.Version;
                    args.Header.DataMinVersion = (byte)args.SerializationInfo.MinVersion;
                }

                //  Write a special version byte to indicate this serialized
                //  data uses a header. Because this version is guaranteed to
                //  be higher than actual object versions, older serialization
                //  code will simply treat this is a higher unhandled version,
                //  which is true.
                args.Writer.Write(HasHeaderVersion);

                //  Write the header with placeholder data
                args.Header.Write(args.Writer);

                //  Serialize the object
                this.autoSerializeMethod(instance, args);

                //  Update the header with final data. Note that the
                //  TypeSerializationHeader class takes care of the
                //  stream position
                args.Header.Write(args.Writer);
            }
        }
        //When your project is saved, this override determines which properties you have defined
        //gets saved and can ba accessed once the project is reopened
        protected override void OnSave(ISerializationInfo content)
        {
            base.OnSave(content);

            if (!string.IsNullOrEmpty(InternetPlatform))
            {
                content.SetProperty("InternetPlatform", InternetPlatform);
            }
            content.SetProperty("InsertSN", InsertSN);
            content.SetProperty("CreateTasks", CreateTasks);

            if (!K2Field.IsNullOrEmpty(SN))
            {
                content.SetProperty("SN", SN);
            }

            if (!K2Field.IsNullOrEmpty(ActivityName))
            {
                content.SetProperty("ActivityName", ActivityName);
            }
            if (!K2Field.IsNullOrEmpty(ProcessName))
            {
                content.SetProperty("ProcessName", ProcessName);
            }
            if (!K2Field.IsNullOrEmpty(SmartObjectServer))
            {
                content.SetProperty("SmartObjectServer", SmartObjectServer);
            }
            if (!K2Field.IsNullOrEmpty(CRMFunctionsSmartObject))
            {
                content.SetProperty("CRMFunctionsSmartObject", CRMFunctionsSmartObject);
            }
            //if (!K2Field.IsNullOrEmpty(CustomServiceURL))
            //{
            //    content.SetProperty("CustomServiceURL", CustomServiceURL);
            //}
            if (!K2Field.IsNullOrEmpty(CRMServerURL))
            {
                content.SetProperty("CRMServerURL", CRMServerURL);
            }
            if (!K2Field.IsNullOrEmpty(CRMOrganisation))
            {
                content.SetProperty("CRMOrganisation", CRMOrganisation);
            }
            if (!K2Field.IsNullOrEmpty(CRMFormURL))
            {
                content.SetProperty("CRMFormURL", CRMFormURL);
            }
            if (!K2Field.IsNullOrEmpty(CRMEntityId))
            {
                content.SetProperty("CRMEntityId", CRMEntityId);
            }
            if (!K2Field.IsNullOrEmpty(CRMEntityType))
            {
                content.SetProperty("CRMEntityType", CRMEntityType);
            }
            if (!K2Field.IsNullOrEmpty(CRMEntityForm))
            {
                content.SetProperty("CRMEntityForm", CRMEntityForm);
            }
            if (!K2Field.IsNullOrEmpty(CRMCustomSNParameter))
            {
                content.SetProperty("CRMCustomSNParameter", CRMCustomSNParameter);
            }
            if (!K2Field.IsNullOrEmpty(TaskCategory))
            {
                content.SetProperty("TaskCategory", TaskCategory);
            }
            if (!K2Field.IsNullOrEmpty(TaskDescription))
            {
                content.SetProperty("TaskDescription", TaskDescription);
            }
            if (!K2Field.IsNullOrEmpty(TaskDueDate))
            {
                content.SetProperty("TaskDueDate", TaskDueDate);
            }
            if (!K2Field.IsNullOrEmpty(TaskDuration))
            {
                content.SetProperty("TaskDuration", TaskDuration);
            }
            if (!K2Field.IsNullOrEmpty(TaskOwnerFQN))
            {
                content.SetProperty("TaskOwnerFQN", TaskOwnerFQN);
            }
            if (!K2Field.IsNullOrEmpty(TaskOwner))
            {
                content.SetProperty("TaskOwner", TaskOwner);
            }
            if (!K2Field.IsNullOrEmpty(TaskOwnerId))
            {
                content.SetProperty("TaskOwnerId", TaskOwnerId);
            }
            if (!K2Field.IsNullOrEmpty(TaskPriority))
            {
                content.SetProperty("TaskPriority", TaskPriority);
            }
            if (!K2Field.IsNullOrEmpty(TaskRegarding))
            {
                content.SetProperty("TaskRegarding", TaskRegarding);
            }
            if (!K2Field.IsNullOrEmpty(TaskRegardingId))
            {
                content.SetProperty("TaskRegardingId", TaskRegardingId);
            }
            if (!K2Field.IsNullOrEmpty(TaskState))
            {
                content.SetProperty("TaskState", TaskState);
            }
            if (!K2Field.IsNullOrEmpty(TaskStatus))
            {
                content.SetProperty("TaskStatus", TaskStatus);
            }
            if (!K2Field.IsNullOrEmpty(TaskSubcategory))
            {
                content.SetProperty("TaskSubcategory", TaskSubcategory);
            }
            if (!K2Field.IsNullOrEmpty(TaskSubject))
            {
                content.SetProperty("TaskSubject", TaskSubject);
            }

            this.EnsureThatRequiredProcessFieldsExists();
        }
        //When your wizard page is loaded, this override determines what values exist already and loads those
        //values into the wizard for display. I.e. if you have a value of "123" that was previously entered into a textbox
        //on your wizard, this override will load it into memory and on you Wizard page's "OnActivate", this value
        //can be retrieved and displayed in your text box.
        protected override void OnLoad(ISerializationInfo content)
        {
            base.OnLoad(content);

            if (content.HasProperty("InternetPlatform"))
            {
                _InternetPlatform = content.GetPropertyAsString("InternetPlatform");
            }
            if (content.HasProperty("InsertSN"))
            {
                _InsertSN = content.GetPropertyAsBoolean("InsertSN");
            }
            if (content.HasProperty("CreateTasks"))
            {
                _CreateTasks = content.GetPropertyAsBoolean("CreateTasks");
            }

            if (content.HasProperty("SN"))
            {
                this.SN = (K2Field)content.GetPropertyAsPersistableObject("SN");
            }

            if (content.HasProperty("ActivityName"))
            {
                this.ActivityName = (K2Field)content.GetPropertyAsPersistableObject("ActivityName");
            }
            if (content.HasProperty("ProcessName"))
            {
                this.ProcessName = (K2Field)content.GetPropertyAsPersistableObject("ProcessName");
            }
            if (content.HasProperty("SmartObjectServer"))
            {
                this.SmartObjectServer = (K2Field)content.GetPropertyAsPersistableObject("SmartObjectServer");
            }
            if (content.HasProperty("CRMFunctionsSmartObject"))
            {
                this.CRMFunctionsSmartObject = (K2Field)content.GetPropertyAsPersistableObject("CRMFunctionsSmartObject");
            }
            //if (content.HasProperty("CustomServiceURL"))
            //{
            //    this.CustomServiceURL = (K2Field)content.GetPropertyAsPersistableObject("CustomServiceURL");
            //}
            if (content.HasProperty("CRMServerURL"))
            {
                this.CRMServerURL = (K2Field)content.GetPropertyAsPersistableObject("CRMServerURL");
            }
            if (content.HasProperty("CRMOrganisation"))
            {
                this.CRMOrganisation = (K2Field)content.GetPropertyAsPersistableObject("CRMOrganisation");
            }
            if (content.HasProperty("CRMFormURL"))
            {
                this.CRMFormURL = (K2Field)content.GetPropertyAsPersistableObject("CRMFormURL");
            }
            if (content.HasProperty("CRMEntityId"))
            {
                this.CRMEntityId = (K2Field)content.GetPropertyAsPersistableObject("CRMEntityId");
            }
            if (content.HasProperty("CRMEntityType"))
            {
                this.CRMEntityType = (K2Field)content.GetPropertyAsPersistableObject("CRMEntityType");
            }
            if (content.HasProperty("CRMEntityForm"))
            {
                this.CRMEntityForm = (K2Field)content.GetPropertyAsPersistableObject("CRMEntityForm");
            }
            if (content.HasProperty("CRMCustomSNParameter"))
            {
                this.CRMCustomSNParameter = (K2Field)content.GetPropertyAsPersistableObject("CRMCustomSNParameter");
            }
            if (content.HasProperty("TaskCategory"))
            {
                this.TaskCategory = (K2Field)content.GetPropertyAsPersistableObject("TaskCategory");
            }
            if (content.HasProperty("TaskDescription"))
            {
                this.TaskDescription = (K2Field)content.GetPropertyAsPersistableObject("TaskDescription");
            }
            if (content.HasProperty("TaskDueDate"))
            {
                this.TaskDueDate = (K2Field)content.GetPropertyAsPersistableObject("TaskDueDate");
            }
            if (content.HasProperty("TaskDuration"))
            {
                this.TaskDuration = (K2Field)content.GetPropertyAsPersistableObject("TaskDuration");
            }
            if (content.HasProperty("TaskOwnerFQN"))
            {
                this.TaskOwnerFQN = (K2Field)content.GetPropertyAsPersistableObject("TaskOwnerFQN");
            }
            if (content.HasProperty("TaskOwner"))
            {
                this.TaskOwner = (K2Field)content.GetPropertyAsPersistableObject("TaskOwner");
            }
            if (content.HasProperty("TaskOwnerId"))
            {
                this.TaskOwnerId = (K2Field)content.GetPropertyAsPersistableObject("TaskOwnerId");
            }
            if (content.HasProperty("TaskPriority"))
            {
                this.TaskPriority = (K2Field)content.GetPropertyAsPersistableObject("TaskPriority");
            }
            if (content.HasProperty("TaskRegarding"))
            {
                this.TaskRegarding = (K2Field)content.GetPropertyAsPersistableObject("TaskRegarding");
            }
            if (content.HasProperty("TaskRegardingId"))
            {
                this.TaskRegardingId = (K2Field)content.GetPropertyAsPersistableObject("TaskRegardingId");
            }
            if (content.HasProperty("TaskState"))
            {
                this.TaskState = (K2Field)content.GetPropertyAsPersistableObject("TaskState");
            }
            if (content.HasProperty("TaskStatus"))
            {
                this.TaskStatus = (K2Field)content.GetPropertyAsPersistableObject("TaskStatus");
            }
            if (content.HasProperty("TaskSubcategory"))
            {
                this.TaskSubcategory = (K2Field)content.GetPropertyAsPersistableObject("TaskSubcategory");
            }
            if (content.HasProperty("TaskSubject"))
            {
                this.TaskSubject = (K2Field)content.GetPropertyAsPersistableObject("TaskSubject");
            }

            this.EnsureThatRequiredProcessFieldsExists();
        }