コード例 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0L)
            {
                hash ^= Id.GetHashCode();
            }
            if (TemplateId.Length != 0)
            {
                hash ^= TemplateId.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (CompletionPedometerKm != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(CompletionPedometerKm);
            }
            if (Timestamp != 0L)
            {
                hash ^= Timestamp.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #2
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (TemplateId.IsNullOrEmpty())
            {
                yield return(new ValidationResult("TemplateId can't be null or empty."));
            }


            if (To.IsNullOrEmpty())
            {
                yield return(new ValidationResult("The To can't be empty."));
            }
            else
            {
                foreach (var to in To)
                {
                    var items = to.Validate(validationContext);

                    foreach (var item in items)
                    {
                        yield return(item);
                    }
                }
            }
        }
コード例 #3
0
    public void FromIDataReader(IDataReader pobjIDataReader)
    {
        if (pobjIDataReader == null)
        {
            return;
        }

        if ((!object.ReferenceEquals(pobjIDataReader["templateId"], DBNull.Value)))
        {
            this.TemplateId = Convert.ToInt32(pobjIDataReader["templateId"]);
        }

        if ((!object.ReferenceEquals(pobjIDataReader["Nome"], DBNull.Value)))
        {
            this.Nome = pobjIDataReader["Nome"].ToString();
        }

        if ((!object.ReferenceEquals(pobjIDataReader["Arquivo"], DBNull.Value)))
        {
            this.Arquivo = pobjIDataReader["Arquivo"].ToString();
        }

        if ((!object.ReferenceEquals(pobjIDataReader["QuantidadeAba"], DBNull.Value)))
        {
            this.QuantidadeAba = Convert.ToInt32(pobjIDataReader["QuantidadeAba"]);
        }

        IdArquivo = string.Concat(TemplateId.ToString(), "|", Arquivo);
    }
コード例 #4
0
        /// <summary>
        /// Configures the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="config">The config.</param>
        /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception>
        public override void Configure(Type type, Mapper.Configuration.AbstractTypeConfiguration config)
        {
            var scConfig = config as SitecoreTypeConfiguration;

            if (scConfig == null)
            {
                throw new ConfigurationException(
                          "Type configuration is not of type {0}".Formatted(typeof(SitecoreTypeConfiguration).FullName));
            }


            if (BranchId.IsNotNullOrEmpty())
            {
                scConfig.BranchId = new ID(this.BranchId);
            }
            else
            {
                scConfig.BranchId = ID.Null;
            }

            if (TemplateId.IsNotNullOrEmpty())
            {
                scConfig.TemplateId = new ID(this.TemplateId);
            }
            else
            {
                scConfig.TemplateId = ID.Null;
            }

            scConfig.CodeFirst    = this.CodeFirst;
            scConfig.TemplateName = this.TemplateName;

            base.Configure(type, config);
        }
コード例 #5
0
 public Com.Daml.Ledger.Api.V1.CreateAndExerciseCommand ToProto()
 {
     return(new Com.Daml.Ledger.Api.V1.CreateAndExerciseCommand {
         TemplateId = TemplateId.ToProto(), CreateArguments = CreateArguments.ToProtoRecord(),
         Choice = Choice, ChoiceArgument = ChoiceArgument.ToProto()
     });
 }
コード例 #6
0
        internal RequestSettings Serialize()
        {
            if (String.IsNullOrEmpty(SurveyTitle) || String.IsNullOrEmpty(SurveyNickname))
            {
                throw new ArgumentException("SurveyTitle and SurveyNickname must both be populated.");
            }

            if ((TemplateId == 0 && FromSurveyId == 0) || (TemplateId > 0 && FromSurveyId > 0))
            {
                throw new ArgumentException("You must populate either TemplateId or FromSurveyId, and not both.");
            }

            var parameters = new RequestSettings();

            if (TemplateId != 0)
            {
                parameters.Add("template_id", TemplateId.ToString());
            }
            if (FromSurveyId != 0)
            {
                parameters.Add("from_survey_id", FromSurveyId.ToString());
            }

            parameters.Add("survey_title", SurveyTitle);
            parameters.Add("survey_nickname", SurveyNickname);

            if (LanguageId != Language.NotSet)
            {
                parameters.Add("language_id", (int)LanguageId);
            }

            return(parameters);
        }
コード例 #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Iprotoid.Length != 0)
            {
                hash ^= Iprotoid.GetHashCode();
            }
            if (Id != 0L)
            {
                hash ^= Id.GetHashCode();
            }
            if (TemplateId.Length != 0)
            {
                hash ^= TemplateId.GetHashCode();
            }
            hash ^= cauldronSlot_.GetHashCode();
            if (BrewingStartTimestamp != 0L)
            {
                hash ^= BrewingStartTimestamp.GetHashCode();
            }
            if (AvailabilityStartTimestamp != 0L)
            {
                hash ^= AvailabilityStartTimestamp.GetHashCode();
            }
            if (AvailabilityTime != 0L)
            {
                hash ^= AvailabilityTime.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #8
0
 /// <summary>
 /// Creates a new exception message instance
 /// </summary>
 public ExceptionMessage(IMessage parent, Exception er)
 {
     this.template = parent.Template;
     this.RemoveInvocationTarget();
     this.RemoveInvocationArgs();
     this.SetException(er);
 }
コード例 #9
0
        /// <summary>
        /// Replaces previous extracted references to Tridion items in the template.
        /// </summary>
        /// <param name="newReferences"></param>
        public override void PerformSubstituteReferences(string[] newReferences)
        {
            RazorHandler handler = new RazorHandler(TemplateId.ToString(), WebDavUrl, Content);

            handler.Initialize();
            List <string> references = handler.GetImportReferences();

            List <string> dwReferences = new List <string>();
            int           count        = newReferences.Length - references.Count;

            for (int i = 0; i < count; i++)
            {
                dwReferences.Add(newReferences[i]);
            }

            _dwHandler.PerformSubstituteReferences(dwReferences.ToArray());

            if (handler.Config.ImportSettings.ReplaceRelativePaths)
            {
                foreach (string path in references)
                {
                    if (!path.StartsWith("tcm:") && !path.StartsWith("/webdav/"))
                    {
                        Content = Content.Replace(path, GetRelativeImportPath(path));
                    }
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Compiles the template. If there are any compilation errors, an error will be thrown at save time.
        /// </summary>
        private void ValidateCompilation()
        {
            RazorHandler handler = new RazorHandler(TemplateId.ToString(), WebDavUrl, Content);

            handler.Initialize();
            handler.CompileOnly(DateTime.Now);
        }
コード例 #11
0
        /// <summary>
        /// 获得模板Id
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="shortTemplateId"></param>
        /// <returns></returns>
        public string GetTemplateId(string accessToken, string shortTemplateId)
        {
            if (string.IsNullOrEmpty(accessToken))
            {
                throw new ArgumentException("Access Token为空");
            }
            if (string.IsNullOrEmpty(shortTemplateId))
            {
                throw new ArgumentException("Short Template Id为空");
            }

            IRestRequest request = new RestRequest("cgi-bin/template/api_add_template", Method.POST);

            request.AddQueryParameter("access_token", accessToken);
            request.AddJsonBody(new
            {
                template_id_short = shortTemplateId
            });

            IRestResponse response = _restClient.Execute(request);

            var err = JsonConvert.DeserializeObject <Error>(response.Content);

            if (err.errcode != 0)
            {
                throw new WeixinInterfaceException(err.errmsg);
            }

            TemplateId templateId = JsonConvert.DeserializeObject <TemplateId>(response.Content);

            return(templateId.template_id);
        }
コード例 #12
0
 /// <summary>
 /// Creates a new invocation request message instance
 /// </summary>
 public InvocationMessage(string target, object[] args)
 {
     this.template = TemplateId.Create();
     this.task     = new TaskCompletionSource <object>();
     this.SetTransferId((UInt64)UniqueId.Next64());
     this.SetInvocationTarget(target);
     this.SetInvocationArgs(args);
 }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return((Id.ToString("x")) + ('~') +
            (TemplateId.ToString("x")) + ('~') +
            (Quantity.ToString("x")) + ('~') +
            ((SlotId != (int)ItemSlotEnum.SLOT_INVENTORY ? SlotId.ToString("x") : "")) + ('~') +
            (StringEffects) + (';'));
 }
コード例 #14
0
        /// <summary>
        /// Configures the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="config">The config.</param>
        /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Type configuration is not of type {0}.Formatted(typeof (SitecoreTypeConfiguration).FullName)</exception>
        public override AbstractTypeConfiguration Configure(Type type)
        {
            var scConfig = new SitecoreTypeConfiguration();

            if (scConfig == null)
            {
                throw new ConfigurationException(
                          "Type configuration is not of type {0}".Formatted(typeof(SitecoreTypeConfiguration).FullName));
            }


            try
            {
                if (BranchId.HasValue())
                {
                    scConfig.BranchId = new ID(this.BranchId);
                }
                else
                {
                    scConfig.BranchId = ID.Null;
                }
            }
            catch (Exception ex)
            {
                throw new MapperException("Failed to convert BranchId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex);
            }

            try
            {
                if (TemplateId.HasValue())
                {
                    scConfig.TemplateId = new ID(this.TemplateId);
                }
                else
                {
                    scConfig.TemplateId = ID.Null;
                }
            }
            catch (Exception ex)
            {
                throw new MapperException("Failed to convert TemplateId for type {0}. Value was {1}".Formatted(type.FullName, this.TemplateId), ex);
            }

            if (TemplateId.IsNullOrEmpty() && this.EnforceTemplate.IsEnabled())
            {
                throw new ConfigurationException(
                          "The type {0} has EnforceTemplate set to true but no TemplateId".Formatted(type.FullName));
            }
            scConfig.EnforceTemplate = this.EnforceTemplate;

            scConfig.TemplateName = this.TemplateName;

            scConfig.Cache = this.Cache;

            base.Configure(type, scConfig);

            return(scConfig);
        }
コード例 #15
0
 /// <summary>
 /// Creates a new result message instance
 /// </summary>
 public ResultMessage(UInt64 id, object result)
 {
     this.template = TemplateId.Create();
     this.SetTransferId(id);
     if (result != null)
     {
         this.SetInvocationResult(result);
     }
 }
コード例 #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 public void SerializeAs_BagContent(StringBuilder message)
 {
     message
     .Append(Id.ToString("x")).Append('~')
     .Append(TemplateId.ToString("x")).Append('~')
     .Append(Quantity.ToString("x")).Append('~')
     .Append((SlotId != (int)ItemSlotEnum.SLOT_INVENTORY ? SlotId.ToString("x") : "")).Append('~')
     .Append(StringEffects).Append(';');
 }
コード例 #17
0
 public override int GetHashCode() {
   int hash = 1;
   if (TemplateId.Length != 0) hash ^= TemplateId.GetHashCode();
   if (Data.Length != 0) hash ^= Data.GetHashCode();
   if (_unknownFields != null) {
     hash ^= _unknownFields.GetHashCode();
   }
   return hash;
 }
コード例 #18
0
ファイル: ArchivedEvent.cs プロジェクト: CarlSample/daml-net
        public Com.DigitalAsset.Ledger.Api.V1.ArchivedEvent ToProto()
        {
            var archivedEvent = new Com.DigitalAsset.Ledger.Api.V1.ArchivedEvent {
                ContractId = ContractId, EventId = EventId, TemplateId = TemplateId.ToProto()
            };

            archivedEvent.WitnessParties.AddRange(WitnessParties);
            return(archivedEvent);
        }
コード例 #19
0
 /// <summary>
 /// Creates a new result message instance
 /// </summary>
 public ResultMessage(IMessage parent, object result)
 {
     this.template = parent.Template;
     this.RemoveInvocationTarget();
     this.RemoveInvocationArgs();
     if (result != null)
     {
         this.SetInvocationResult(result);
     }
 }
コード例 #20
0
        /// <summary>
        /// Configures the specified property info.
        /// </summary>
        /// <param name="propertyInfo">The property info.</param>
        /// <param name="config">The config.</param>
        public void Configure(PropertyInfo propertyInfo, SitecoreLinkedConfiguration config)
        {
            config.Option = this.Option;
            if (TemplateId.HasValue())
            {
                config.TemplateId = new ID(TemplateId);
            }
            config.EnforceTemplate = EnforceTemplate;

            base.Configure(propertyInfo, config);
        }
コード例 #21
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            LoadAuthentication(context);

            templateId  = TemplateId.Get(context);
            recipientId = RecipientId.Get(context);
            filePath    = FilePath.Get(context);

            CreateBulkEnvelopeDelegate = new Action(_AddBulkRecipientAction);
            return(CreateBulkEnvelopeDelegate.BeginInvoke(callback, state));
        }
コード例 #22
0
        Archetyped GetArchetypeDetails(string archetypeId)
        {
            //var aId = new ArchetypeId("openEHR-EHR-COMPOSITION.report-result.v1");
            var    aId       = new ArchetypeId(archetypeId);
            var    tId       = new TemplateId("bitalino_monitor.en.v1");
            string rmVersion = "1.0.1";

            Archetyped details = new Archetyped(aId, rmVersion, tId);

            return(details);
        }
コード例 #23
0
        /// <summary>
        /// Получить текстовый шаблон
        /// </summary>
        /// <param name="pageId">идентификатор страницы</param>
        /// <param name="templateId">идентификатор текстового шаблона</param>
        /// <param name="args">параметры</param>
        /// <returns>текст</returns>
        public string Get(PageId pageId, TemplateId templateId, params object[] args)
        {
            string key = GetKey(templateId, pageId);

            string result;

            if (!_templates.TryGetValue(key, out result))
            {
                return(null);
            }

            return(string.Format(result, args));
        }
コード例 #24
0
        /// <summary>
        /// Получить текст для раздела и по шаблону
        /// </summary>
        /// <param name="sectionId">идентификатор раздела</param>
        /// <param name="pageId">идентификатор страницы</param>
        /// <param name="templateId">идентификатор шаблона</param>
        /// <param name="args">дополнительный шаблон</param>
        /// <returns>текстовые шаблоны</returns>
        public string Get(SectionId sectionId, PageId pageId, TemplateId templateId, params object[] args)
        {
            TemplateSection section;

            if (!_sectionsTemplates.TryGetValue(sectionId, out section))
            {
                return(null);
            }

            string result = section.Get(pageId, templateId, args);

            return(result);
        }
コード例 #25
0
        public Com.Daml.Ledger.Api.V1.ExercisedEvent ToProto()
        {
            var exercisedEvent = new Com.Daml.Ledger.Api.V1.ExercisedEvent {
                EventId    = EventId, Choice = Choice, ChoiceArgument = ChoiceArgument.ToProto(), Consuming = Consuming,
                ContractId = ContractId, TemplateId = TemplateId.ToProto(), ExerciseResult = ExerciseResult.ToProto()
            };

            exercisedEvent.ActingParties.AddRange(ActingParties);
            exercisedEvent.WitnessParties.AddRange(WitnessParties);
            exercisedEvent.ChildEventIds.AddRange(ChildEventIds);

            return(exercisedEvent);
        }
コード例 #26
0
        /// <summary>
        /// Configures the specified property info.
        /// </summary>
        /// <param name="propertyInfo">The property info.</param>
        /// <returns>AbstractPropertyConfiguration.</returns>
        public override Mapper.Configuration.AbstractPropertyConfiguration Configure(System.Reflection.PropertyInfo propertyInfo)
        {
            var config = new SitecoreParentConfiguration();

            if (TemplateId.HasValue())
            {
                config.TemplateId = new ID(TemplateId);
            }
            config.EnforceTemplate = EnforceTemplate;

            Configure(propertyInfo, config);
            return(config);
        }
コード例 #27
0
        /// <summary>
        /// Установить текстовый шаблон
        /// </summary>
        /// <param name="pageId">идентификатор страницы</param>
        /// <param name="templateId">идентификатор текстового шаблона</param>
        /// <param name="text">текст</param>
        public void Set(PageId pageId, TemplateId templateId, string text)
        {
            string key = GetKey(templateId, pageId);

            if (_templates.ContainsKey(key))
            {
                _templates[key] = text;
            }
            else
            {
                _templates.Add(key, text);
            }
        }
コード例 #28
0
        /// <summary>
        /// Returns true if ProvisioningRequest instances are equal
        /// </summary>
        /// <param name="other">Instance of ProvisioningRequest to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProvisioningRequest other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TemplateId == other.TemplateId ||
                     TemplateId != null &&
                     TemplateId.Equals(other.TemplateId)
                     ) &&
                 (
                     RequestedTeamName == other.RequestedTeamName ||
                     RequestedTeamName != null &&
                     RequestedTeamName.Equals(other.RequestedTeamName)
                 ) &&
                 (
                     RequestedTeamDescription == other.RequestedTeamDescription ||
                     RequestedTeamDescription != null &&
                     RequestedTeamDescription.Equals(other.RequestedTeamDescription)
                 ) &&
                 (
                     RequestedTeamWelcomeMessage == other.RequestedTeamWelcomeMessage ||
                     RequestedTeamWelcomeMessage != null &&
                     RequestedTeamWelcomeMessage.Equals(other.RequestedTeamWelcomeMessage)
                 ) &&
                 (
                     RequestedMembers == other.RequestedMembers ||
                     RequestedMembers != null &&
                     other.RequestedMembers != null &&
                     RequestedMembers.SequenceEqual(other.RequestedMembers)
                 ) &&
                 (
                     RequestedOwners == other.RequestedOwners ||
                     RequestedOwners != null &&
                     other.RequestedOwners != null &&
                     RequestedOwners.SequenceEqual(other.RequestedOwners)
                 ) &&
                 (
                     OnBehalfOfRequester == other.OnBehalfOfRequester ||
                     OnBehalfOfRequester != null &&
                     OnBehalfOfRequester.Equals(other.OnBehalfOfRequester)
                 ));
        }
コード例 #29
0
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (TemplateId.Length != 0)
                    {
                        hash ^= TemplateId.GetHashCode();
                    }
                    if (Data.Length != 0)
                    {
                        hash ^= Data.GetHashCode();
                    }
                    return(hash);
                }
コード例 #30
0
        public override IDictionary <string, object> GetSerializedValue()
        {
            var val = new Dictionary <string, object>();

            // (APN) Note that the model's TemplateId property has been changed to HiveId? because currently the modelmetadata
            // is considering a non-nullable value type to be implicitly required, making it impossible to save content without a template assigned (Sep 11)
            // (MB) Removed the HiveId.Empty check to allow for "No Template" selections. Please note that there is now a difference between null (no value selected)
            // and HiveId.Empty ("No Template" value selected) (2012/01/18)
            if (TemplateId != null)
            {
                val.Add("TemplateId", TemplateId.ToString());
            }
            return(val);
        }