예제 #1
0
        private string GetFieldXml(bool required, string additionalProperties, string fieldContent)
        {
            var format      = !string.IsNullOrEmpty(Format) ? " Format=\"" + Format + "\"" : string.Empty;
            var showField   = !string.IsNullOrEmpty(ShowField) ? " ShowField=\"" + ShowField + "\"" : string.Empty;
            var openTermSet = OpenTermSet ? " CreateValuesInEditForm=\"TRUE\" Open=\"TRUE\"" : string.Empty;

            var fieldXml = new StringBuilder();

            fieldXml.AppendFormat(
                "<Field ID=\"{0}\" Name=\"{1}\" DisplayName=\"{2}\" Type=\"{3}\" Hidden=\"{4}\" " +
                "Group=\"{5}\" Description=\"{6}\" Required=\"{7}\" " +
                "ShowInNewForm=\"{8}\" ShowInEditForm=\"{9}\" ShowInDisplayForm=\"{10}\"" +
                "{11}{12}{13} {14}>",
                ID.ToString("B"), InternalName.Trim(), DisplayName.Trim(), Type, Hidden,
                Group, Description, required.ToString().ToUpper(),
                ShowInNewForm.ToString().ToUpper(), ShowInEditForm.ToString().ToUpper(), ShowInDisplayForm.ToString().ToUpper(),
                format, showField, openTermSet, additionalProperties);

            if (!string.IsNullOrEmpty(Default))
            {
                fieldXml.AppendFormat("<Default>{0}</Default>", Default);
            }
            if (!string.IsNullOrEmpty(fieldContent))
            {
                fieldXml.Append(fieldContent);
            }
            fieldXml.Append("</Field>");

            return(fieldXml.ToString());
        }
예제 #2
0
파일: GtField.cs 프로젝트: GissiSim/sherpa
        /// <summary>
        /// Not too happy with how this is done
        /// </summary>
        /// <param name="required"></param>
        /// <param name="additionalProperties"></param>
        /// <returns></returns>
        private string GetSelfClosingFieldXml(bool required, string additionalProperties)
        {
            var format    = !string.IsNullOrEmpty(Format) ? "Format=\"" + Format + "\"" : string.Empty;
            var showField = !string.IsNullOrEmpty(ShowField) ? "ShowField=\"" + ShowField + "\"" : string.Empty;

            return(String.Format(
                       "<Field ID=\"{0}\" Name=\"{1}\" DisplayName=\"{2}\" Type=\"{3}\" Hidden=\"{4}\" " +
                       "Group=\"{5}\" Description=\"{6}\" Required=\"{7}\" " +
                       "ShowInNewForm=\"{8}\" ShowInEditForm=\"{9}\" ShowInDisplayForm=\"{10}\" " +
                       "{11} {12} {13}/>",
                       ID.ToString("B"), InternalName, DisplayName, Type, Hidden.ToString().ToUpper(),
                       Group, Description, required.ToString().ToUpper(),
                       ShowInNewForm.ToString().ToUpper(), ShowInEditForm.ToString().ToUpper(), ShowInDisplayForm.ToString().ToUpper(),
                       format, showField, additionalProperties));
        }