Ejemplo n.º 1
0
        // list website by site ID
        public Domain.Website GetWebsiteBySlug(string slug)
        {
            Domain.Website item = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Website_SelectBySlug"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Slug", slug);
            }, map : delegate(IDataReader reader, short set)
            {
                Domain.Website p  = new Domain.Website();
                int startingIndex = 0;    //startingOrdinal

                p.ID          = reader.GetSafeInt32(startingIndex++);
                p.Name        = reader.GetSafeString(startingIndex++);
                p.Slug        = reader.GetSafeString(startingIndex++);
                p.Url         = reader.GetSafeString(startingIndex++);
                p.Theme       = reader.GetSafeString(startingIndex++);
                p.Description = reader.GetSafeString(startingIndex++);
                p.Active      = reader.GetSafeBool(startingIndex++);
                item          = p;
            }
                                    );
            return(item);
        }
Ejemplo n.º 2
0
        // list website by User ID
        public List <Domain.Website> GetWebsiteByUserID(string id)
        {
            List <Domain.Website> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Website_SelectByUserID"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@UserID", id);
            }, map : delegate(IDataReader reader, short set)
            {
                Domain.Website p  = new Domain.Website();
                int startingIndex = 0;    //startingOrdinal

                p.ID          = reader.GetSafeInt32(startingIndex++);
                p.Name        = reader.GetSafeString(startingIndex++);
                p.Slug        = reader.GetSafeString(startingIndex++);
                p.Url         = reader.GetSafeString(startingIndex++);
                p.Theme       = reader.GetSafeString(startingIndex++);
                p.Description = reader.GetSafeString(startingIndex++);
                p.Active      = reader.GetSafeBool(startingIndex++);

                if (list == null)
                {
                    list = new List <Domain.Website>();
                }

                list.Add(p);
            }
                                    );

            return(list);
        }
Ejemplo n.º 3
0
        public List <Domain.Blog> ListBlogsByWebsiteId(PaginateListRequestModel model, int websiteId)
        {
            List <Domain.Blog> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.WebsiteBlogs_ListBlogsByWebsiteId"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@CurrentPage", model.CurrentPage);
                paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage);
                paramCollection.AddWithValue("@websiteId", websiteId);
            }
                                    , map : delegate(IDataReader reader, short set)
            {
                Domain.Website w    = new Domain.Website();
                Domain.Blog p       = new Domain.Blog();
                Domain.BlogMedia bm = new Domain.BlogMedia();

                int startingIndex = 0;

                w.ID          = reader.GetSafeInt32(startingIndex++);
                p.Id          = reader.GetSafeInt32(startingIndex++);
                p.Title       = reader.GetSafeString(startingIndex++);
                p.PublishDate = reader.GetSafeDateTime(startingIndex++);
                p.Slug        = reader.GetSafeString(startingIndex++);
                p.UserId      = reader.GetSafeString(startingIndex++);
                p.PageContent = reader.GetSafeString(startingIndex++);
                p.IsFeatured  = reader.GetSafeBool(startingIndex++);

                bm.BlogId        = reader.GetSafeInt32(startingIndex++);
                bm.IsCoverPhoto  = reader.GetSafeBool(startingIndex++);
                bm.ID            = reader.GetSafeInt32(startingIndex++);
                bm.MediaType     = reader.GetSafeString(startingIndex++);
                bm.Path          = reader.GetSafeString(startingIndex++);
                bm.FileName      = reader.GetSafeString(startingIndex++);
                bm.FileType      = reader.GetSafeString(startingIndex++);
                bm.Title         = reader.GetSafeString(startingIndex++);
                bm.Description   = reader.GetSafeString(startingIndex++);
                bm.CreatedDate   = reader.GetSafeDateTime(startingIndex++);
                bm.ModifiedDate  = reader.GetSafeDateTime(startingIndex++);
                bm.ThumbnailPath = reader.GetSafeString(startingIndex++);
                p.Media          = bm;

                if (list == null)
                {
                    list = new List <Domain.Blog>();
                }

                list.Add(p);
            });
            return(list);
        }