/// <summary> /// Initializes a new instance of the <see cref="Reply"/> class. /// </summary> /// <param name="_replyId">The _reply id.</param> /// <param name="_email">The _email.</param> /// <param name="_subject">The _subject.</param> /// <param name="_rating">The _rating.</param> /// <param name="_userId">The _user id.</param> /// <param name="_comment">The _comment.</param> /// <param name="_addedOn">The _added on.</param> /// <param name="_parentId">The _parent id.</param> /// <param name="_reference">The _reference.</param> /// <param name="_disabled">if set to <c>true</c> [_disabled].</param> /// <param name="_approves">The _approves.</param> /// <param name="_disapproves">The _disapproves.</param> /// <param name="_flaggedInappropriate">The _flagged inappropriate.</param> /// <param name="_flaggedOk">if set to <c>true</c> [_flagged ok].</param> /// <param name="site">The site.</param> public Reply(Guid _replyId, string _email, string _subject, int _rating, int _userId, string _comment, DateTime _addedOn, Guid _parentId, string _reference, bool _disabled, int _approves, int _disapproves, int _flaggedInappropriate, bool _flaggedOk, Site site) { Id = _replyId; Email = _email; Subject = _subject; Rating = _rating; UserId = _userId; Comment = _comment; AddedOn = _addedOn; ParentId = _parentId; Reference = _reference; Disabled = _disabled; Approves = _approves; Disapproves = _disapproves; FlaggedInappropriate = _flaggedInappropriate; FlaggedOk = _flaggedOk; Replies = new List<Reply>(); User = site.Users.List.Find(delegate(Commerce.User u) { return u.UserId == _userId; }); if(User == null) { User = site.NullUser; } }
/// <summary> /// Initializes a new instance of the <see cref="ItemImages"/> class. /// </summary> /// <param name="site">The site.</param> public ItemImages(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand(@"select imagingId,rtrim(itemNumber) as itemNumber,fileName,height,width from imaging with (nolock)", cn)) { using(SqlDataReader d = cmd.ExecuteReader()) { if(d.HasRows) { while(d.Read()) { List.Add(new Image( d.GetGuid(0), d.GetString(1), d.GetString(2), d.GetInt32(3), d.GetInt32(4), "o", site )); } } } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="Image"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="itemNumber">The item number.</param> /// <param name="fileName">Name of the file.</param> /// <param name="height">The height.</param> /// <param name="width">The width.</param> /// <param name="locationType">Type of the location.</param> /// <param name="_site">The _site.</param> public Image(Guid id, string itemNumber, string fileName, int height, int width, string locationType, Site _site) { this.ItemNumber = itemNumber; this.FileName = fileName; this.Url = "/img/items/" + _site.siteAddress + "/" + itemNumber + "/" + fileName; this.Height = height; this.Width = width; this.LocationType = locationType; this.ImageType = imageTypeStringToImageType(LocationType); this.Id = id; if(height > 0 && width > 0) { this.HorizontalAspectRatio = (height / width); this.VerticalAspectRatio = (width / height); } }
/// <summary> /// Initializes a new instance of the <see cref="Review"/> class. /// </summary> /// <param name="f_id">The f_id.</param> /// <param name="f_userId">The f_user id.</param> /// <param name="f_rating">The f_rating.</param> /// <param name="f_value">The f_value.</param> /// <param name="f_archive">if set to <c>true</c> [f_archive].</param> /// <param name="f_date">The f_date.</param> /// <param name="f_refId">The f_ref id.</param> /// <param name="f_refType">Type of the f_ref.</param> /// <param name="site">The site.</param> public Review(Guid f_id, int f_userId, double f_rating, string f_value, bool f_archive, DateTime f_date, string f_refId, string f_refType, Site site) { Id = f_id; UserId = f_userId; Rating = f_rating; Value = f_value; Archive = f_archive; Date = f_date; RefId = f_refId; RefType = f_refType; User = site.Users.List.Find(delegate(User u) { return u.UserId == f_userId; }); }
/// <summary> /// Initializes a new instance of the <see cref="Session"/> class. /// </summary> /// <param name="_site">The _site.</param> /// <param name="sessionId">The session id.</param> /// <param name="cn">The cn.</param> /// <param name="trns">The TRNS.</param> public Session( Site _site, Guid sessionId, SqlConnection cn, SqlTransaction trns ) { getServerStateInfo(); if( sessionId == Guid.Empty ) { /* Ask the DB for a new sessionid*/ CreateNewSession( false, cn, trns ); } else { Id = sessionId; Refresh( false, cn, trns ); Cart = new Commerce.Cart( this, Site ); } }
/// <summary> /// Initializes a new instance of the <see cref="Blogs"/> class. /// </summary> /// <param name="site">The site.</param> public Blogs(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getBlogCategories", cn)) { using(SqlDataReader blog_list = cmd.ExecuteReader()) { while(blog_list.Read()) { Counter++; if(!(CurrentId == blog_list.GetGuid(19))) { CurrentId = blog_list.GetGuid(19); B = new Blog( blog_list.GetGuid(19), blog_list.GetString(20), blog_list.GetBoolean(21), blog_list.GetInt32(22), blog_list.GetBoolean(23), blog_list.GetString(24), site ); List.Add(B); } BlogEntry e = new BlogEntry( blog_list.GetGuid(0), blog_list.GetString(1), blog_list.GetString(2), blog_list.GetString(3), blog_list.GetString(4), blog_list.GetInt32(5), blog_list.GetInt32(6), blog_list.GetDateTime(7), blog_list.GetDateTime(8), blog_list.GetInt32(9), blog_list.GetString(10), blog_list.GetBoolean(11), blog_list.GetBoolean(12), blog_list.GetBoolean(13), blog_list.GetBoolean(14), blog_list.GetString(15), blog_list.GetBoolean(16), blog_list.GetInt32(17), blog_list.GetBoolean(18), blog_list.GetGuid(25), B, site ); B.Add(e); AllEntries.Add(e); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Redirectors"/> class. /// </summary> /// <param name="site">The site.</param> public Redirectors(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); SqlCommand cmd = new SqlCommand(@"select redirectorId, urlMatchPattern, urlToRedirectToMatch, errorMatch, case when [contentType] is null then '' else [contentType] end, case when [type] is null then '' else [type] end, case when [listOrder] is null then 0 else [listOrder] end, case when [enabled] is null then cast(0 as bit) else [enabled] end from redirector with (nolock)", cn); using(SqlDataReader r = cmd.ExecuteReader()) { while(r.Read()) { Redirector d = new Redirector(r.GetGuid(0), r.GetString(1), r.GetString(2), r.GetString(3), r.GetString(4), r.GetString(5), r.GetInt32(6), r.GetBoolean(7)); List.Add(d); } } /* order the list */ List.Sort(delegate(Redirector rdr1, Redirector rdr2) { return rdr2.Order.CompareTo(rdr1.Order); }); } }
/// <summary> /// Initializes a new instance of the <see cref="SeoListMetaUtilities"/> class. /// </summary> /// <param name="site">The site.</param> public SeoListMetaUtilities(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); SqlCommand cmd = new SqlCommand("dbo.getPageTitles", cn); using(SqlDataReader r = cmd.ExecuteReader()) { while(r.Read()) { SeoListMetaUtility d = new SeoListMetaUtility(r.GetGuid(0), r.GetInt32(1) , r.GetString(2), r.GetString(3), r.GetString(4), r.GetString(5)); List.Add(d); } } } }
/// <summary> /// Initializes a new instance of the <see cref="Cart"/> class. /// </summary> /// <param name="f_session">The f_session.</param> /// <param name="f_site">The f_site.</param> public Cart( Session f_session, Site f_site ) { EstShippingCost = 0; EstShipTotal = 0; SubTotal = 0; GrandTotal = 0; TaxTotal = 0; DiscountTotal = 0; Items = new List<CartItem>(); Addresses = new List<Address>(); Session = f_session; Site = f_site; }
/// <summary> /// Initializes a new instance of the <see cref="Zones"/> class. /// </summary> /// <param name="site">The site.</param> public Zones(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getZones", cn)) { using(SqlDataReader carrierList = cmd.ExecuteReader()) { while(carrierList.Read()) { List.Add(new Zone( carrierList.GetGuid(0), carrierList.GetInt32(1), carrierList.GetDouble(2), carrierList.GetInt32(3), carrierList.GetDecimal(4) ) ); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Session"/> class. /// </summary> /// <param name="_site">The _site.</param> /// <param name="sessionId">The session id.</param> public Session( Site _site, Guid sessionId ) { getServerStateInfo(); if( sessionId == Guid.Empty ) { /* Ask the DB for a new sessionid*/ CreateNewSession( false ); } else { Id = sessionId; Refresh( false ); Cart = new Commerce.Cart( this, this.Site ); } }
/// <summary> /// Initializes a new instance of the <see cref="SiteSections"/> class. /// </summary> /// <param name="site">The site.</param> public SiteSections( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand(@"select s.siteSectionId, siteSectionDetailId, name, s.description, URL, data, addDate, active, unique_siteId, s.name, sd.description from siteSections s with (nolock) inner join siteSectionsDetail sd with (nolock) on s.siteSectionId = sd.siteSectionId where unique_siteId = @siteId order by s.siteSectionId, addDate", cn)) { ; cmd.Parameters.Add("@siteId", SqlDbType.UniqueIdentifier).Value = new Guid(Site.Id.ToString()); using(SqlDataReader d = cmd.ExecuteReader()) { if(d.HasRows) { Guid currentId = Guid.Empty; SiteSection section = null; while(d.Read()) { if(currentId != d.GetGuid(0)) { currentId = d.GetGuid(0); section = new SiteSection( d.GetGuid(0), d.GetString(2), d.GetString(3), d.GetString(4) ); List.Add(section); /* if this isn't a category add it to the list of URLs to rewrite */ section.isCategory = Main.Site.Categories.List.Exists(delegate(Commerce.Category cat) { return cat.Id == section.Id; }); } SiteSectionEntry e = new SiteSectionEntry( d.GetGuid(1), d.GetGuid(0), d.GetString(5), d.GetDateTime(6), d.GetBoolean(7), d.GetString(9), d.GetString(10) ); if(section != null) { section.Entries.Add(e); } Entries.Add(e); } } } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="SiteDefaults"/> class. /// </summary> /// <param name="site">The site.</param> public SiteDefaults( Site site ) { ( "FUNCTION siteDefaults" ).Debug( 10 ); MetaKeywords = site.default_meta_keywords; MetaDescription = site.default_meta_description; PageTitle = site.default_page_title; AccessDeniedPage = site.default_access_denied_page; EmptyCartPage = site.default_empty_cart_page; FormDirectory = site.default_form_detail_directory; IntrestPage = site.default_intresting_page; ListMode = site.default_listmode; OrderBy = site.default_orderby; RateId = site.default_rateId; RecordsPerPage = site.default_records_per_page; AllowPreorders = site.default_new_user_allow_preorder; SearchText = site.default_search_text; SiteUrl = site.siteAddress; Address1 = site.company_address1; Address2 = site.company_address2; City = site.company_city; CareOf = site.company_co; Country = site.company_country; Email = site.company_email; Fax = site.company_fax; Name = site.company_name; Phone = site.company_phone; State = site.company_state; Zip = site.company_zip; MetaExpires = site.days_meta_expires; SiteName = site.friendlySiteName; LocalCountry = site.local_country; ScannedImagePath = site.scanned_image_path; Error404page = site.site_server_404_page; Error500page = site.site_server_500_page; TestMode = site.test_mode; SiteId = Site.Id; UseSsl = site.use_ssl; PlaceOrderRedirect = site.place_order_redirect; }
/// <summary> /// Initializes a new instance of the <see cref="Reviews"/> class. /// </summary> /// <param name="site">The site.</param> public Reviews(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getReviews", cn)) { using(SqlDataReader review_list = cmd.ExecuteReader()) { while(review_list.Read()) { List.Add(new Review( review_list.GetGuid(0), review_list.GetInt32(1), review_list.GetDouble(2), review_list.GetString(3), review_list.GetBoolean(4), review_list.GetDateTime(5), review_list.GetString(6), review_list.GetString(7), site )); } } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="Countries"/> class. /// </summary> /// <param name="site">The site.</param> public Countries(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getCountries", cn)) { using(SqlDataReader countryList = cmd.ExecuteReader()) { while(countryList.Read()) { List.Add(new Country(countryList.GetString(0))); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Menus"/> class. /// </summary> /// <param name="site">The site.</param> public Menus( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getMenus", cn)) { using(SqlDataReader menu_list = cmd.ExecuteReader()) { string[] column_names = new string[menu_list.FieldCount]; for(int x = 0; menu_list.FieldCount > x; x++) { column_names[x] = menu_list.GetName(x); } while(menu_list.Read()) { Object[] raw = new Object[menu_list.FieldCount]; menu_list.GetValues(raw); Menu m = new Menu( menu_list.GetGuid(0), menu_list.GetGuid(1), menu_list.GetValue(2).ToString(), menu_list.GetValue(3).ToString(), menu_list.GetBoolean(4), menu_list.GetInt32(5), menu_list.GetInt32(6), menu_list.GetInt32(7), menu_list.GetInt32(8), menu_list.GetValue(9).ToString(), menu_list.GetInt32(10), menu_list.GetValue(11).ToString() ); this.Add(m); } BuildHierarchies(); } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="Blog"/> class. /// </summary> /// <param name="f_id">The f_id.</param> /// <param name="f_categoryName">Name of the f_category.</param> /// <param name="f_publicCategory">if set to <c>true</c> [f_public category].</param> /// <param name="f_author">The f_author.</param> /// <param name="f_showInTicker">if set to <c>true</c> [f_show in ticker].</param> /// <param name="f_blogPage">The f_blog page.</param> /// <param name="site">The site.</param> public Blog(Guid f_id, string f_categoryName, bool f_publicCategory, int f_author, bool f_showInTicker, string f_blogPage, Site site) { LoadBlog(f_id, f_categoryName, f_publicCategory, f_author, f_showInTicker, f_blogPage, site); }
/// <summary> /// Initializes a new instance of the <see cref="Session"/> class. /// </summary> /// <param name="_site">The _site.</param> public Session( Site _site ) { getServerStateInfo(); Site = _site; string sessionid = null; bool newsession = false; string cookieName = ""; cookieName = Site.cookie_name; HttpCookie http_cookie_sessionid = null; if(HttpContext.Current!=null){ try { http_cookie_sessionid = HttpContext.Current.Request.Cookies[ cookieName ]; } catch( Exception e ) { Exception ex = new Exception( "Cannot aquire cookie from client:" + e.Message ); http_cookie_sessionid = null; throw ex; } } if( http_cookie_sessionid == null ) { newsession = true; } Dictionary<string, object> j = new Dictionary<string, object>(); if( newsession ) { CreateNewSession( true ); j.Add( "newSession", true ); } else { if( Utilities.GuidPattern.IsMatch( http_cookie_sessionid.Value.ToString() ) ) { sessionid = http_cookie_sessionid.Value.ToString(); Id = new Guid( http_cookie_sessionid.Value.ToString() ); j.Add( "newSession", false ); } } j.Add( "ip", Ip ); j.Add( "sessionId", Id.ToString() ); j.Add( "URL", Url + Path ); j.Add( "userAgent", UserAgent ); j.Add( "referer", Referer ); j.Add( "host", Host ); ( "connection>" + j.ToJson() ).Debug( 10 ); Refresh(); return; }
/// <summary> /// Initializes a new instance of the <see cref="Session"/> class. /// </summary> /// <param name="_site">The _site.</param> /// <param name="cn">The cn.</param> /// <param name="trns">The TRNS.</param> public Session( Site _site, SqlConnection cn, SqlTransaction trns ) { CreateNewSession( false, cn, trns ); }
/// <summary> /// Initializes a new instance of the <see cref="Properties"/> class. /// </summary> /// <param name="site">The site.</param> public Properties(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getProperties", cn)) { using(SqlDataReader prop_list = cmd.ExecuteReader()) { while(prop_list.Read()) { List.Add(new Property( prop_list.GetGuid(0), prop_list.GetString(1), prop_list.GetString(2), prop_list.GetString(3), prop_list.GetString(4), prop_list.GetInt32(5), (bool)prop_list.GetSqlBoolean(6), prop_list.GetDecimal(7), (bool)prop_list.GetSqlBoolean(8), (bool)prop_list.GetSqlBoolean(9), (bool)prop_list.GetSqlBoolean(10) )); } } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="Categories"/> class. /// </summary> /// <param name="site">The site.</param> public Categories( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.fullCategoryList", cn)) { using(SqlDataReader categories = cmd.ExecuteReader()) { while(categories.Read()) { if(CurrentId != categories.GetGuid(categories.GetOrdinal("categoryId"))) { Cat = new Category( categories.GetString(categories.GetOrdinal("categoryName")), categories.GetGuid(categories.GetOrdinal("categoryId")), categories.GetBoolean(categories.GetOrdinal("enabled")) ); CurrentId = Cat.Id; List.Add(Cat); } I = site.Item(categories.GetString(categories.GetOrdinal("itemNumber"))); if(I != null) { if(!categories.IsDBNull(categories.GetOrdinal("listOrder"))) { if(I.CategoryOrder == null) { I.CategoryOrder = new Dictionary<Guid, int>(); } if(!I.CategoryOrder.ContainsKey(Cat.Id)) { I.CategoryOrder.Add(Cat.Id, categories.GetInt32(categories.GetOrdinal("listOrder"))); } }; if(!Cat.Items.Contains(I)) { Cat.Items.Add(I); } } } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Replies"/> class. /// </summary> /// <param name="site">The site.</param> public Replies(Site site) { this.Refresh(site); }
/// <summary> /// Initializes a new instance of the <see cref="ZipToZones"/> class. /// </summary> /// <param name="site">The site.</param> public ZipToZones(Site site) { List = new List<ZipToZone>(); using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getZipToZones", cn)) { using(SqlDataReader zoneList = cmd.ExecuteReader()) { while(zoneList.Read()) { List.Add(new ZipToZone( zoneList.GetGuid(0), zoneList.GetInt32(1), zoneList.GetInt32(2), zoneList.GetInt32(3), zoneList.GetInt32(4), zoneList.GetInt32(5), zoneList.GetInt32(6) )); } } } } }
/// <summary> /// Refreshes the list of replies on the site. /// </summary> /// <param name="site">The site.</param> public void Refresh(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); SqlCommand cmd = new SqlCommand(@"select replyId, email, subject, rating, userId, comment, addedOn, parentId, reference, disabled, approves, disapproves, flaggedInappropriate, flaggedOk from replies with (nolock) order by addedOn asc", cn); int counter = 0; using(SqlDataReader d = cmd.ExecuteReader()) { while(d.Read()) { List.Add( new Reply( d.GetGuid(0), d.GetString(1), d.GetString(2), d.GetInt32(3), d.GetInt32(4), d.GetString(5), d.GetDateTime(6), d.GetGuid(7), d.GetString(8), d.GetBoolean(9), d.GetInt32(10), d.GetInt32(11), d.GetInt32(12), d.GetBoolean(13), site ) ); counter++; } BuildReplyHierarchy(); } } }
/// <summary> /// Initializes a new instance of the <see cref="Galleries"/> class. /// </summary> /// <param name="site">The site.</param> public Galleries(Site site) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getGalleries", cn)) { Guid currentId = Guid.NewGuid(); using(SqlDataReader gallery_list = cmd.ExecuteReader()) { while(gallery_list.Read()) { if(currentId != gallery_list.GetGuid(28)) { currentId = gallery_list.GetGuid(28); G = new Gallery( gallery_list.GetGuid(28), gallery_list.GetString(29), gallery_list.GetInt32(30), gallery_list.GetInt32(31), gallery_list.GetInt32(32), gallery_list.GetGuid(33), gallery_list.GetGuid(34), gallery_list.GetGuid(35), gallery_list.GetGuid(36), gallery_list.GetGuid(37), gallery_list.GetBoolean(38), gallery_list.GetString(39), gallery_list.GetInt32(40), gallery_list.GetString(41) ); List.Add(G); } G.Add(new GalleryImage( gallery_list.GetGuid(0), gallery_list.GetString(1), gallery_list.GetString(2), gallery_list.GetString(3), gallery_list.GetInt32(4), gallery_list.GetInt32(5), gallery_list.GetInt32(6), gallery_list.GetInt32(7), gallery_list.GetInt32(8), gallery_list.GetInt32(9), gallery_list.GetString(10), gallery_list.GetString(11), gallery_list.GetBoolean(12), gallery_list.GetInt32(13), gallery_list.GetInt32(14), gallery_list.GetInt32(15), gallery_list.GetInt32(16), gallery_list.GetInt32(17), gallery_list.GetInt32(18), gallery_list.GetInt32(19), gallery_list.GetDateTime(20), gallery_list.GetInt32(21), gallery_list.GetInt32(22), gallery_list.GetInt32(23), gallery_list.GetInt32(24), gallery_list.GetString(25), gallery_list.GetString(26), gallery_list.GetString(27), gallery_list.GetInt32(42), gallery_list.GetInt32(43), gallery_list.GetString(29), gallery_list.GetGuid(28) )); } } } } }
/// <summary> /// Loads the Blog. /// </summary> /// <param name="f_id">The f_id.</param> /// <param name="f_categoryName">Name of the f_category.</param> /// <param name="f_publicCategory">if set to <c>true</c> [f_public category].</param> /// <param name="f_author">The f_author.</param> /// <param name="f_showInTicker">if set to <c>true</c> [f_show in ticker].</param> /// <param name="f_blogPage">The f_blog page.</param> /// <param name="site">The site.</param> private void LoadBlog(Guid f_id, string f_categoryName, bool f_publicCategory, int f_author, bool f_showInTicker, string f_blogPage, Site site) { Id = f_id; CategoryName = f_categoryName; PublicCategory = f_publicCategory; AuthorId = f_author; Author = Commerce.User.All.Find(delegate(Commerce.User u) { return u.UserId == f_author; }); if(Author == null) { Author = site.NullUser; } ShowInTicker = f_showInTicker; BlogPage = f_blogPage; }
/// <summary> /// Initializes a new instance of the <see cref="SiteImagePlaceholders"/> class. /// </summary> /// <param name="site">The site.</param> public SiteImagePlaceholders( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand(@"select unique_siteId, m_imagingTemplate,c_imagingTemplate,f_imagingTemplate,t_imagingTemplate, a_imagingTemplate,x_imagingTemplate,y_imagingTemplate,z_imagingTemplate,b_imagingTemplate,d_imagingTemplate, siteaddress from site_configuration", cn)) { using(SqlDataReader r = cmd.ExecuteReader()) { List = new List<SiteImagePlaceholder>(); while(r.Read()) { List.Add(new SiteImagePlaceholder( r.GetGuid(0), r.GetGuid(1), r.GetGuid(2), r.GetGuid(3), r.GetGuid(4), r.GetGuid(5), r.GetGuid(6), r.GetGuid(7), r.GetGuid(8), r.GetGuid(9), r.GetGuid(10), r.GetString(11) )); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="FlagTypes"/> class. /// </summary> /// <param name="site">The site to read from.</param> public FlagTypes( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getFlagTypes", cn)) { using(SqlDataReader r = cmd.ExecuteReader()) { while(r.Read()) { Flag f = new Flag( r.GetInt32(0) /*flagTypeId*/, r.GetString(1) /*flagTypeName*/, r.GetString(2) /*flagTypeDesc*/, r.GetInt32(3) /*userLevel*/, r.GetBoolean(4) /*shipmentFlag*/, r.GetBoolean(5) /*userFlag*/, r.GetBoolean(6) /*orderFlag*/, r.GetBoolean(7) /*lineFlag*/, r.GetBoolean(8) /*lineDetailFlag*/, r.GetString(9) /*customerReadable*/, r.GetInt32(10) /*agingDaysStatus1*/, r.GetInt32(11) /*agingDaysStatus2*/, r.GetInt32(12) /*agingDaysStatus3*/, r.GetInt32(13) /*agingDaysStatus4*/, r.GetInt32(14) /*agingDaysStatus5*/, r.GetBoolean(15) /*showInProductionAgingReport*/, r.GetInt32(16) /*productionAgingReportOrder*/, r.GetInt32(17) /*cannotOccurBeforeFlagId*/, r.GetInt32(18) /*cannotOccurAfterFlagId*/, r.GetBoolean(19) /*purchaseOrderFlag*/, r.GetBoolean(20) /*purchaseShipmentFlag*/, r.GetBoolean(21) /*purchaseLineFlag*/, r.GetBoolean(22) /*createsNewPurchaseOrder*/, r.GetBoolean(23) /*finishedPurchaseOrderFlag*/, r.GetString(24) /*color*/ ); List.Add(f); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Users"/> class. /// </summary> /// <param name="site">The site.</param> public Users( Site site ) { using(SqlConnection cn = Site.CreateConnection(true, true)) { cn.Open(); using(SqlCommand cmd = new SqlCommand("dbo.getUsers @userId", cn)) { cmd.Parameters.Add("@userId", SqlDbType.Int).Value = -1; using(SqlDataReader user_list = cmd.ExecuteReader()) { while(user_list.Read()) { try { List.Add(GetUserFromDataReader(user_list)); } catch(Exception e) { (e.Message).Debug(4); int userId; try { userId = user_list.GetInt32(2); } catch(Exception ex) { (ex.Message).Debug(4); userId = -1; } String.Format("Class users thew an exception on instantiation ==>{0}", userId).Debug(1); } } } } } return; }
/// <summary> /// Initializes a new instance of the <see cref="BlogEntry"/> class. /// </summary> /// <param name="f_id">The f_id.</param> /// <param name="f_subject">The f_subject.</param> /// <param name="f_message">The f_message.</param> /// <param name="f_comments">The f_comments.</param> /// <param name="f_tags">The f_tags.</param> /// <param name="f_editor">The f_editor.</param> /// <param name="f_author">The f_author.</param> /// <param name="f_addDate">The f_add date.</param> /// <param name="f_dateChanged">The f_date changed.</param> /// <param name="f_lastEditor">The f_last editor.</param> /// <param name="f_annotations">The f_annotations.</param> /// <param name="f_enabled">if set to <c>true</c> [f_enabled].</param> /// <param name="f_auditComments">if set to <c>true</c> [f_audit comments].</param> /// <param name="f_allowComments">if set to <c>true</c> [f_allow comments].</param> /// <param name="f_emailUpdates">if set to <c>true</c> [f_email updates].</param> /// <param name="f_blogImage">The f_blog image.</param> /// <param name="f_publicBlog">if set to <c>true</c> [f_public Blog].</param> /// <param name="f_listOrder">The f_list order.</param> /// <param name="f_archive">if set to <c>true</c> [f_archive].</param> /// <param name="f_galleryId">The f_gallery id.</param> /// <param name="_blog">The _blog.</param> /// <param name="site">The site.</param> public BlogEntry(Guid f_id, string f_subject, string f_message, string f_comments, string f_tags, int f_editor, int f_author, DateTime f_addDate, DateTime f_dateChanged, int f_lastEditor, string f_annotations, bool f_enabled, bool f_auditComments, bool f_allowComments, bool f_emailUpdates, string f_blogImage, bool f_publicBlog, int f_listOrder, bool f_archive, Guid f_galleryId, Blog _blog, Site site) { Id = f_id; Subject = f_subject.Trim(); Message = f_message; Comments = f_comments; Tags = f_tags.Trim(); EditorId = f_editor; AuthorId = f_author; AddDate = f_addDate; DateChanged = f_dateChanged; LastEditor = f_lastEditor; Annotations = f_annotations; Enabled = f_enabled; AuditComments = f_auditComments; AllowComments = f_allowComments; EmailUpdates = f_emailUpdates; BlogImage = f_blogImage; PublicBlog = f_publicBlog; ListOrder = f_listOrder; Archive = f_archive; Blog = _blog; GalleryId = f_galleryId; Gallery = BlogPlugin.Galleries.List.Find(delegate(Gallery gal) { return gal.Id == GalleryId; }); Replies = Commerce.Reply.All.FindAll(delegate(Rendition.Commerce.Reply reply) { return (reply.ParentId == f_id) && ((reply.FlaggedInappropriate < site.inappropriateHideThreshold) || reply.FlaggedOk); }); Author = Commerce.User.All.Find(delegate(Commerce.User u) { return u.UserId == f_author; }); Editor = Commerce.User.All.Find(delegate(Commerce.User u) { return u.UserId == f_editor; }); Introduction = Message; if(Message.Contains("<h6")) { HasIntroduction = true; string i = Message.Substring(0, Message.IndexOf("<h6") - 4); i = Regex.Replace(i, "(<h6>)|(</h6>)", "", RegexOptions.IgnoreCase); Introduction = i; Message = Regex.Replace(Message, "(<h6>)|(</h6>)", "", RegexOptions.IgnoreCase); } }