예제 #1
0
        public CMSPage SelectAllByPath(string path)
        {
            CMSPage c = null;
            List<CMSContentItem> items = null;
            CMSContentItem item = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSPage_SelectAllByPath"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Path", path);

               }, map: delegate(IDataReader reader, short set)
               {
                   if (set == 0)
                   {
                       c = new CMSPage();
                       int startingIndex = 0; //startingOrdinal

                       c.Id = reader.GetSafeInt32(startingIndex++);
                       c.Name = reader.GetSafeString(startingIndex++);
                       c.Url = reader.GetSafeString(startingIndex++);
                       c.PubDate = reader.GetSafeDateTime(startingIndex++);
                       c.ExpireDate = reader.GetSafeDateTime(startingIndex++);
                       if (c.ExpireDate == DateTime.MinValue)
                       {
                           c.ExpireDate = null;
                       }
                       c.Template = reader.GetSafeInt32(startingIndex++);
                       c.MetaTag = reader.GetSafeString(startingIndex++);
                       c.MetaDescription = reader.GetSafeString(startingIndex++);
                       c.Active = reader.GetSafeBool(startingIndex++);
                       c.IncludeInNavigation = reader.GetSafeBool(startingIndex++);

                   }

                   if (set == 1)
                   {
                       item = new CMSContentItem();
                       int startingIndex = 0;

                       item.PageId = reader.GetSafeInt32(startingIndex++);
                       item.TemplateId = reader.GetSafeInt32(startingIndex++);
                       item.Type = reader.GetSafeInt32(startingIndex++);
                       item.KeyName = reader.GetSafeString(startingIndex++);
                       item.ContentId = reader.GetSafeInt32(startingIndex++);
                       item.TemplateKeyId = reader.GetSafeInt32(startingIndex++);
                       item.Value = reader.GetSafeString(startingIndex++);

                       if (items == null)
                       {
                           items = new List<CMSContentItem>();

               }

                       items.Add(item);
                   }
                   if (items != null)
                   {
                       c.Content = new List<CMSContentItem>();
                       c.Content = items;
                   }

               }
               );

            return c;
        }
예제 #2
0
        public CMSPage SelectById(int id)
        {
            CMSPage c = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSPage_SelectById"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Id", id);

               }, map: delegate(IDataReader reader, short set)
               {
                   c = new CMSPage();
                   int startingIndex = 0; //startingOrdinal

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Name = reader.GetSafeString(startingIndex++);
                   c.Url = reader.GetSafeString(startingIndex++);
                   c.PubDate = reader.GetSafeDateTime(startingIndex++);
                   c.ExpireDate = reader.GetSafeDateTime(startingIndex++);
                   c.DateModified = reader.GetSafeDateTime(startingIndex++);
                   c.Template = reader.GetSafeInt32(startingIndex++);
                   c.MetaTag = reader.GetSafeString(startingIndex++);
                   c.MetaDescription = reader.GetSafeString(startingIndex++);
                   c.UserId = reader.GetSafeString(startingIndex++);
                   c.Active = reader.GetSafeBool(startingIndex++);
                   c.IncludeInNavigation = reader.GetSafeBool(startingIndex++);
               }
               );

            return c;
        }
예제 #3
0
        public List<CMSPage> SelectAll(CMSPageSortRequest model)
        {
            List<CMSPage> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSPage_Select_v2"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection) {
                   paramCollection.AddWithValue("@SortKey", model.SortKey);
                   paramCollection.AddWithValue("@Order", model.SortOrder);
               }

               , map: delegate(IDataReader reader, short set)
               {
                   CMSPage c = new CMSPage();

                   int startingIndex = 0;

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Name = reader.GetSafeString(startingIndex++);
                   c.Url = reader.GetSafeString(startingIndex++);
                   c.PubDate = reader.GetSafeDateTime(startingIndex++);

                   if (c.PubDate == DateTime.MinValue)
                   {
                       c.PubDate = null;
                   }

                   c.ExpireDate = reader.GetSafeDateTime(startingIndex++);

                   if (c.ExpireDate == DateTime.MinValue)
                   {
                       c.ExpireDate = null;
                   }

                   c.DateModified = reader.GetSafeDateTime(startingIndex++);
                   c.Template = reader.GetSafeInt32(startingIndex++);
                   c.MetaTag = reader.GetSafeString(startingIndex++);
                   c.MetaDescription = reader.GetSafeString(startingIndex++);
                   c.UserId = reader.GetSafeString(startingIndex++);
                   c.Active = reader.GetSafeBool(startingIndex++);
                   c.IncludeInNavigation = reader.GetSafeBool(startingIndex++);

                   if (list == null)
                   {
                       list = new List<CMSPage>();
                   }
                   list.Add(c);
               }
               );

            return list;
        }