Пример #1
0
        public CMSTemplate SelectTemplateByID(int id)
        {
            CMSTemplate c = null;

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

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

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Name = reader.GetSafeString(startingIndex++);
                   c.Path = reader.GetSafeString(startingIndex++);

               }
               );

            return c;
        }
Пример #2
0
        public List<CMSTemplate> SelectAllTemplates()
        {
            List<CMSTemplate> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSTemplates_SelectAll"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection) { }

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

                   int startingIndex = 0;

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Name = reader.GetSafeString(startingIndex++);
                   c.Path = reader.GetSafeString(startingIndex++);

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

            return list;
        }