コード例 #1
0
        /// <summary>
        /// 自定义字段转XML实体
        /// </summary>
        /// <param name="fieldItem"></param>
        /// <returns></returns>
        public DNNGo_PowerForms_Field XmlToEntity(FieldEntity fieldItem)
        {
            DNNGo_PowerForms_Field fileEntity = new DNNGo_PowerForms_Field();

            fileEntity.Name         = fieldItem.Name;
            fileEntity.Alias        = fieldItem.Alias;
            fileEntity.DefaultValue = fieldItem.DefaultValue;
            fileEntity.Description  = fieldItem.Description;
            fileEntity.Direction    = fieldItem.Direction;
            fileEntity.FieldType    = fieldItem.FieldType;
            fileEntity.FiledList    = fieldItem.FiledList;
            fileEntity.Required     = fieldItem.Required;
            fileEntity.Rows         = fieldItem.Rows;
            fileEntity.Sort         = fieldItem.Sort;
            fileEntity.Status       = fieldItem.Status;
            fileEntity.ToolTip      = fieldItem.ToolTip;
            fileEntity.Verification = fieldItem.Verification;
            fileEntity.Width        = fieldItem.Width;

            fileEntity.WidthSuffix  = fieldItem.WidthSuffix;
            fileEntity.ListColumn   = fieldItem.ListColumn;
            fileEntity.Options      = fieldItem.Options;
            fileEntity.StartTime    = fieldItem.StartTime;
            fileEntity.EndTime      = fieldItem.EndTime;
            fileEntity.Per_AllUsers = fieldItem.Per_AllUsers;
            fileEntity.Per_Roles    = fieldItem.Per_Roles;



            if (!String.IsNullOrEmpty(fieldItem.Group))
            {
                DNNGo_PowerForms_Group GroupItem = DNNGo_PowerForms_Group.FindByName(fieldItem.Group, ModuleID);
                if (!(GroupItem != null && GroupItem.ID > 0))
                {
                    GroupItem = new DNNGo_PowerForms_Group();

                    GroupItem.Name = fieldItem.Group;

                    GroupItem.Status = fileEntity.Status;
                    GroupItem.Sort   = fileEntity.Sort;

                    GroupItem.LastIP   = WebHelper.UserHost;
                    GroupItem.LastTime = DateTime.Now;
                    GroupItem.LastUser = UserId;

                    GroupItem.ModuleId = ModuleID;
                    GroupItem.PortalId = portalInfo.PortalID;

                    GroupItem.Insert();
                }

                fileEntity.GroupID = GroupItem.ID;
            }

            fileEntity.ModuleId = ModuleID;
            fileEntity.PortalId = portalInfo.PortalID;

            return(fileEntity);
        }
コード例 #2
0
        /// <summary>
        /// 自定义字段转XML实体
        /// </summary>
        /// <param name="fieldItem"></param>
        /// <returns></returns>
        public FieldEntity EntityToXml(DNNGo_PowerForms_Field fieldItem)
        {
            FieldEntity filexml = new FieldEntity();

            filexml.Name         = fieldItem.Name;
            filexml.Alias        = fieldItem.Alias;
            filexml.DefaultValue = fieldItem.DefaultValue;
            filexml.Description  = fieldItem.Description;
            filexml.Direction    = fieldItem.Direction;
            filexml.FieldType    = fieldItem.FieldType;
            filexml.FiledList    = fieldItem.FiledList;
            filexml.Required     = fieldItem.Required;
            filexml.Rows         = fieldItem.Rows;
            filexml.Sort         = fieldItem.Sort;
            filexml.Status       = fieldItem.Status;
            filexml.ToolTip      = fieldItem.ToolTip;
            filexml.Verification = fieldItem.Verification;
            filexml.Width        = fieldItem.Width;

            filexml.WidthSuffix  = fieldItem.WidthSuffix;
            filexml.ListColumn   = fieldItem.ListColumn;
            filexml.Options      = fieldItem.Options;
            filexml.StartTime    = fieldItem.StartTime;
            filexml.EndTime      = fieldItem.EndTime;
            filexml.Per_AllUsers = fieldItem.Per_AllUsers;
            filexml.Per_Roles    = fieldItem.Per_Roles;


            if (fieldItem.GroupID > 0)
            {
                DNNGo_PowerForms_Group Group = DNNGo_PowerForms_Group.FindByID(fieldItem.GroupID);

                if (Group != null && Group.ID > 0)
                {
                    filexml.Group = Group.Name;
                }
            }

            return(filexml);
        }