public Workflow GetWorkflow(Guid id)
        {
            string         sql = "SELECT * from UFworkflows where id = @id";
            IRecordsReader rr  = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@id", id));

            Workflow wf = new Workflow();

            if (rr.Read())
            {
                wf          = Workflow.CreateFromDataReader(rr);
                wf.Settings = settings.GetSettings(wf.Id);
            }
            rr.Dispose();
            return(wf);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Macro"/> class.
 /// </summary>
 /// <param name="alias">The alias.</param>
 public Macro(string alias)
 {
     using (IRecordsReader dr = SqlHelper.ExecuteReader("select id from cmsMacro where macroAlias = @alias", SqlHelper.CreateParameter("@alias", alias)))
     {
         if (dr.Read())
         {
             _id = dr.GetInt("id");
             setup();
         }
         else
         {
             throw new IndexOutOfRangeException(string.Format("Alias '{0}' does not match an existing macro", alias));
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Returns all descendant nodes from this node.
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// This doesn't return a strongly typed IEnumerable object so that we can override in in super clases
        /// and since this class isn't a generic (thought it should be) this is not strongly typed.
        /// </remarks>
        public virtual IEnumerable GetDescendants()
        {
            var descendants = new List <CMSNode>();

            using (IRecordsReader dr = SqlHelper.ExecuteReader(string.Format(m_SQLDescendants, Id)))
            {
                while (dr.Read())
                {
                    var node = new CMSNode(dr.GetInt("id"), true);
                    node.PopulateCMSNodeFromReader(dr);
                    descendants.Add(node);
                }
            }
            return(descendants);
        }
Exemple #4
0
 private void initDomain(int id)
 {
     using (IRecordsReader dr = SqlHelper.ExecuteReader(
                "select domainDefaultLanguage, domainRootStructureID, domainName from umbracoDomains where id = @ID",
                SqlHelper.CreateParameter("@ID", id)))
     {
         if (dr.Read())
         {
             _id       = id;
             _language = new Language(dr.GetInt("domainDefaultLanguage"));
             _name     = dr.GetString("domainName");
             _root     = dr.GetInt("domainRootStructureID");
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Retrieve a list of the node id's of all CMSNodes given the objecttype
        /// </summary>
        /// <param name="objectType">The objecttype identifier</param>
        /// <returns>
        /// A list of all node ids which each are associated to a CMSNode
        /// </returns>
        public static int[] getAllUniqueNodeIdsFromObjectType(Guid objectType)
        {
            IRecordsReader dr = SqlHelper.ExecuteReader("Select id from umbracoNode where nodeObjectType = @type",
                                                        SqlHelper.CreateParameter("@type", objectType));

            System.Collections.ArrayList tmp = new System.Collections.ArrayList();

            while (dr.Read())
            {
                tmp.Add(dr.GetInt("id"));
            }
            dr.Close();

            return((int[])tmp.ToArray(typeof(int)));
        }
Exemple #6
0
        private void initProperty()
        {
            IRecordsReader dr = SqlHelper.ExecuteReader("Select stylesheetPropertyAlias,stylesheetPropertyValue from cmsStylesheetProperty where nodeId = " + this.Id);

            if (dr.Read())
            {
                _alias = dr.GetString("stylesheetPropertyAlias");
                _value = dr.GetString("stylesheetPropertyValue");
            }
            else
            {
                throw new ArgumentException("NO DATA EXSISTS");
            }
            dr.Close();
        }
Exemple #7
0
 /// <summary>
 /// Sets up the internal data of the CMSNode, used by the various constructors
 /// </summary>
 protected virtual void setupNode()
 {
     using (IRecordsReader dr = SqlHelper.ExecuteReader(SqlSingle,
                                                        SqlHelper.CreateParameter("@id", this.Id)))
     {
         if (dr.Read())
         {
             PopulateCMSNodeFromReader(dr);
         }
         else
         {
             throw new ArgumentException(string.Format("No node exists with id '{0}'", Id));
         }
     }
 }
Exemple #8
0
 public RelationType(int id)
 {
     using (IRecordsReader dr = SqlHelper.ExecuteReader(
                "SELECT id, [dual], name, alias FROM umbracoRelationType WHERE id = @id", SqlHelper.CreateParameter("@id", id)))
     {
         if (dr.Read())
         {
             PopulateFromReader(dr);
         }
         else
         {
             throw new ArgumentException("Not RelationType found for id " + id.ToString());
         }
     }
 }
Exemple #9
0
        public static Record CreateFromDataReader(IRecordsReader reader)
        {
            Record record = Create();

            record.Id            = reader.GetGuid("Id");
            record.Form          = reader.GetGuid("Form");
            record.Created       = reader.GetDateTime("Created");
            record.Updated       = reader.GetDateTime("Updated");
            record.State         = reader.GetInt("State");
            record.currentPage   = reader.GetGuid("currentPage");
            record.umbracoPageId = reader.GetInt("umbracoPageId");
            record.IP            = reader.GetString("IP");
            record.MemberKey     = reader.GetString("MemberKey");
            return(record);
        }
Exemple #10
0
        public static List <Relation> GetRelationsAsList(int NodeId)
        {
            List <Relation> _rels = new List <Relation>();

            System.Collections.ArrayList tmp = new System.Collections.ArrayList();
            using (IRecordsReader dr = SqlHelper.ExecuteReader("select umbracoRelation.id from umbracoRelation inner join umbracoRelationType on umbracoRelationType.id = umbracoRelation.relType where umbracoRelation.parentId = @id or (umbracoRelation.childId = @id and umbracoRelationType.[dual] = 1)", SqlHelper.CreateParameter("@id", NodeId)))
            {
                while (dr.Read())
                {
                    _rels.Add(new Relation(dr.GetInt("id")));
                }
            }

            return(_rels);
        }
Exemple #11
0
        public static IEnumerable <CMSNode> GetNodesWithTags(string tags)
        {
            var nodes = new List <CMSNode>();

            string sql = @"SELECT DISTINCT cmsTagRelationShip.nodeid from cmsTagRelationShip
                            INNER JOIN cmsTags ON cmsTagRelationShip.tagid = cmsTags.id WHERE (cmsTags.tag IN (" + GetSqlStringArray(tags) + "))";

            using (IRecordsReader rr = SqlHelper.ExecuteReader(sql))
            {
                while (rr.Read())
                {
                    nodes.Add(new CMSNode(rr.GetInt("nodeid")));
                }
            }
            return(nodes);
        }
        internal DocType BuildDocumentType(IRecordsReader docTypes)
        {
            DocType newDocType = new DocType
            {
                Id          = docTypes.GetId(),
                Alias       = docTypes.GetAlias(),
                Description = docTypes.GetDescription(),
                Name        = docTypes.GetName(),
                ParentId    = docTypes.GetParentId(),
            };

            newDocType.Properties   = GetProperties(newDocType.Id);
            newDocType.Associations = BuildAssociations(newDocType.Id);

            return(newDocType);
        }
Exemple #13
0
        public static List <Company> GetAll()
        {
            string         sql = "SELECT * from companies order by Name ASC";
            IRecordsReader rr  = umbraco.BusinessLogic.Application.SqlHelper.ExecuteReader(sql);

            List <Company> list = new List <Company>();

            while (rr.Read())
            {
                list.Add(FromReader(rr));
            }

            rr.Dispose();

            return(list);
        }
        internal DocType BuildDocumentType(IRecordsReader docTypes)
        {
            DocType newDocType = new DocType
            {
                Id = docTypes.GetId(),
                Alias = docTypes.GetAlias(),
                Description = docTypes.GetDescription(),
                Name = docTypes.GetName(),
                ParentId = docTypes.GetParentId(),
            };

            newDocType.Properties = GetProperties(newDocType.Id);
            newDocType.Associations = BuildAssociations(newDocType.Id);

            return newDocType;
        }
Exemple #15
0
        public static List <LogItem> ConvertIRecordsReader(IRecordsReader reader)
        {
            var items = new List <LogItem>();

            while (reader.Read())
            {
                items.Add(new LogItem(
                              reader.GetInt("userId"),
                              reader.GetInt("nodeId"),
                              reader.GetDateTime("DateStamp"),
                              ConvertLogHeader(reader.GetString("logHeader")),
                              reader.GetString("logComment")));
            }

            return(items);
        }
Exemple #16
0
        private void PopulateMacroInfo(IRecordsReader dr)
        {
            _useInEditor   = dr.GetBoolean("macroUseInEditor");
            _refreshRate   = dr.GetInt("macroRefreshRate");
            _alias         = dr.GetString("macroAlias");
            _id            = dr.GetInt("id");
            _name          = dr.GetString("macroName");
            _assembly      = dr.GetString("macroScriptAssembly");
            _type          = dr.GetString("macroScriptType");
            _xslt          = dr.GetString("macroXSLT");
            _scriptingFile = dr.GetString("macroPython");

            _cacheByPage       = dr.GetBoolean("macroCacheByPage");
            _cachePersonalized = dr.GetBoolean("macroCachePersonalized");
            _renderContent     = !dr.GetBoolean("macroDontRender");
        }
        protected override void setupNode()
        {
            base.setupNode();

            using (IRecordsReader dr = SqlHelper.ExecuteReader("select dbType, controlId from cmsDataType where nodeId = '" + this.Id.ToString() + "'"))
            {
                if (dr.Read())
                {
                    _controlId = dr.GetGuid("controlId");
                }
                else
                {
                    throw new ArgumentException("No dataType with id = " + this.Id.ToString() + " found");
                }
            }
        }
Exemple #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Macro"/> class.
        /// </summary>
        /// <param name="alias">The alias.</param>
        public Macro(string alias)
        {
            using (IRecordsReader dr = SqlHelper.ExecuteReader("select macroUseInEditor, macroRefreshRate, macroAlias, macroName, macroScriptType, macroScriptAssembly, macroXSLT, macroPython, macroDontRender, macroCacheByPage, macroCachePersonalized, id from cmsMacro where macroAlias = @alias", SqlHelper.CreateParameter("@alias", alias)))
            {
                if (dr.Read())
                {
                    PopulateMacroInfo(dr);

                    this.LoadProperties();
                }
                else
                {
                    throw new IndexOutOfRangeException(string.Format("Alias '{0}' does not match an existing macro", alias));
                }
            }
        }
Exemple #19
0
        /// <summary>
        /// Return all relation types
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <RelationType> GetAll()
        {
            var relationTypes = new List <RelationType>();

            using (IRecordsReader dr = SqlHelper.ExecuteReader("select id, dual, name, alias from umbracoRelationType"))
            {
                while (dr.Read())
                {
                    var rt = new RelationType();
                    rt.PopulateFromReader(dr);
                    relationTypes.Add(rt);
                }
            }

            return(relationTypes);
        }
Exemple #20
0
        public static bool HasInvalidEntries(out List <int> invalidRowIds)
        {
            invalidRowIds = new List <int>();
            bool   hasInvalidEntries = false;
            string query             = "SELECT Id FROM icUrlTracker WHERE OldUrl IS NULL AND OldRegex IS NULL";

            using (IRecordsReader reader = _sqlHelper.ExecuteReader(query))
            {
                while (reader.Read())
                {
                    hasInvalidEntries = true;
                    invalidRowIds.Add(reader.GetInt("Id"));
                }
            }
            return(hasInvalidEntries);
        }
        public Dictionary <string, string> GetSettings(Guid id)
        {
            string         sql            = "SELECT * from UFSettings where id = @id";
            IRecordsReader settingsReader = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@id", id));

            Dictionary <string, string> settings = new Dictionary <string, string>();

            while (settingsReader.Read())
            {
                settings.Add(settingsReader.GetString("key"), settingsReader.GetString("value"));
            }

            settingsReader.Dispose();

            return(settings);
        }
Exemple #22
0
 /// <summary>
 /// Retrieve a MediaType by it's alias
 /// </summary>
 /// <param name="Alias">The alias of the MediaType</param>
 /// <returns>The MediaType with the alias</returns>
 public static new MediaType GetByAlias(string Alias)
 {
     using (IRecordsReader dr = SqlHelper.ExecuteReader(@"SELECT nodeid from cmsContentType INNER JOIN umbracoNode on cmsContentType.nodeId = umbracoNode.id WHERE nodeObjectType=@nodeObjectType AND alias=@alias",
                                                        SqlHelper.CreateParameter("@nodeObjectType", MediaType._objectType),
                                                        SqlHelper.CreateParameter("@alias", Alias)))
     {
         if (dr.Read())
         {
             return(new MediaType(dr.GetInt("nodeid")));
         }
         else
         {
             return(null);
         }
     }
 }
Exemple #23
0
        public List <Field> GetAllFields()
        {
            List <Field> l = new List <Field>();

            string sql = @"SELECT UFfields.*, UFpages.form AS form, UFfieldsets.sortorder as FieldsetIndex, UFpages.sortorder as PageIndex 
                            From UFfields 
                            INNER JOIN UFfieldsets ON UFfieldsets.id = fieldset
                            INNER JOIN UFpages ON UFpages.id = UFfieldsets.page
                            ORDER by UFFields.Caption ASC";

            IRecordsReader rr = sqlHelper.ExecuteReader(sql);

            while (rr.Read())
            {
                Field f = Field.CreateFromDataReader(rr);

                if (!rr.IsNull("prevalueProvider") && rr.GetGuid("prevalueProvider") != Guid.Empty)
                {
                    f.PreValueSource = prevalueSourceStorage.GetPrevalueSource(rr.GetGuid("prevalueProvider"));

                    if (f.PreValueSource != null &&
                        f.PreValueSource.Id != Guid.Empty)
                    {
                        f.PreValueSourceId = f.PreValueSource.Id;
                    }
                }

                f.Settings = settings.GetSettingsAsList(f.Id);

                //if (f.FieldType.HasSettings())
                //    f.FieldType.LoadSettings(f.Settings);

                f.Condition = conditionStorage.GetFieldCondition(f);
                if (f.Condition == null)
                {
                    f.Condition            = new FieldCondition();
                    f.Condition.Enabled    = false;
                    f.Condition.ActionType = FieldConditionActionType.Show;
                    f.Condition.LogicType  = FieldConditionLogicType.All;
                }
                l.Add(f);
            }

            rr.Dispose();

            return(l);
        }
        public static Form CreateFromDataReader(IRecordsReader reader)
        {
            Form form = Create();

            form.Id               = reader.GetGuid("id");
            form.Pages            = new List <Page>();
            form.Name             = reader.GetString("name");
            form.Created          = reader.GetDateTime("created");
            form.MessageOnSubmit  = reader.GetString("MessageOnSubmit");
            form.GoToPageOnSubmit = reader.GetInt("GotoPageOnSubmit");

            form.ShowValidationSummary = reader.GetBoolean("ShowValidationSummary");

            form.HideFieldValidation  = reader.GetBoolean("HideFieldValidation");
            form.RequiredErrorMessage = reader.GetString("RequiredErrorMessage");
            form.InvalidErrorMessage  = reader.GetString("InvalidErrorMessage");
            form.ManualApproval       = reader.GetBoolean("ManualApproval");
            form.Archived             = reader.GetBoolean("Archived");
            form.StoreRecordsLocally  = reader.GetBoolean("StoreRecordsLocally");

            if (!reader.IsNull("DataSource"))
            {
                form.DataSource = reader.GetGuid("DataSource");
            }

            if (!reader.IsNull("FieldIndicationType"))
            {
                form.FieldIndicationType = (FormFieldIndication)System.Enum.Parse(typeof(FormFieldIndication), reader.GetInt("FieldIndicationType").ToString());
                form.Indicator           = reader.GetString("Indicator");
            }

            if (!reader.IsNull("DisableDefaultStylesheet"))
            {
                form.DisableDefaultStylesheet = reader.GetBoolean("DisableDefaultStylesheet");
            }

            //check for xpath setting
            //Umbraco.Forms.Migration.Data.Storage.SettingsStorage ss = new Umbraco.Forms.Migration.Data.Storage.SettingsStorage();

            //string set = ss.GetSetting(form.Id, "XPathOnSubmit");
            //if (!string.IsNullOrEmpty(set))
            //    form.XPathOnSubmit = set;

            //ss.Dispose();

            return(form);
        }
Exemple #25
0
        /// <summary>
        /// from a collection of document or media properties, create and add any required ghost images to the areaDiv
        /// </summary>
        /// <param name="properties"></param>
        private void CreateGhostImages(IEnumerable <Property> properties)
        {
            foreach (Property property in properties)
            {
                ImagePoint imagePoint = new ImagePoint();
                ((uQuery.IGetProperty)imagePoint).LoadPropertyValue(property.Value.ToString());

                if (imagePoint.HasCoordinate)
                {
                    Image ghostImage = new Image();

                    ghostImage.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "uComponents.DataTypes.ImagePoint.ImagePointGhost.png");
                    ghostImage.CssClass = "ghost";

                    // using sql here, else would have to query document and media seperately
                    using (IRecordsReader iRecordsReader = uQuery.SqlHelper.ExecuteReader(@"
                                                                                            SELECT  A.contentNodeId AS 'Id', 
		                                                                                            B.text AS 'Name',
		                                                                                            C.Name AS 'PropertyName'

			                                                                                FROM    cmsPropertyData A
			                                                                                        LEFT OUTER JOIN umbracoNode B ON A.ContentNodeId = B.Id
			                                                                                        LEFT OUTER JOIN cmsPropertyType C ON A.propertytypeid = C.id

			                                                                                WHERE   A.id = @propertyDataId"            ,
                                                                                          uQuery.SqlHelper.CreateParameter("propertyDataId", property.Id)))
                    {
                        iRecordsReader.Read(); // there should only be a single row returned

                        // if the properties are on the same item, then label with property name, otherwise default to labeling with the node / media or member name
                        if (iRecordsReader.Get <int>("Id") == this.CurrentContentId)
                        {
                            ghostImage.ToolTip = iRecordsReader.Get <string>("PropertyName");
                        }
                        else
                        {
                            ghostImage.ToolTip = iRecordsReader.Get <string>("Name");
                        }
                    }

                    ghostImage.Style.Add(HtmlTextWriterStyle.Left, (imagePoint.X - 7).ToString() + "px");
                    ghostImage.Style.Add(HtmlTextWriterStyle.Top, (imagePoint.Y - 7).ToString() + "px");

                    areaDiv.Controls.Add(ghostImage);
                }
            }
        }
Exemple #26
0
        public List <Workflow> GetAllWorkFlows(Form form)
        {
            string         sql = "SELECT * from UFworkflows where form = @form ORDER by Name ASC";
            IRecordsReader rr  = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@form", form.Id));

            List <Workflow> l = new List <Workflow>();

            while (rr.Read())
            {
                Workflow wf = Workflow.CreateFromDataReader(rr);
                wf.Settings = settings.GetSettings(wf.Id);
                l.Add(wf);
            }
            rr.Dispose();

            return(l);
        }
Exemple #27
0
        /// <summary>
        /// Returns all task types stored in the database
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <TaskType> GetAll()
        {
            var sql   = "SELECT id, alias FROM cmsTaskType";
            var types = new List <TaskType>();

            using (IRecordsReader dr = SqlHelper.ExecuteReader(sql))
            {
                while (dr.Read())
                {
                    types.Add(new TaskType()
                    {
                        _alias = dr.GetString("alias"), _id = Convert.ToInt32(dr.Get <object>("id"))
                    });
                }
            }
            return(types);
        }
Exemple #28
0
 private void setup()
 {
     using (IRecordsReader dr =
                SqlHelper.ExecuteReader("select alias from cmsTaskType where id = @id",
                                        SqlHelper.CreateParameter("@id", Id)))
     {
         if (dr.Read())
         {
             _id   = Id;
             Alias = dr.GetString("alias");
         }
         else
         {
             throw new ArgumentException("No Task type found for the id specified");
         }
     }
 }
        public List <PreValue> GetAllPreValues(Field field)
        {
            List <PreValue> l   = new List <PreValue>();
            string          sql = "SELECT * From UFprevalues where field = @field";

            IRecordsReader rr = sqlHelper.ExecuteReader(sql,
                                                        sqlHelper.CreateParameter("@field", field.Id));

            while (rr.Read())
            {
                PreValue pv = PreValue.CreateFromDataReader(rr);
                l.Add(pv);
            }

            rr.Dispose();
            return(l);
        }
        public FieldConditionRule GetFieldConditionRule(Guid id)
        {
            string sql = "SELECT * from UFfieldconditionrules where id = @id";

            IRecordsReader rr = sqlHelper.ExecuteReader(sql, sqlHelper.CreateParameter("@id", id));

            FieldConditionRule fcr = new FieldConditionRule();

            if (rr.Read())
            {
                fcr = FieldConditionRule.CreateFromDataReader(rr);
            }

            rr.Dispose();

            return(fcr);
        }
Exemple #31
0
        public static List <Subscribtion> Subscribers(int topicId)
        {
            List <Subscribtion> l  = new List <Subscribtion>();
            IRecordsReader      rr = Data.SqlHelper.ExecuteReader("SELECT * from forumTopicSubscribers where topicid = @topicId",
                                                                  Data.SqlHelper.CreateParameter("@topicId", topicId));

            while (rr.Read())
            {
                Subscribtion s = new Subscribtion();
                s.MemberId = rr.GetInt("memberId");
                s.TopicId  = rr.GetInt("topicId");
                s.Date     = rr.GetDateTime("date");
                l.Add(s);
            }

            return(l);
        }
Exemple #32
0
        protected void PopulateContentTypeNodeFromReader(IRecordsReader dr)
        {
            _alias = dr.GetString("Alias");
            _iconurl = dr.GetString("icon");
            if (!dr.IsNull("masterContentType"))
                m_masterContentType = dr.GetInt("masterContentType");

            if (!dr.IsNull("thumbnail"))
                _thumbnail = dr.GetString("thumbnail");
            if (!dr.IsNull("description"))
                _description = dr.GetString("description");
        }
 protected void PopulateMediaFromReader(IRecordsReader dr);
Exemple #34
0
        protected void PopulateMemberFromReader(IRecordsReader dr)
        {

            SetupNodeForTree(dr.GetGuid("uniqueId"),
                _objectType, dr.GetShort("level"),
                dr.GetInt("parentId"),
                dr.GetInt("nodeUser"),
                dr.GetString("path"),
                dr.GetString("text"),
                dr.GetDateTime("createDate"), false);

            if (!dr.IsNull("Email"))
                m_Email = dr.GetString("Email");
            m_LoginName = dr.GetString("LoginName");
            m_Password = dr.GetString("Password");

        }
        protected void PopulateContentTypeNodeFromReader(IRecordsReader dr)
        {
            _alias = dr.GetString("Alias");
            _iconurl = dr.GetString("icon");
            _isContainerContentType = dr.GetBoolean("isContainer");
            _allowAtRoot = dr.GetBoolean("allowAtRoot");

            if (!dr.IsNull("thumbnail"))
                _thumbnail = dr.GetString("thumbnail");
            if (!dr.IsNull("description"))
                _description = dr.GetString("description");
        }
Exemple #36
0
        protected void PopulateDocumentFromReader(IRecordsReader dr)
        {
            var hc = dr.GetInt("children") > 0;

            SetupDocumentForTree(dr.GetGuid("uniqueId")
                , dr.GetShort("level")
                , dr.GetInt("parentId")
                , dr.GetInt("nodeUser")
                , dr.GetInt("documentUser")
                , !dr.GetBoolean("trashed") && (dr.GetInt("isPublished") == 1) //set published... double check trashed property
                , dr.GetString("path")
                , dr.GetString("text")
                , dr.GetDateTime("createDate")
                , dr.GetDateTime("updateDate")
                , dr.GetDateTime("versionDate")
                , dr.GetString("icon")
                , hc
                , dr.GetString("alias")
                , dr.GetString("thumbnail")
                , dr.GetString("description")
                     , null
                , dr.GetInt("contentTypeId")
                     , dr.GetInt("templateId")
                     , dr.GetBoolean("isContainer"));

            if (!dr.IsNull("releaseDate"))
                _release = dr.GetDateTime("releaseDate");
            if (!dr.IsNull("expireDate"))
                _expire = dr.GetDateTime("expireDate");
        }
        internal DocTypeProperty BuildProperty(IRecordsReader reader)
        {
            var p = new DocTypeProperty
            {
                Alias = reader.GetAlias(),
                Description = reader.GetDescription(),
                Id = reader.GetId(),
                Mandatory = reader.GetBoolean("Mandatory"),
                Name = reader.GetName(),
                RegularExpression = reader.GetString("RegularExpression"),
                ControlId = reader.GetGuid("ControlId")
            };

            switch (reader.GetDbType())
            {
                case "Date":
                    p.DatabaseType = typeof(DateTime);
                    break;
                case "Integer":
                    p.DatabaseType = typeof(int);
                    break;
                case "Ntext":
                case "Nvarchar":
                    p.DatabaseType = typeof(string);
                    break;
                default:
                    p.DatabaseType = typeof(object);
                    break;
            }

            return p;
        }
Exemple #38
0
        protected void PopulateDocumentFromReader(IRecordsReader dr)
        {
            bool _hc = false;

            if (dr.GetInt("children") > 0)
                _hc = true;

            int? masterContentType = null;

            if (!dr.IsNull("masterContentType"))
                masterContentType = dr.GetInt("masterContentType");

            SetupDocumentForTree(dr.GetGuid("uniqueId")
                , dr.GetShort("level")
                , dr.GetInt("parentId")
                , dr.GetInt("nodeUser")
                , dr.GetInt("documentUser")
                , (dr.GetInt("isPublished") == 1)
                , dr.GetString("path")
                , dr.GetString("text")
                , dr.GetDateTime("createDate")
                , dr.GetDateTime("updateDate")
                , dr.GetDateTime("versionDate")
                , dr.GetString("icon")
                , _hc
                , dr.GetString("alias")
                , dr.GetString("thumbnail")
                , dr.GetString("description")
                , masterContentType
                , dr.GetInt("contentTypeId")
                , dr.GetInt("templateId"));
        }
Exemple #39
0
        public static bool TryGetColumnBool(IRecordsReader reader, string columnName, out bool value)
        {
            if (reader.ContainsField(columnName) && !reader.IsNull(columnName))
            {
                value = reader.GetBoolean(columnName);
                return true;
            }

            value = false;
            return false;
        }
Exemple #40
0
        public static bool TryGetColumnInt32(IRecordsReader reader, string columnName, out int value)
        {
            if (reader.ContainsField(columnName) && !reader.IsNull(columnName))
            {
                value = reader.GetInt(columnName);
                return true;
            }

            value = -1;
            return false;
        }
Exemple #41
0
        public static bool TryGetColumnString(IRecordsReader reader, string columnName, out string value)
        {
            if (reader.ContainsField(columnName) && !reader.IsNull(columnName))
            {
                value = reader.GetString(columnName);
                return true;
            }

            value = string.Empty;
            return false;
        }
 private void PopulateFromReader(IRecordsReader dr)
 {
     this._id = dr.GetInt("id");
     this._dual = dr.GetBoolean("dual");
     //this._parentObjectType = dr.GetGuid("parentObjectType");
     //this._childObjectType = dr.GetGuid("childObjectType");
     this._name = dr.GetString("name");
     this._alias = dr.GetString("alias");
 }
Exemple #43
0
        public static List<LogItem> ConvertIRecordsReader(IRecordsReader reader)
        {
            var items = new List<LogItem>();
            while (reader.Read())
            {
                items.Add(new LogItem(
                    reader.GetInt("userId"),
                    reader.GetInt("nodeId"),
                    reader.GetDateTime("DateStamp"),
                    ConvertLogHeader(reader.GetString("logHeader")),
                    reader.GetString("logComment")));
            }

            return items;

        }
Exemple #44
0
 private void PopulateTaskFromReader(IRecordsReader dr)
 {
     _id = dr.GetInt("id");
     Type = new TaskType((int)dr.GetByte("taskTypeId"));
     Node = new CMSNode(dr.GetInt("nodeId"));
     ParentUser = User.GetUser(dr.GetInt("parentUserId"));
     User = User.GetUser(dr.GetInt("userId"));
     Date = dr.GetDateTime("DateTime");
     Comment = dr.GetString("comment");
     Closed = dr.GetBoolean("closed");
 } 
Exemple #45
0
        private void PopulateMacroInfo(IRecordsReader dr)
        {
            _useInEditor = dr.GetBoolean("macroUseInEditor");
            _refreshRate = dr.GetInt("macroRefreshRate");
            _alias = dr.GetString("macroAlias");
            _id = dr.GetInt("id");
            _name = dr.GetString("macroName");
            _assembly = dr.GetString("macroScriptAssembly");
            _type = dr.GetString("macroScriptType");
            _xslt = dr.GetString("macroXSLT");
            _scriptingFile = dr.GetString("macroPython");

            _cacheByPage = dr.GetBoolean("macroCacheByPage");
            _cachePersonalized = dr.GetBoolean("macroCachePersonalized");
            _renderContent = !dr.GetBoolean("macroDontRender");
        }
        private static XPathNodeIterator CommentsToXml(IRecordsReader rr)
        {
            XmlDocument xd = new XmlDocument();

            XmlNode x = umbraco.xmlHelper.addTextNode(xd, "comments", "");

            while (rr.Read())
            {
                XmlNode c = xd.CreateElement("comment");

                c.Attributes.Append(umbraco.xmlHelper.addAttribute(xd, "id", rr.GetInt("id").ToString()));
                c.Attributes.Append(umbraco.xmlHelper.addAttribute(xd, "nodeid", rr.GetInt("nodeid").ToString()));
                c.Attributes.Append(umbraco.xmlHelper.addAttribute(xd, "created", rr.GetDateTime("created").ToString()));

                c.AppendChild(umbraco.xmlHelper.addCDataNode(xd, "name", rr.GetString("name")));
                c.AppendChild(umbraco.xmlHelper.addCDataNode(xd, "email", rr.GetString("email")));
                c.AppendChild(umbraco.xmlHelper.addCDataNode(xd, "website", rr.GetString("website")));
                c.AppendChild(umbraco.xmlHelper.addCDataNode(xd, "message", rr.GetString("comment")));

                x.AppendChild(c);
            }

            xd.AppendChild(x);
            rr.Close();
            return xd.CreateNavigator().Select(".");
        }
Exemple #47
0
 protected void PopulateFromReader(IRecordsReader dr)
 {
     _id = Convert.ToInt32(dr.GetShort("id"));
     _cultureAlias = dr.GetString("languageISOCode");
     
     updateNames();
 } 
Exemple #48
0
 protected void PopulateDocumentTypeNodeFromReader(IRecordsReader dr)
 {
     if (!dr.IsNull("templateNodeId"))
     {
         _templateIds.Add(dr.GetInt("templateNodeId"));
         if (!dr.IsNull("IsDefault"))
         {
             if (dr.GetBoolean("IsDefault"))
             {
                 _defaultTemplate = dr.GetInt("templateNodeId");
             }
         }
     }
 }
Exemple #49
0
        private static Company FromReader(Company c, IRecordsReader rr)
        {
            c.Id = rr.GetInt("id");
            c.Category = rr.GetString("category");
            c.Name = rr.GetString("name");
            c.Symbol = rr.GetString("symbol");

            return c;
        }
Exemple #50
0
 private static Company FromReader(IRecordsReader rr)
 {
     Company c = new Company();
     return FromReader(c, rr);
 }
Exemple #51
0
        protected void PopulateMediaFromReader(IRecordsReader dr)
        {
            var hc = dr.GetInt("children") > 0;

            SetupMediaForTree(dr.GetGuid("uniqueId")
                , dr.GetShort("level")
                , dr.GetInt("parentId")
                , dr.GetInt("nodeUser")
                , dr.GetString("path")
                , dr.GetString("text")
                , dr.GetDateTime("createDate")
                , dr.GetString("icon")
                , hc
                , dr.GetString("alias")
                , dr.GetString("thumbnail")
                , dr.GetString("description")
                , null
                , dr.GetInt("contentTypeId")
                , dr.GetBoolean("isContainer"));
        }