public static SO_vNWS_Tag getObject_byTag_andLanguage( string sessionGuid_in, string ip_forLogPurposes_in, long idTag_in, int idLanguage_in, out int[] errors_out ) { SO_vNWS_Tag _output = null; List <int> _errorlist; Guid _sessionguid; Sessionuser _sessionuser; #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out _sessionguid, out _sessionuser, out _errorlist, out errors_out )) { //// no need! //errors_out = _errors.ToArray(); return(_output); } #endregion #region check Permissions . . . if ( !_sessionuser.hasPermission( PermissionType.Tag__select ) ) { _errorlist.Add(ErrorType.tag__lack_of_permissions_to_read); errors_out = _errorlist.ToArray(); return(_output); } #endregion _output = DO_vNWS_Tag.getObject_byTag_andL( idTag_in, idLanguage_in, null ); errors_out = _errorlist.ToArray(); return(_output); }
public void Bind() { rep_Tags.Visible = false; rep_Sources.Visible = false; rep_Attachments.Visible = false; tr_Attachments1.Visible = false; tr_Details.Visible = false; tbl_News.Visible = false; if (IDNews <= 0) { return; } bool _showDetails = false; int[] _errors; SO_vNWS_Source[] _sources; SO_NWS_ContentSource[] _contentsources; SO_vNWS_Tag[] _tags; SO_NWS_ContentTag[] _contenttags; List<SO_vNWS_Attachment> _attachments_final; SO_vNWS_Attachment[] _attachments; SO_vNWS_Attachment _attachment; SO_vNWS_Content _content = BusinessInstances.NWS_News.InstanceClient.getObject( utils.User.SessionGuid, utils.ClientIPAddress, IDNews, utils.IDLanguage__default, out _errors ); if (!Master__base.Error_add(_errors)) { if (_content != null) { #region rep_Attachments.DataSource = ...; rep_Attachments.DataBind(); _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( utils.User.SessionGuid, utils.ClientIPAddress, IDNews, utils.IDLanguage__default, out _errors ); if ( !Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment); } ); #region _attachment = ...; _attachments_final = ...; _attachments_final = (_attachments.Length > 0) ? new List<SO_vNWS_Attachment>(_attachments.Length) : null; _attachment = null; int _image_count = 0; foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.isImage) { _image_count++; if ( (_image_count != 0) && (_image_count <= 2) ) { _attachment = _attachment2; } } if ( !_attachment2.isImage || (_image_count > 2) ) { // NOT image OR [ image BUT beyond the ones used for display ] _attachments_final.Add(_attachment2); } } #endregion #region img_News.ImageUrl = ...; if (_attachment != null) { img_News.ImageUrl = string.Format( "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); if ( !_attachment.Name_isNull && (_attachment.Name != "") ) { lbl_Image_Name.Text = _attachment.Name; } if ( !_attachment.Description_isNull && (_attachment.Description != "") ) { lbl_Image_Description.Text = string.Format( "({0})", _attachment.Description ); } } #endregion #region rep_Attachments... if ( (_attachments_final != null) && (_attachments_final.Count > 0) ) { rep_Attachments.DataSource = _attachments_final; rep_Attachments.DataBind(); rep_Attachments.Visible = true; tr_Attachments1.Visible = true; } #endregion } #endregion #region rep_Sources.DataSource = ...; rep_Sources.DataBind(); _contentsources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( utils.User.SessionGuid, utils.ClientIPAddress, IDNews, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_contentsources != null) && (_contentsources.Length > 0) ) { _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( utils.User.SessionGuid, utils.ClientIPAddress, 0, 0, out _errors ); if (!Master__base.Error_add(_errors)) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_contentsources.Length]; for (int s1 = 0; s1 < _contentsources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_contentsources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } rep_Sources.DataSource = _sources2; rep_Sources.DataBind(); rep_Sources.Visible = true; _showDetails = true; } } #endregion #region rep_Tags.DataSource = ...; rep_Tags.DataBind(); _contenttags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( utils.User.SessionGuid, utils.ClientIPAddress, IDNews, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_contenttags != null) && (_contenttags.Length > 0) ) { _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( utils.User.SessionGuid, utils.ClientIPAddress, utils.IDLanguage__default, 0, 0, out _errors ); if (!Master__base.Error_add(_errors)) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_contenttags.Length]; for (int t1 = 0; t1 < _contenttags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_contenttags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } rep_Tags.DataSource = _tags2; rep_Tags.DataBind(); rep_Tags.Visible = true; _showDetails = true; } } #endregion tr_Details.Visible = _showDetails; lbl_Publish_date.Text = string.Format( "{0}.{1}.{2} | {3}h{4}", _content.Publish_date.Day.ToString().PadLeft(2, '0'), _content.Publish_date.Month.ToString().PadLeft(2, '0'), _content.Publish_date.Year, _content.Publish_date.Hour.ToString().PadLeft(2, '0'), _content.Publish_date.Minute.ToString().PadLeft(2, '0') ); lbl_Title.Text = _content.Title; lbl_Content.Text = OGen.lib.presentationlayer.webforms.utils.Replace_RN_BR(_content.Content); tbl_News.Visible = true; } else { Master__base.Error_add(false, "no data"); } } }
public void Bind() { int[] _errors; long _count; //// TODO: consider removing commented code //if (!Master_Site.Master__base.Creds.hasPermission( // true, // PermissionType.Forum__Forum__read, // PermissionType.Forum__Thread__read, // PermissionType.Forum__Reply__read //)) { // this.spn_Forum.Visible = false; // this.REP_Threads.Visible = false; //} else { // this.spn_Forum.Visible = true; // this.REP_Threads.Visible = true; // #region this.REP_Threads.DataSource = ...; this.REP_Threads.DataBind(); // long _count; // long _idmessage__forum; // SO_vFOR_Message[] _messages; // _messages // = FOR_Forum.InstanceClient.getRecord_Forum( // Utilities.User.Credentials_ENC, // Utilities.IDApplication, // out _idmessage__forum, // 1, // 3, // out _count, // out _errors // ); // if (_messages != null) { // Array.Sort( // _messages, // delegate( // SO_vFOR_Message arg1_in, // SO_vFOR_Message arg2_in // ) { // return arg2_in.IDMessage.CompareTo(arg1_in.IDMessage); // } // ); // this.REP_Threads.DataSource = _messages; // this.REP_Threads.DataBind(); // } // #endregion //} SO_vNWS_Content[] _news = BusinessInstances.NWS_News.InstanceClient.getRecord_generic( Utilities.User.SessionGuid, Utilities.ClientIPAddress, -1L, 0L, // 0: Approved; -1: NOT approved; < -1: ignore; >0: ... DateTime.MinValue, DateTime.MinValue, new long[] { }, new long[] { }, new long[] { }, (Utilities.News_Highlight_for_Default <= 0) ? new long[] { } : new long[] { Utilities.News_Highlight_for_Default }, new long[] { }, // ToDos: here! "", Utilities.IDLanguage__default, true, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_news != null) && (_news.Length > 0) ) { #region this.REP_News.DataSource = ...; this.REP_News.DataBind(); Array.Sort( _news, delegate( SO_vNWS_Content arg1_in, SO_vNWS_Content arg2_in ) { return arg2_in.Publish_date.CompareTo(arg1_in.Publish_date); } ); foreach (SO_vNWS_Content _content in _news) { _content.summary = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.summary); _content.Content = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.Content); } this.REP_News.DataSource = _news; this.REP_News.DataBind(); #endregion #region SO_vNWS_Tag[] _tags = ...; SO_vNWS_Tag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( Utilities.User.SessionGuid, Utilities.ClientIPAddress, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { Array.Sort( _tags, delegate( SO_vNWS_Tag arg1_in, SO_vNWS_Tag arg2_in ) { return string.Compare( arg1_in.Name, arg2_in.Name, false, System.Globalization.CultureInfo.CurrentCulture ); } ); //REP_Tags.DataSource = _tags; //REP_Tags.DataBind(); } #endregion #region SO_vNWS_Source[] _sources = ...; SO_vNWS_Source[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( Utilities.User.SessionGuid, Utilities.ClientIPAddress, 0, 0, 0, out _count, out _errors ); this.Master__base.Error_add(_errors); #endregion bool _show_Details; Anthem.Image _img_news; Anthem.Repeater _rep_news_tags; Anthem.Repeater _rep_news_sources; System.Web.UI.HtmlControls.HtmlTableRow _tr_details; for (int n = 0; n < _news.Length; n++) { _show_Details = false; #region _rep_news_tags.DataSource = ...; _rep_news_tags.DataBind(); SO_NWS_ContentTag[] _content_tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_tags != null) && (_content_tags.Length > 0) ) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_content_tags.Length]; for (int t1 = 0; t1 < _content_tags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_content_tags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } _rep_news_tags = (Anthem.Repeater)this.REP_News.Items[n].FindControl("REP_News_Tags"); _rep_news_tags.DataSource = _tags2; _rep_news_tags.DataBind(); _rep_news_tags.Visible = true; _show_Details = true; } #endregion #region _rep_news_sources.DataSource = ...; _rep_news_sources.DataBind(); SO_NWS_ContentSource[] _content_sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_sources != null) && (_content_sources.Length > 0) ) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_content_sources.Length]; for (int s1 = 0; s1 < _content_sources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_content_sources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } _rep_news_sources = (Anthem.Repeater)this.REP_News.Items[n].FindControl("REP_News_Sources"); _rep_news_sources.DataSource = _sources2; _rep_news_sources.DataBind(); _rep_news_sources.Visible = true; _show_Details = true; } #endregion #region _img_news = ...; #region SO_vNWS_Attachment _attachment = ...; SO_vNWS_Attachment _attachment; SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); #endregion if ( !this.Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment); } ); _attachment = null; foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.IsImage) { _attachment = _attachment2; break; } } if (_attachment != null) { _img_news = (Anthem.Image)this.REP_News.Items[n].FindControl("IMG_News"); _img_news.ImageUrl = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); _img_news.Visible = true; } } #endregion _tr_details = (System.Web.UI.HtmlControls.HtmlTableRow)this.REP_News.Items[n].FindControl("TR_Details"); _tr_details.Visible = _show_Details; } } }
public void Bind() { int[] _errors; long _count; //// TODO: consider removing commented code //if (!Master_Site.Master__base.Creds.hasPermission( // true, // PermissionType.Forum__Forum__read, // PermissionType.Forum__Thread__read, // PermissionType.Forum__Reply__read //)) { // this.spn_Forum.Visible = false; // this.REP_Threads.Visible = false; //} else { // this.spn_Forum.Visible = true; // this.REP_Threads.Visible = true; // #region this.REP_Threads.DataSource = ...; this.REP_Threads.DataBind(); // long _count; // long _idmessage__forum; // SO_vFOR_Message[] _messages; // _messages // = FOR_Forum.InstanceClient.getRecord_Forum( // Utilities.User.Credentials_ENC, // Utilities.IDApplication, // out _idmessage__forum, // 1, // 3, // out _count, // out _errors // ); // if (_messages != null) { // Array.Sort( // _messages, // delegate( // SO_vFOR_Message arg1_in, // SO_vFOR_Message arg2_in // ) { // return arg2_in.IDMessage.CompareTo(arg1_in.IDMessage); // } // ); // this.REP_Threads.DataSource = _messages; // this.REP_Threads.DataBind(); // } // #endregion //} SO_vNWS_Content[] _news = BusinessInstances.NWS_News.InstanceClient.getRecord_generic( Utilities.User.SessionGuid, Utilities.ClientIPAddress, -1L, 0L, // 0: Approved; -1: NOT approved; < -1: ignore; >0: ... DateTime.MinValue, DateTime.MinValue, new long[] { }, new long[] { }, new long[] { }, (Utilities.News_Highlight_for_Default <= 0) ? new long[] { } : new long[] { Utilities.News_Highlight_for_Default }, new long[] { }, // ToDos: here! "", Utilities.IDLanguage__default, true, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_news != null) && (_news.Length > 0) ) { #region this.REP_News.DataSource = ...; this.REP_News.DataBind(); Array.Sort( _news, delegate( SO_vNWS_Content arg1_in, SO_vNWS_Content arg2_in ) { return(arg2_in.Publish_date.CompareTo(arg1_in.Publish_date)); } ); foreach (SO_vNWS_Content _content in _news) { _content.summary = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.summary); _content.Content = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.Content); } this.REP_News.DataSource = _news; this.REP_News.DataBind(); #endregion #region SO_vNWS_Tag[] _tags = ...; SO_vNWS_Tag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( Utilities.User.SessionGuid, Utilities.ClientIPAddress, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { Array.Sort( _tags, delegate( SO_vNWS_Tag arg1_in, SO_vNWS_Tag arg2_in ) { return(string.Compare( arg1_in.Name, arg2_in.Name, false, System.Globalization.CultureInfo.CurrentCulture )); } ); //REP_Tags.DataSource = _tags; //REP_Tags.DataBind(); } #endregion #region SO_vNWS_Source[] _sources = ...; SO_vNWS_Source[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( Utilities.User.SessionGuid, Utilities.ClientIPAddress, 0, 0, 0, out _count, out _errors ); this.Master__base.Error_add(_errors); #endregion bool _show_Details; Anthem.Image _img_news; Anthem.Repeater _rep_news_tags; Anthem.Repeater _rep_news_sources; System.Web.UI.HtmlControls.HtmlTableRow _tr_details; for (int n = 0; n < _news.Length; n++) { _show_Details = false; #region _rep_news_tags.DataSource = ...; _rep_news_tags.DataBind(); SO_NWS_ContentTag[] _content_tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_tags != null) && (_content_tags.Length > 0) ) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_content_tags.Length]; for (int t1 = 0; t1 < _content_tags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_content_tags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } _rep_news_tags = (Anthem.Repeater) this.REP_News.Items[n].FindControl("REP_News_Tags"); _rep_news_tags.DataSource = _tags2; _rep_news_tags.DataBind(); _rep_news_tags.Visible = true; _show_Details = true; } #endregion #region _rep_news_sources.DataSource = ...; _rep_news_sources.DataBind(); SO_NWS_ContentSource[] _content_sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_sources != null) && (_content_sources.Length > 0) ) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_content_sources.Length]; for (int s1 = 0; s1 < _content_sources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_content_sources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } _rep_news_sources = (Anthem.Repeater) this.REP_News.Items[n].FindControl("REP_News_Sources"); _rep_news_sources.DataSource = _sources2; _rep_news_sources.DataBind(); _rep_news_sources.Visible = true; _show_Details = true; } #endregion #region _img_news = ...; #region SO_vNWS_Attachment _attachment = ...; SO_vNWS_Attachment _attachment; SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); #endregion if ( !this.Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return(arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment)); } ); _attachment = null; foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.IsImage) { _attachment = _attachment2; break; } } if (_attachment != null) { _img_news = (Anthem.Image) this.REP_News.Items[n].FindControl("IMG_News"); _img_news.ImageUrl = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); _img_news.Visible = true; } } #endregion _tr_details = (System.Web.UI.HtmlControls.HtmlTableRow) this.REP_News.Items[n].FindControl("TR_Details"); _tr_details.Visible = _show_Details; } } }
public void Bind() { int[] _errors; long _count; this.TBL_News.Visible = false; #region REP_News.DataSource = ...; REP_News.DataBind(); SO_vNWS_Content[] _news = BusinessInstances.NWS_News.InstanceClient.getRecord_generic( Utilities.User.SessionGuid, Utilities.ClientIPAddress, -1L, 0L, // 0: Approved; -1: NOT approved; < -1: ignore; >0: ... DateTime.MinValue, DateTime.MinValue, (this.IDTag <= 0) ? new long[] { } : new long[] { this.IDTag }, new long[] { }, (this.IDSource <= 0) ? new long[] { } : new long[] { this.IDSource }, new long[] { }, // ToDos: here! new long[] { }, "", Utilities.IDLanguage__default, true, 1, OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.PageNum, OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.ITEMSPERPAGE_DEFAULT, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_news != null) ) { if (_news.Length <= 0) { this.Master__base.Error_add(false, "no data"); // this.REP_News.Visible = false; return; } foreach (SO_vNWS_Content _content in _news) { _content.summary = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.summary); _content.Content = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.Content); } this.REP_News.DataSource = _news; this.REP_News.DataBind(); // this.REP_News.Visible = true; this.TBL_News.Visible = true; OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.Bind( _count, this.LBL_PageSeparator_left, this.LBL_PageSeparator_2, this.LBL_PageSeparator_3, this.LBL_PageSeparator_4, this.LBL_PageSeparator_right, this.LBL_PageSeparator_5, this.A_Page_1, this.A_Page_2, this.A_Page_3, this.A_Page_4, this.A_Page_5 ); } else { return; } #endregion #region REP_Tags.DataSource = ...; REP_Tags.DataBind(); SO_vNWS_Tag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( Utilities.User.SessionGuid, Utilities.ClientIPAddress, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_tags != null) && (_tags.Length > 0) ) { Array.Sort( _tags, delegate( SO_vNWS_Tag arg1_in, SO_vNWS_Tag arg2_in ) { return string.Compare( arg1_in.Name, arg2_in.Name, false, System.Globalization.CultureInfo.CurrentCulture ); } ); this.REP_Tags.DataSource = _tags; this.REP_Tags.DataBind(); } #endregion #region SO_vNWS_Source[] _sources = ...; SO_vNWS_Source[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( Utilities.User.SessionGuid, Utilities.ClientIPAddress, 0, 0, 0, out _count, out _errors ); this.Master__base.Error_add(_errors); #endregion // System.Web.UI.HtmlControls.HtmlTableRow _tr_ImageNews; Anthem.Image _img_news; Anthem.Repeater _rep_news_tags; Anthem.Repeater _rep_news_sources; for (int n = 0; n < _news.Length; n++) { #region _rep_news_tags.DataSource = ...; _rep_news_tags.DataBind(); if ( (_tags != null) && (_tags.Length > 0) ) { SO_NWS_ContentTag[] _content_tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_tags != null) && (_content_tags.Length > 0) ) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_content_tags.Length]; for (int t1 = 0; t1 < _content_tags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_content_tags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } _rep_news_tags = (Anthem.Repeater)this.REP_News.Items[n].FindControl("REP_News_Tags"); _rep_news_tags.DataSource = _tags2; _rep_news_tags.DataBind(); } } #endregion #region _rep_news_sources.DataSource = ...; _rep_news_sources.DataBind(); if ( (_sources != null) && (_sources.Length > 0) ) { SO_NWS_ContentSource[] _content_sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_sources != null) && (_content_sources.Length > 0) ) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_content_sources.Length]; for (int s1 = 0; s1 < _content_sources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_content_sources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } _rep_news_sources = (Anthem.Repeater)this.REP_News.Items[n].FindControl("REP_News_Sources"); _rep_news_sources.DataSource = _sources2; _rep_news_sources.DataBind(); _rep_news_sources.Visible = true; } } #endregion #region _img_news = ...; #region SO_vNWS_Attachment _attachment = ...; SO_vNWS_Attachment _attachment = null; SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment); } ); foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.IsImage) { _attachment = _attachment2; break; } } } #endregion _img_news = (Anthem.Image)this.REP_News.Items[n].FindControl("IMG_News"); // _tr_ImageNews = (System.Web.UI.HtmlControls.HtmlTableRow)REP_News.Items[n].FindControl("tr_ImageNews"); if (_attachment != null) { _img_news.ImageUrl = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); _img_news.Visible = true; // _tr_ImageNews.Visible = true; } else { _img_news.Visible = false; // _tr_ImageNews.Visible = false; } #endregion } }
public void Bind() { this.REP_Tags.Visible = false; this.REP_Sources.Visible = false; this.REP_Attachments.Visible = false; this.TR_Attachments1.Visible = false; this.TR_Details.Visible = false; this.TBL_News.Visible = false; if (this.IDNews <= 0) { return; } bool _showDetails = false; int[] _errors; long _count; SO_vNWS_Source[] _sources; SO_NWS_ContentSource[] _contentsources; SO_vNWS_Tag[] _tags; SO_NWS_ContentTag[] _contenttags; List <SO_vNWS_Attachment> _attachments_final; SO_vNWS_Attachment[] _attachments; SO_vNWS_Attachment _attachment; SO_vNWS_Content _content = BusinessInstances.NWS_News.InstanceClient.getObject( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDNews, Utilities.IDLanguage__default, out _errors ); if (!this.Master__base.Error_add(_errors)) { if (_content != null) { #region REP_Attachments.DataSource = ...; REP_Attachments.DataBind(); _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDNews, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return(arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment)); } ); #region _attachment = ...; _attachments_final = ...; _attachments_final = (_attachments.Length > 0) ? new List <SO_vNWS_Attachment>(_attachments.Length) : null; _attachment = null; int _image_count = 0; foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.IsImage) { _image_count++; if ( (_image_count != 0) && (_image_count <= 2) ) { _attachment = _attachment2; } } if ( !_attachment2.IsImage || (_image_count > 2) ) { // NOT image OR [ image BUT beyond the ones used for display ] _attachments_final.Add(_attachment2); } } #endregion #region this.IMG_News.ImageUrl = ...; if (_attachment != null) { this.IMG_News.ImageUrl = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); if ( !_attachment.Name_isNull && (!string.IsNullOrEmpty(_attachment.Name)) ) { this.LBL_Image_Name.Text = _attachment.Name; } if ( !_attachment.Description_isNull && (!string.IsNullOrEmpty(_attachment.Description)) ) { this.LBL_Image_Description.Text = string.Format( System.Globalization.CultureInfo.CurrentCulture, "({0})", _attachment.Description ); } } #endregion #region REP_Attachments... if ( (_attachments_final != null) && (_attachments_final.Count > 0) ) { this.REP_Attachments.DataSource = _attachments_final; this.REP_Attachments.DataBind(); this.REP_Attachments.Visible = true; this.TR_Attachments1.Visible = true; } #endregion } #endregion #region REP_Sources.DataSource = ...; REP_Sources.DataBind(); _contentsources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDNews, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_contentsources != null) && (_contentsources.Length > 0) ) { _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( Utilities.User.SessionGuid, Utilities.ClientIPAddress, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_contentsources.Length]; for (int s1 = 0; s1 < _contentsources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_contentsources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } this.REP_Sources.DataSource = _sources2; this.REP_Sources.DataBind(); this.REP_Sources.Visible = true; _showDetails = true; } } #endregion #region REP_Tags.DataSource = ...; REP_Tags.DataBind(); _contenttags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDNews, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_contenttags != null) && (_contenttags.Length > 0) ) { _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( Utilities.User.SessionGuid, Utilities.ClientIPAddress, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_contenttags.Length]; for (int t1 = 0; t1 < _contenttags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_contenttags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } this.REP_Tags.DataSource = _tags2; this.REP_Tags.DataBind(); this.REP_Tags.Visible = true; _showDetails = true; } } #endregion this.TR_Details.Visible = _showDetails; this.LBL_Publish_date.Text = string.Format( System.Globalization.CultureInfo.CurrentCulture, "{0}.{1}.{2} | {3}h{4}", _content.Publish_date.Day.ToString(System.Globalization.CultureInfo.CurrentCulture).PadLeft(2, '0'), _content.Publish_date.Month.ToString(System.Globalization.CultureInfo.CurrentCulture).PadLeft(2, '0'), _content.Publish_date.Year, _content.Publish_date.Hour.ToString(System.Globalization.CultureInfo.CurrentCulture).PadLeft(2, '0'), _content.Publish_date.Minute.ToString(System.Globalization.CultureInfo.CurrentCulture).PadLeft(2, '0') ); this.LBL_Title.Text = _content.Title; this.LBL_Content.Text = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.Content); this.TBL_News.Visible = true; } else { this.Master__base.Error_add(false, "no data"); } } }
public void Bind() { int[] _errors; long _count; this.TBL_News.Visible = false; #region REP_News.DataSource = ...; REP_News.DataBind(); SO_vNWS_Content[] _news = BusinessInstances.NWS_News.InstanceClient.getRecord_generic( Utilities.User.SessionGuid, Utilities.ClientIPAddress, -1L, 0L, // 0: Approved; -1: NOT approved; < -1: ignore; >0: ... DateTime.MinValue, DateTime.MinValue, (this.IDTag <= 0) ? new long[] { } : new long[] { this.IDTag }, new long[] { }, (this.IDSource <= 0) ? new long[] { } : new long[] { this.IDSource }, new long[] { }, // ToDos: here! new long[] { }, "", Utilities.IDLanguage__default, true, 1, OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.PageNum, OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.ITEMSPERPAGE_DEFAULT, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_news != null) ) { if (_news.Length <= 0) { this.Master__base.Error_add(false, "no data"); // this.REP_News.Visible = false; return; } foreach (SO_vNWS_Content _content in _news) { _content.summary = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.summary); _content.Content = OGen.Libraries.PresentationLayer.WebForms.Utilities.Replace_RN_BR(_content.Content); } this.REP_News.DataSource = _news; this.REP_News.DataBind(); // this.REP_News.Visible = true; this.TBL_News.Visible = true; OGen.Libraries.PresentationLayer.WebForms.Utilities.Pager.Bind( _count, this.LBL_PageSeparator_left, this.LBL_PageSeparator_2, this.LBL_PageSeparator_3, this.LBL_PageSeparator_4, this.LBL_PageSeparator_right, this.LBL_PageSeparator_5, this.A_Page_1, this.A_Page_2, this.A_Page_3, this.A_Page_4, this.A_Page_5 ); } else { return; } #endregion #region REP_Tags.DataSource = ...; REP_Tags.DataBind(); SO_vNWS_Tag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( Utilities.User.SessionGuid, Utilities.ClientIPAddress, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_tags != null) && (_tags.Length > 0) ) { Array.Sort( _tags, delegate( SO_vNWS_Tag arg1_in, SO_vNWS_Tag arg2_in ) { return(string.Compare( arg1_in.Name, arg2_in.Name, false, System.Globalization.CultureInfo.CurrentCulture )); } ); this.REP_Tags.DataSource = _tags; this.REP_Tags.DataBind(); } #endregion #region SO_vNWS_Source[] _sources = ...; SO_vNWS_Source[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( Utilities.User.SessionGuid, Utilities.ClientIPAddress, 0, 0, 0, out _count, out _errors ); this.Master__base.Error_add(_errors); #endregion // System.Web.UI.HtmlControls.HtmlTableRow _tr_ImageNews; Anthem.Image _img_news; Anthem.Repeater _rep_news_tags; Anthem.Repeater _rep_news_sources; for (int n = 0; n < _news.Length; n++) { #region _rep_news_tags.DataSource = ...; _rep_news_tags.DataBind(); if ( (_tags != null) && (_tags.Length > 0) ) { SO_NWS_ContentTag[] _content_tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_tags != null) && (_content_tags.Length > 0) ) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_content_tags.Length]; for (int t1 = 0; t1 < _content_tags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_content_tags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } _rep_news_tags = (Anthem.Repeater) this.REP_News.Items[n].FindControl("REP_News_Tags"); _rep_news_tags.DataSource = _tags2; _rep_news_tags.DataBind(); } } #endregion #region _rep_news_sources.DataSource = ...; _rep_news_sources.DataBind(); if ( (_sources != null) && (_sources.Length > 0) ) { SO_NWS_ContentSource[] _content_sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_content_sources != null) && (_content_sources.Length > 0) ) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_content_sources.Length]; for (int s1 = 0; s1 < _content_sources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_content_sources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } _rep_news_sources = (Anthem.Repeater) this.REP_News.Items[n].FindControl("REP_News_Sources"); _rep_news_sources.DataSource = _sources2; _rep_news_sources.DataBind(); _rep_news_sources.Visible = true; } } #endregion #region _img_news = ...; #region SO_vNWS_Attachment _attachment = ...; SO_vNWS_Attachment _attachment = null; SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( Utilities.User.SessionGuid, Utilities.ClientIPAddress, _news[n].IDContent, Utilities.IDLanguage__default, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return(arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment)); } ); foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.IsImage) { _attachment = _attachment2; break; } } } #endregion _img_news = (Anthem.Image) this.REP_News.Items[n].FindControl("IMG_News"); // _tr_ImageNews = (System.Web.UI.HtmlControls.HtmlTableRow)REP_News.Items[n].FindControl("tr_ImageNews"); if (_attachment != null) { _img_news.ImageUrl = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); _img_news.Visible = true; // _tr_ImageNews.Visible = true; } else { _img_news.Visible = false; // _tr_ImageNews.Visible = false; } #endregion } }
/// <summary> /// Selects vNWS_Tag values from Database (based on the search condition) and assigns them to the appropriate DO0_vNWS_Tag property. /// </summary> /// <param name="IDTag_search_in">IDTag search condition</param> /// <param name="IDLanguage_search_in">IDLanguage search condition</param> /// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param> /// <returns>null if vNWS_Tag doesn't exists at Database</returns> public static SO_vNWS_Tag getObject_byTag_andL( long IDTag_search_in, int IDLanguage_search_in, DBConnection dbConnection_in ) { SO_vNWS_Tag _output = null; DBConnection _connection = (dbConnection_in == null) ? DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDTag_search_", DbType.Int64, ParameterDirection.Input, IDTag_search_in, 0), _connection.newDBDataParameter("IDLanguage_search_", DbType.Int32, ParameterDirection.Input, IDLanguage_search_in, 0), _connection.newDBDataParameter("IDTag", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IDLanguage", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFTag__parent", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFUser__Approved", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Approved_date", DbType.DateTime, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Name", DbType.AnsiString, ParameterDirection.Output, null, 8000), _connection.newDBDataParameter("IFApplication", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("ManagerName", DbType.AnsiString, ParameterDirection.Output, null, 255), _connection.newDBDataParameter("ShortName", DbType.AnsiString, ParameterDirection.Output, null, 0) }; _connection.Execute_SQLFunction( "sp0_vNWS_Tag_getObject_byTag_andL", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[2].Value != DBNull.Value) { _output = new SO_vNWS_Tag(); if (_dataparameters[2].Value == System.DBNull.Value) { _output.IDTag = 0L; } else { _output.IDTag = (long)_dataparameters[2].Value; } if (_dataparameters[3].Value == System.DBNull.Value) { _output.IDLanguage = 0; } else { _output.IDLanguage = (int)_dataparameters[3].Value; } if (_dataparameters[4].Value == System.DBNull.Value) { _output.IFTag__parent_isNull = true; } else { _output.IFTag__parent = (long)_dataparameters[4].Value; } if (_dataparameters[5].Value == System.DBNull.Value) { _output.IFUser__Approved_isNull = true; } else { _output.IFUser__Approved = (long)_dataparameters[5].Value; } if (_dataparameters[6].Value == System.DBNull.Value) { _output.Approved_date_isNull = true; } else { _output.Approved_date = (DateTime)_dataparameters[6].Value; } if (_dataparameters[7].Value == System.DBNull.Value) { _output.Name_isNull = true; } else { _output.Name = (string)_dataparameters[7].Value; } if (_dataparameters[8].Value == System.DBNull.Value) { _output.IFApplication_isNull = true; } else { _output.IFApplication = (int)_dataparameters[8].Value; } if (_dataparameters[9].Value == System.DBNull.Value) { _output.ManagerName_isNull = true; } else { _output.ManagerName = (string)_dataparameters[9].Value; } if (_dataparameters[10].Value == System.DBNull.Value) { _output.ShortName_isNull = true; } else { _output.ShortName = (string)_dataparameters[10].Value; } return(_output); } return(null); }
private static SO_vNWS_Tag[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idtag = null; DataColumn _dc_idlanguage = null; DataColumn _dc_iftag__parent = null; DataColumn _dc_ifuser__approved = null; DataColumn _dc_approved_date = null; DataColumn _dc_name = null; DataColumn _dc_ifapplication = null; DataColumn _dc_managername = null; DataColumn _dc_shortname = null; SO_vNWS_Tag[] _output = new SO_vNWS_Tag[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idtag = dataTable_in.Columns["IDTag"]; _dc_idlanguage = dataTable_in.Columns["IDLanguage"]; _dc_iftag__parent = dataTable_in.Columns["IFTag__parent"]; _dc_ifuser__approved = dataTable_in.Columns["IFUser__Approved"]; _dc_approved_date = dataTable_in.Columns["Approved_date"]; _dc_name = dataTable_in.Columns["Name"]; _dc_ifapplication = dataTable_in.Columns["IFApplication"]; _dc_managername = dataTable_in.Columns["ManagerName"]; _dc_shortname = dataTable_in.Columns["ShortName"]; } _output[r] = new SO_vNWS_Tag(); if (dataTable_in.Rows[r][_dc_idtag] == System.DBNull.Value) { _output[r].IDTag = 0L; } else { _output[r].IDTag = (long)dataTable_in.Rows[r][_dc_idtag]; } if (dataTable_in.Rows[r][_dc_idlanguage] == System.DBNull.Value) { _output[r].IDLanguage = 0; } else { _output[r].IDLanguage = (int)dataTable_in.Rows[r][_dc_idlanguage]; } if (dataTable_in.Rows[r][_dc_iftag__parent] == System.DBNull.Value) { _output[r].IFTag__parent_isNull = true; } else { _output[r].IFTag__parent = (long)dataTable_in.Rows[r][_dc_iftag__parent]; } if (dataTable_in.Rows[r][_dc_ifuser__approved] == System.DBNull.Value) { _output[r].IFUser__Approved_isNull = true; } else { _output[r].IFUser__Approved = (long)dataTable_in.Rows[r][_dc_ifuser__approved]; } if (dataTable_in.Rows[r][_dc_approved_date] == System.DBNull.Value) { _output[r].Approved_date_isNull = true; } else { _output[r].Approved_date = (DateTime)dataTable_in.Rows[r][_dc_approved_date]; } if (dataTable_in.Rows[r][_dc_name] == System.DBNull.Value) { _output[r].Name_isNull = true; } else { _output[r].Name = (string)dataTable_in.Rows[r][_dc_name]; } if (dataTable_in.Rows[r][_dc_ifapplication] == System.DBNull.Value) { _output[r].IFApplication_isNull = true; } else { _output[r].IFApplication = (int)dataTable_in.Rows[r][_dc_ifapplication]; } if (dataTable_in.Rows[r][_dc_managername] == System.DBNull.Value) { _output[r].ManagerName_isNull = true; } else { _output[r].ManagerName = (string)dataTable_in.Rows[r][_dc_managername]; } if (dataTable_in.Rows[r][_dc_shortname] == System.DBNull.Value) { _output[r].ShortName_isNull = true; } else { _output[r].ShortName = (string)dataTable_in.Rows[r][_dc_shortname]; } _output[r].HasChanges = false; } return(_output); }
public void Bind() { int[] _errors; tbl_News.Visible = false; #region rep_News.DataSource = ...; rep_News.DataBind(); SO_vNWS_Content[] _news = BusinessInstances.NWS_News.InstanceClient.getRecord_generic( utils.User.SessionGuid, utils.ClientIPAddress, -1L, 0L, // 0: Approved; -1: NOT approved; < -1: ignore; >0: ... DateTime.MinValue, DateTime.MinValue, (IDTag <= 0) ? new long[] { } : new long[] { IDTag }, new long[] { }, (IDSource <= 0) ? new long[] { } : new long[] { IDSource }, new long[] { }, // ToDos: here! new long[] { }, "", utils.IDLanguage__default, true, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_news != null) ) { if (_news.Length <= 0) { Master__base.Error_add(false, "no data"); // rep_News.Visible = false; return; } Array.Sort( _news, delegate( SO_vNWS_Content arg1_in, SO_vNWS_Content arg2_in ) { return arg2_in.Publish_date.CompareTo(arg1_in.Publish_date); } ); foreach (SO_vNWS_Content _content in _news) { _content.summary = OGen.lib.presentationlayer.webforms.utils.Replace_RN_BR(_content.summary); _content.Content = OGen.lib.presentationlayer.webforms.utils.Replace_RN_BR(_content.Content); } rep_News.DataSource = _news; rep_News.DataBind(); // rep_News.Visible = true; tbl_News.Visible = true; } else { return; } #endregion #region rep_Tags.DataSource = ...; rep_Tags.DataBind(); SO_vNWS_Tag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_Approved_byLang( utils.User.SessionGuid, utils.ClientIPAddress, utils.IDLanguage__default, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_tags != null) && (_tags.Length > 0) ) { Array.Sort( _tags, delegate( SO_vNWS_Tag arg1_in, SO_vNWS_Tag arg2_in ) { return arg1_in.Name.CompareTo(arg2_in.Name); } ); rep_Tags.DataSource = _tags; rep_Tags.DataBind(); } #endregion #region SO_vNWS_Source[] _sources = ...; SO_vNWS_Source[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_Approved( utils.User.SessionGuid, utils.ClientIPAddress, 0, 0, out _errors ); Master__base.Error_add(_errors); #endregion // System.Web.UI.HtmlControls.HtmlTableRow _tr_ImageNews; Anthem.Image _img_News; Anthem.Repeater _rep_News_Tags; Anthem.Repeater _rep_News_Sources; for (int n = 0; n < _news.Length; n++) { #region _rep_News_Tags.DataSource = ...; _rep_News_Tags.DataBind(); if ( (_tags != null) && (_tags.Length > 0) ) { SO_NWS_ContentTag[] _content_tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( utils.User.SessionGuid, utils.ClientIPAddress, _news[n].IDContent, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_content_tags != null) && (_content_tags.Length > 0) ) { SO_vNWS_Tag[] _tags2 = new SO_vNWS_Tag[_content_tags.Length]; for (int t1 = 0; t1 < _content_tags.Length; t1++) { for (int t2 = 0; t2 < _tags.Length; t2++) { if (_content_tags[t1].IFTag == _tags[t2].IDTag) { _tags2[t1] = _tags[t2]; break; } } } _rep_News_Tags = (Anthem.Repeater)rep_News.Items[n].FindControl("rep_News_Tags"); _rep_News_Tags.DataSource = _tags2; _rep_News_Tags.DataBind(); } } #endregion #region _rep_News_Sources.DataSource = ...; _rep_News_Sources.DataBind(); if ( (_sources != null) && (_sources.Length > 0) ) { SO_NWS_ContentSource[] _content_sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( utils.User.SessionGuid, utils.ClientIPAddress, _news[n].IDContent, 0, 0, out _errors ); if ( !Master__base.Error_add(_errors) && (_content_sources != null) && (_content_sources.Length > 0) ) { SO_vNWS_Source[] _sources2 = new SO_vNWS_Source[_content_sources.Length]; for (int s1 = 0; s1 < _content_sources.Length; s1++) { for (int s2 = 0; s2 < _sources.Length; s2++) { if (_content_sources[s1].IFSource == _sources[s2].IDSource) { _sources2[s1] = _sources[s2]; break; } } } _rep_News_Sources = (Anthem.Repeater)rep_News.Items[n].FindControl("rep_News_Sources"); _rep_News_Sources.DataSource = _sources2; _rep_News_Sources.DataBind(); _rep_News_Sources.Visible = true; } } #endregion #region _img_News = ...; #region SO_vNWS_Attachment _attachment = ...; SO_vNWS_Attachment _attachment = null; SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent_andLanguage( utils.User.SessionGuid, utils.ClientIPAddress, _news[n].IDContent, utils.IDLanguage__default, out _errors ); if ( !Master__base.Error_add(_errors) && (_attachments != null) && (_attachments.Length > 0) ) { Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { return arg1_in.IDAttachment.CompareTo(arg2_in.IDAttachment); } ); foreach (SO_vNWS_Attachment _attachment2 in _attachments) { if (_attachment2.isImage) { _attachment = _attachment2; break; } } } #endregion _img_News = (Anthem.Image)rep_News.Items[n].FindControl("img_News"); // _tr_ImageNews = (System.Web.UI.HtmlControls.HtmlTableRow)rep_News.Items[n].FindControl("tr_ImageNews"); if (_attachment != null) { _img_News.ImageUrl = string.Format( "~/public-uploads/news/{0}/{1}-{2}/{3}", _attachment.IFContent, _attachment.IDAttachment, _attachment.GUID, _attachment.FileName ); _img_News.Visible = true; // _tr_ImageNews.Visible = true; } else { _img_News.Visible = false; // _tr_ImageNews.Visible = false; } #endregion } }
/// <summary> /// Selects vNWS_Tag values from Database (based on the search condition) and assigns them to the appropriate DO0_vNWS_Tag property. /// </summary> /// <param name="IDTag_search_in">IDTag search condition</param> /// <param name="IDLanguage_search_in">IDLanguage search condition</param> /// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param> /// <returns>null if vNWS_Tag doesn't exists at Database</returns> public static SO_vNWS_Tag getObject_byTag_andL( long IDTag_search_in, int IDLanguage_search_in, DBConnection dbConnection_in ) { SO_vNWS_Tag _output = null; DBConnection _connection = (dbConnection_in == null) ? DO__Utilities.DBConnection_createInstance( DO__Utilities.DBServerType, DO__Utilities.DBConnectionstring, DO__Utilities.DBLogfile ) : dbConnection_in; IDbDataParameter[] _dataparameters = new IDbDataParameter[] { _connection.newDBDataParameter("IDTag_search_", DbType.Int64, ParameterDirection.Input, IDTag_search_in, 0), _connection.newDBDataParameter("IDLanguage_search_", DbType.Int32, ParameterDirection.Input, IDLanguage_search_in, 0), _connection.newDBDataParameter("IDTag", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IDLanguage", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFTag__parent", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("IFUser__Approved", DbType.Int64, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Approved_date", DbType.DateTime, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("Name", DbType.AnsiString, ParameterDirection.Output, null, 8000), _connection.newDBDataParameter("IFApplication", DbType.Int32, ParameterDirection.Output, null, 0), _connection.newDBDataParameter("ManagerName", DbType.AnsiString, ParameterDirection.Output, null, 255), _connection.newDBDataParameter("ShortName", DbType.AnsiString, ParameterDirection.Output, null, 0) }; _connection.Execute_SQLFunction( "sp0_vNWS_Tag_getObject_byTag_andL", _dataparameters ); if (dbConnection_in == null) { _connection.Dispose(); } if (_dataparameters[2].Value != DBNull.Value) { _output = new SO_vNWS_Tag(); if (_dataparameters[2].Value == System.DBNull.Value) { _output.IDTag = 0L; } else { _output.IDTag = (long)_dataparameters[2].Value; } if (_dataparameters[3].Value == System.DBNull.Value) { _output.IDLanguage = 0; } else { _output.IDLanguage = (int)_dataparameters[3].Value; } if (_dataparameters[4].Value == System.DBNull.Value) { _output.IFTag__parent_isNull = true; } else { _output.IFTag__parent = (long)_dataparameters[4].Value; } if (_dataparameters[5].Value == System.DBNull.Value) { _output.IFUser__Approved_isNull = true; } else { _output.IFUser__Approved = (long)_dataparameters[5].Value; } if (_dataparameters[6].Value == System.DBNull.Value) { _output.Approved_date_isNull = true; } else { _output.Approved_date = (DateTime)_dataparameters[6].Value; } if (_dataparameters[7].Value == System.DBNull.Value) { _output.Name_isNull = true; } else { _output.Name = (string)_dataparameters[7].Value; } if (_dataparameters[8].Value == System.DBNull.Value) { _output.IFApplication_isNull = true; } else { _output.IFApplication = (int)_dataparameters[8].Value; } if (_dataparameters[9].Value == System.DBNull.Value) { _output.ManagerName_isNull = true; } else { _output.ManagerName = (string)_dataparameters[9].Value; } if (_dataparameters[10].Value == System.DBNull.Value) { _output.ShortName_isNull = true; } else { _output.ShortName = (string)_dataparameters[10].Value; } return _output; } return null; }
private static SO_vNWS_Tag[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idtag = null; DataColumn _dc_idlanguage = null; DataColumn _dc_iftag__parent = null; DataColumn _dc_ifuser__approved = null; DataColumn _dc_approved_date = null; DataColumn _dc_name = null; DataColumn _dc_ifapplication = null; DataColumn _dc_managername = null; DataColumn _dc_shortname = null; SO_vNWS_Tag[] _output = new SO_vNWS_Tag[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idtag = dataTable_in.Columns["IDTag"]; _dc_idlanguage = dataTable_in.Columns["IDLanguage"]; _dc_iftag__parent = dataTable_in.Columns["IFTag__parent"]; _dc_ifuser__approved = dataTable_in.Columns["IFUser__Approved"]; _dc_approved_date = dataTable_in.Columns["Approved_date"]; _dc_name = dataTable_in.Columns["Name"]; _dc_ifapplication = dataTable_in.Columns["IFApplication"]; _dc_managername = dataTable_in.Columns["ManagerName"]; _dc_shortname = dataTable_in.Columns["ShortName"]; } _output[r] = new SO_vNWS_Tag(); if (dataTable_in.Rows[r][_dc_idtag] == System.DBNull.Value) { _output[r].IDTag = 0L; } else { _output[r].IDTag = (long)dataTable_in.Rows[r][_dc_idtag]; } if (dataTable_in.Rows[r][_dc_idlanguage] == System.DBNull.Value) { _output[r].IDLanguage = 0; } else { _output[r].IDLanguage = (int)dataTable_in.Rows[r][_dc_idlanguage]; } if (dataTable_in.Rows[r][_dc_iftag__parent] == System.DBNull.Value) { _output[r].IFTag__parent_isNull = true; } else { _output[r].IFTag__parent = (long)dataTable_in.Rows[r][_dc_iftag__parent]; } if (dataTable_in.Rows[r][_dc_ifuser__approved] == System.DBNull.Value) { _output[r].IFUser__Approved_isNull = true; } else { _output[r].IFUser__Approved = (long)dataTable_in.Rows[r][_dc_ifuser__approved]; } if (dataTable_in.Rows[r][_dc_approved_date] == System.DBNull.Value) { _output[r].Approved_date_isNull = true; } else { _output[r].Approved_date = (DateTime)dataTable_in.Rows[r][_dc_approved_date]; } if (dataTable_in.Rows[r][_dc_name] == System.DBNull.Value) { _output[r].Name_isNull = true; } else { _output[r].Name = (string)dataTable_in.Rows[r][_dc_name]; } if (dataTable_in.Rows[r][_dc_ifapplication] == System.DBNull.Value) { _output[r].IFApplication_isNull = true; } else { _output[r].IFApplication = (int)dataTable_in.Rows[r][_dc_ifapplication]; } if (dataTable_in.Rows[r][_dc_managername] == System.DBNull.Value) { _output[r].ManagerName_isNull = true; } else { _output[r].ManagerName = (string)dataTable_in.Rows[r][_dc_managername]; } if (dataTable_in.Rows[r][_dc_shortname] == System.DBNull.Value) { _output[r].ShortName_isNull = true; } else { _output[r].ShortName = (string)dataTable_in.Rows[r][_dc_shortname]; } _output[r].HasChanges = false; } return _output; }