Esempio n. 1
0
        public void ChooseThreeTrueAndOtherWise()
        {
            var tag      = new Choose();
            var whenTrue = new When();

            whenTrue.Body   = new MockAttribute(new Constant("True1"));
            whenTrue.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
            whenTrue.Source = new MockAttribute(new Constant("xml"));
            tag.AddNestedTag(whenTrue);
            var whenTrue2 = new When();

            whenTrue2.Body   = new MockAttribute(new Constant("True2"));
            whenTrue2.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
            whenTrue2.Source = new MockAttribute(new Constant("xml"));
            tag.AddNestedTag(whenTrue2);
            var whenTrue3 = new When();

            whenTrue3.Body   = new MockAttribute(new Constant("True3"));
            whenTrue3.Select = new MockAttribute(new Constant("/results/value[position()=1]"));
            whenTrue3.Source = new MockAttribute(new Constant("xml"));
            tag.AddNestedTag(whenTrue2);
            var otherwise = new Otherwise();

            otherwise.Body = new MockAttribute(new Constant("Ötherwise"));
            tag.AddNestedTag(otherwise);
            Assert.That(tag.Evaluate(_model), Is.EqualTo("True1"));
        }
Esempio n. 2
0
        public void ChooseOnlyOtherwise()
        {
            var tag       = new Choose();
            var otherwise = new Otherwise();

            otherwise.Body = new MockAttribute(new Property("Body1"));
            tag.AddNestedTag(otherwise);
            Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body1));
        }
Esempio n. 3
0
        public void ChooseOnlyOtherwise()
        {
            var tag       = new Choose();
            var otherwise = new Otherwise();

            otherwise.Body = new MockAttribute(new Constant("Body1"));
            tag.AddNestedTag(otherwise);
            Assert.That(tag.Evaluate(_model), Is.EqualTo("Body1"));
        }
Esempio n. 4
0
        internal override void EmitStmt(ILGenerator ilg)
        {
            var le = ilg.DefineLabel();

            foreach (var c in Cases)
            {
                c.Emit(ilg, le);
            }
            Otherwise.Emit(ilg);
            ilg.MarkLabel(le);
        }
Esempio n. 5
0
        /// <summary>
        /// Loads a record from the HomepageSlide table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg HomepageSlide.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = HomepageSlide.LoadID(55);</example>
        /// <param name="id">Primary key of HomepageSlide</param>
        /// <returns>An instance of HomepageSlide containing the data in the record</returns>
        public static HomepageSlide LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			HomepageSlide record = null;
//			record = HomepageSlide.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where HomepageSlideID=", Sql.Sqlize(id));
//				record = new HomepageSlide();
//				if (!record.LoadData(sql)) return otherwise.Execute<HomepageSlide>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <HomepageSlide>(id, "HomepageSlide", otherwise));
        }
Esempio n. 6
0
        /// <summary>
        /// Loads a record from the Testimonial table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg Testimonial.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = Testimonial.LoadID(55);</example>
        /// <param name="id">Primary key of Testimonial</param>
        /// <returns>An instance of Testimonial containing the data in the record</returns>
        public static Testimonial LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			Testimonial record = null;
//			record = Testimonial.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where TestimonialID=", Sql.Sqlize(id));
//				record = new Testimonial();
//				if (!record.LoadData(sql)) return otherwise.Execute<Testimonial>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <Testimonial>(id, "Testimonial", otherwise));
        }
Esempio n. 7
0
        /// <summary>
        /// Loads a record from the Banner table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg Banner.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = Banner.LoadID(55);</example>
        /// <param name="id">Primary key of Banner</param>
        /// <returns>An instance of Banner containing the data in the record</returns>
        public static Banner LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			Banner record = null;
//			record = Banner.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where BannerID=", Sql.Sqlize(id));
//				record = new Banner();
//				if (!record.LoadData(sql)) return otherwise.Execute<Banner>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <Banner>(id, "Banner", otherwise));
        }
Esempio n. 8
0
 /// <summary>
 /// Loads a record from the FAQItem table in the database given the supplied primary key value.
 /// If found in the cache, record will be loaded from the cache.
 /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg FAQItem.LoadID(55, Otherwise.Null) will return null if not found.
 /// </summary>
 /// <example>var g = FAQItem.LoadID(55);</example>
 /// <param name="id">Primary key of FAQItem</param>
 /// <returns>An instance of FAQItem containing the data in the record</returns>
 public static FAQItem LoadID(int id, Otherwise otherwise)
 {
     // see if already in cache, else create sql and load
     //			FAQItem record = null;
     //			record = FAQItem.GetFromCache(id); //comment out if not int pk type
     //			if (record == null)
     //			{
     //				var sql = new Sql("where FAQItemID=", Sql.Sqlize(id));
     //				record = new FAQItem();
     //				if (!record.LoadData(sql)) return otherwise.Execute<FAQItem>();
     //				record.StoreInCache();
     //			}
     //			return record;
         return ActiveRecordLoader.LoadID<FAQItem>(id, "FAQItem", otherwise);
 }
        public IUploadProcessor2 CreateObject(params object[] args)
        {
            if (Items != null)
            {
                foreach (var item in Items)
                {
                    if (item.Test())
                    {
                        return(item.UploadProcessor.CreateObject());
                    }
                }
            }

            return(Otherwise.CreateObject());
        }
Esempio n. 10
0
        /// <summary>
        /// Loads a record from the Settings table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg Settings.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = Settings.LoadID(55);</example>
        /// <param name="id">Primary key of Settings</param>
        /// <returns>An instance of Settings containing the data in the record</returns>
        public static Settings LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			Settings record = null;
//			record = Settings.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where SettingsID=", Sql.Sqlize(id));
//				record = new Settings();
//				if (!record.LoadData(sql)) return otherwise.Execute<Settings>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <Settings>(id, "Settings", otherwise));
        }
Esempio n. 11
0
        /// <summary>
        /// Loads a record from the DocumentDownload table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg DocumentDownload.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = DocumentDownload.LoadID(55);</example>
        /// <param name="id">Primary key of DocumentDownload</param>
        /// <returns>An instance of DocumentDownload containing the data in the record</returns>
        public static DocumentDownload LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			DocumentDownload record = null;
//			record = DocumentDownload.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where DocumentDownloadID=", Sql.Sqlize(id));
//				record = new DocumentDownload();
//				if (!record.LoadData(sql)) return otherwise.Execute<DocumentDownload>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <DocumentDownload>(id, "DocumentDownload", otherwise));
        }
Esempio n. 12
0
        /// <summary>
        /// Loads a record from the NewsRSS table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg NewsRSS.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = NewsRSS.LoadID(55);</example>
        /// <param name="id">Primary key of NewsRSS</param>
        /// <returns>An instance of NewsRSS containing the data in the record</returns>
        public static NewsRSS LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			NewsRSS record = null;
//			record = NewsRSS.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where NewsRSSID=", Sql.Sqlize(id));
//				record = new NewsRSS();
//				if (!record.LoadData(sql)) return otherwise.Execute<NewsRSS>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <NewsRSS>(id, "NewsRSS", otherwise));
        }
Esempio n. 13
0
        /// <summary>
        /// Loads a record from the Event table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg Event.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = Event.LoadID(55);</example>
        /// <param name="id">Primary key of Event</param>
        /// <returns>An instance of Event containing the data in the record</returns>
        public static Event LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			Event record = null;
//			record = Event.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where EventID=", Sql.Sqlize(id));
//				record = new Event();
//				if (!record.LoadData(sql)) return otherwise.Execute<Event>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <Event>(id, "Event", otherwise));
        }
        /// <summary>
        /// Loads a record from the AutocompletePhrase table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg AutocompletePhrase.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = AutocompletePhrase.LoadID(55);</example>
        /// <param name="id">Primary key of AutocompletePhrase</param>
        /// <returns>An instance of AutocompletePhrase containing the data in the record</returns>
        public static AutocompletePhrase LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			AutocompletePhrase record = null;
//			record = AutocompletePhrase.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where AutocompletePhraseID=", Sql.Sqlize(id));
//				record = new AutocompletePhrase();
//				if (!record.LoadData(sql)) return otherwise.Execute<AutocompletePhrase>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <AutocompletePhrase>(id, "AutocompletePhrase", otherwise));
        }
Esempio n. 15
0
        /// <summary>
        /// Loads a record from the GalleryCategory table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg GalleryCategory.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = GalleryCategory.LoadID(55);</example>
        /// <param name="id">Primary key of GalleryCategory</param>
        /// <returns>An instance of GalleryCategory containing the data in the record</returns>
        public static GalleryCategory LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			GalleryCategory record = null;
//			record = GalleryCategory.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where GalleryCategoryID=", Sql.Sqlize(id));
//				record = new GalleryCategory();
//				if (!record.LoadData(sql)) return otherwise.Execute<GalleryCategory>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <GalleryCategory>(id, "GalleryCategory", otherwise));
        }
Esempio n. 16
0
        /// <summary>
        /// Loads a record from the MapRegion table in the database given the supplied primary key value.
        /// If found in the cache, record will be loaded from the cache.
        /// If NOT FOUND, you can specify the behaviour with Beweb.Otherwise - eg MapRegion.LoadID(55, Otherwise.Null) will return null if not found.
        /// </summary>
        /// <example>var g = MapRegion.LoadID(55);</example>
        /// <param name="id">Primary key of MapRegion</param>
        /// <returns>An instance of MapRegion containing the data in the record</returns>
        public static MapRegion LoadID(int id, Otherwise otherwise)
        {
            // see if already in cache, else create sql and load
//			MapRegion record = null;
//			record = MapRegion.GetFromCache(id); //comment out if not int pk type
//			if (record == null)
//			{
//				var sql = new Sql("where MapRegionID=", Sql.Sqlize(id));
//				record = new MapRegion();
//				if (!record.LoadData(sql)) return otherwise.Execute<MapRegion>();
//				record.StoreInCache();
//			}
//			return record;
            return(ActiveRecordLoader.LoadID <MapRegion>(id, "MapRegion", otherwise));
        }
Esempio n. 17
0
        public void ChooseTwoFalseAndOtherWise()
        {
            var tag       = new Choose();
            var whenFalse = new When();

            whenFalse.Body = new MockAttribute(new Property("Body2"));
            whenFalse.Test = new MockAttribute(new Property("False"));
            tag.AddNestedTag(whenFalse);
            var whenFalse2 = new When();

            whenFalse2.Body = new MockAttribute(new Property("Body2"));
            whenFalse2.Test = new MockAttribute(new Property("False"));
            tag.AddNestedTag(whenFalse2);
            var otherwise = new Otherwise();

            otherwise.Body = new MockAttribute(new Property("Body1"));
            tag.AddNestedTag(otherwise);
            Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body1));
        }
Esempio n. 18
0
        public void ChooseTwoFalseAndOtherWise()
        {
            var tag       = new Choose();
            var whenFalse = new When();

            whenFalse.Body   = new MockAttribute(new Constant("Body1"));
            whenFalse.Select = new MockAttribute(new Constant("/results/value[position()=2]"));
            whenFalse.Source = new MockAttribute(new Constant("xml"));
            tag.AddNestedTag(whenFalse);
            var whenFalse2 = new When();

            whenFalse2.Body   = new MockAttribute(new Constant("Body2"));
            whenFalse2.Select = new MockAttribute(new Constant("/results/value[position()=2]"));
            whenFalse2.Source = new MockAttribute(new Constant("xml"));
            tag.AddNestedTag(whenFalse2);
            var otherwise = new Otherwise();

            otherwise.Body = new MockAttribute(new Constant("Body3"));
            tag.AddNestedTag(otherwise);
            Assert.That(tag.Evaluate(_model), Is.EqualTo("Body3"));
        }
Esempio n. 19
0
 public static Event Load(Sql sql, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <Event>(sql, "Event", otherwise));
 }
Esempio n. 20
0
 public static ArticleDocument Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <ArticleDocument>(reader, "ArticleDocument", otherwise));
 }
Esempio n. 21
0
 public static ArticleDocument Load(Sql sql, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <ArticleDocument>(sql, "ArticleDocument", otherwise));
 }
Esempio n. 22
0
        public void CheckOtherwiseRequired()
        {
            var tag = new Otherwise();

            RequiredAttribute.Check(tag);
        }
Esempio n. 23
0
 public static GalleryCategory Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <GalleryCategory>(reader, "GalleryCategory", otherwise));
 }
Esempio n. 24
0
 public static GalleryCategory Load(Sql sql, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <GalleryCategory>(sql, "GalleryCategory", otherwise));
 }
Esempio n. 25
0
 public static MapRegion Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <MapRegion>(reader, "MapRegion", otherwise));
 }
Esempio n. 26
0
 public static MapRegion Load(Sql sql, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <MapRegion>(sql, "MapRegion", otherwise));
 }
Esempio n. 27
0
 public static ShoppingCart Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <ShoppingCart>(reader, "ShoppingCart", otherwise));
 }
 public static AutocompletePhrase Load(Sql sql, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <AutocompletePhrase>(sql, "AutocompletePhrase", otherwise));
 }
 public static AutocompletePhrase Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <AutocompletePhrase>(reader, "AutocompletePhrase", otherwise));
 }
Esempio n. 30
0
 public static Event Load(DbDataReader reader, Otherwise otherwise)
 {
     return(ActiveRecordLoader.Load <Event>(reader, "Event", otherwise));
 }