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 } }
private static SO_vNWS_Attachment[] getRecord( DataTable dataTable_in ) { DataColumn _dc_idattachment = null; DataColumn _dc_idlanguage = null; DataColumn _dc_ifcontent = null; DataColumn _dc_guid = null; DataColumn _dc_order = null; DataColumn _dc_isimage = null; DataColumn _dc_name = null; DataColumn _dc_description = null; DataColumn _dc_filename = null; SO_vNWS_Attachment[] _output = new SO_vNWS_Attachment[dataTable_in.Rows.Count]; for (int r = 0; r < dataTable_in.Rows.Count; r++) { if (r == 0) { _dc_idattachment = dataTable_in.Columns["IDAttachment"]; _dc_idlanguage = dataTable_in.Columns["IDLanguage"]; _dc_ifcontent = dataTable_in.Columns["IFContent"]; _dc_guid = dataTable_in.Columns["GUID"]; _dc_order = dataTable_in.Columns["Order"]; _dc_isimage = dataTable_in.Columns["IsImage"]; _dc_name = dataTable_in.Columns["Name"]; _dc_description = dataTable_in.Columns["Description"]; _dc_filename = dataTable_in.Columns["FileName"]; } _output[r] = new SO_vNWS_Attachment(); if (dataTable_in.Rows[r][_dc_idattachment] == System.DBNull.Value) { _output[r].IDAttachment = 0L; } else { _output[r].IDAttachment = (long)dataTable_in.Rows[r][_dc_idattachment]; } 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_ifcontent] == System.DBNull.Value) { _output[r].IFContent = 0L; } else { _output[r].IFContent = (long)dataTable_in.Rows[r][_dc_ifcontent]; } if (dataTable_in.Rows[r][_dc_guid] == System.DBNull.Value) { _output[r].GUID = string.Empty; } else { _output[r].GUID = (string)dataTable_in.Rows[r][_dc_guid]; } if (dataTable_in.Rows[r][_dc_order] == System.DBNull.Value) { _output[r].Order_isNull = true; } else { _output[r].Order = (long)dataTable_in.Rows[r][_dc_order]; } if (dataTable_in.Rows[r][_dc_isimage] == System.DBNull.Value) { _output[r].IsImage = false; } else { _output[r].IsImage = (bool)dataTable_in.Rows[r][_dc_isimage]; } 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_description] == System.DBNull.Value) { _output[r].Description_isNull = true; } else { _output[r].Description = (string)dataTable_in.Rows[r][_dc_description]; } if (dataTable_in.Rows[r][_dc_filename] == System.DBNull.Value) { _output[r].FileName = string.Empty; } else { _output[r].FileName = (string)dataTable_in.Rows[r][_dc_filename]; } _output[r].HasChanges = false; } return(_output); }
public void Bind( ) { int[] _errors; long _count; if (this.IDContent > 0) { SO_vNWS_Content[] _contents = BusinessInstances.NWS_News.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if ( !this.Master__base.Error_add(_errors) && (_contents != null) && (_contents.Length != 0) ) { #region Bind . . . #if !DEBUG this.DIV_Attachments.Visible = true; this.DIV_Tags.Visible = true; this.DIV_Authors.Visible = true; this.DIV_Sources.Visible = true; this.DIV_Highlights.Visible = true; this.DIV_Profiles.Visible = true; #endif #region Content . . . List <SO_DIC__TextLanguage> _title = new List <SO_DIC__TextLanguage>( _contents.Length ); List <SO_DIC__TextLanguage> _subtitle = new List <SO_DIC__TextLanguage>( _contents.Length ); List <SO_DIC__TextLanguage> _news = new List <SO_DIC__TextLanguage>( _contents.Length ); List <SO_DIC__TextLanguage> _summary = new List <SO_DIC__TextLanguage>( _contents.Length ); foreach (SO_vNWS_Content _content in _contents) { _title.Add(new SO_DIC__TextLanguage( _content.IDLanguage, _content.Title )); _subtitle.Add(new SO_DIC__TextLanguage( _content.IDLanguage, _content.subtitle )); _news.Add(new SO_DIC__TextLanguage( _content.IDLanguage, _content.Content )); _summary.Add(new SO_DIC__TextLanguage( _content.IDLanguage, _content.summary )); } this.DIC_Title.Texts = _title.ToArray(); this.DIC_Subtitle.Texts = _subtitle.ToArray(); this.DIC_News.Texts = _news.ToArray(); this.DIC_Summary.Texts = _summary.ToArray(); #endregion #region this.CBL_Tags.Kick.SelectedValues__set_arrayOf<SO_NWS_ContentTag>(...); SO_NWS_ContentTag[] _tags = BusinessInstances.NWS_Tag.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { this.CBL_Tags.Kick.SelectedValues__set_arrayOf <SO_NWS_ContentTag>( _tags, delegate( SO_NWS_ContentTag arg1_in ) { return(arg1_in.IFTag.ToString(System.Globalization.CultureInfo.CurrentCulture)); } ); } #endregion #region this.CBL_Author.Kick.SelectedValues__set_arrayOf<SO_NWS_ContentAuthor>(...); SO_NWS_ContentAuthor[] _authors = BusinessInstances.NWS_Author.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { this.CBL_Author.Kick.SelectedValues__set_arrayOf <SO_NWS_ContentAuthor>( _authors, delegate( SO_NWS_ContentAuthor arg1_in ) { return(arg1_in.IFAuthor.ToString(System.Globalization.CultureInfo.CurrentCulture)); } ); } #endregion #region this.CBL_Source.Kick.SelectedValues__set_arrayOf<SO_NWS_ContentSource>(...); SO_NWS_ContentSource[] _sources = BusinessInstances.NWS_Source.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { this.CBL_Source.Kick.SelectedValues__set_arrayOf <SO_NWS_ContentSource>( _sources, delegate( SO_NWS_ContentSource arg1_in ) { return(arg1_in.IFSource.ToString(System.Globalization.CultureInfo.CurrentCulture)); } ); } #endregion #region this.CBL_Profile.Kick.SelectedValues__set_arrayOf<SO_NWS_ContentProfile>(...); SO_NWS_ContentProfile[] _profiles = BusinessInstances.NWS_Profile.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { this.CBL_Profiles.Kick.SelectedValues__set_arrayOf <SO_NWS_ContentProfile>( _profiles, delegate( SO_NWS_ContentProfile arg1_in ) { return(arg1_in.IFProfile.ToString(System.Globalization.CultureInfo.CurrentCulture)); } ); } #endregion #region this.CBL_Highlight.Kick.SelectedValues__set_arrayOf<SO_NWS_ContentHighlight>(...); SO_NWS_ContentHighlight[] _highlights = BusinessInstances.NWS_Highlight.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { this.CBL_Highlight.Kick.SelectedValues__set_arrayOf <SO_NWS_ContentHighlight>( _highlights, delegate( SO_NWS_ContentHighlight arg1_in ) { return(arg1_in.IFHighlight.ToString(System.Globalization.CultureInfo.CurrentCulture)); } ); } #endregion #region Attachments . . . SO_vNWS_Attachment[] _attachments = BusinessInstances.NWS_Attachment.InstanceClient.getRecord_byContent( Utilities.User.SessionGuid, Utilities.ClientIPAddress, this.IDContent, 0, 0, 0, out _count, out _errors ); if (!this.Master__base.Error_add(_errors)) { #region Array.Sort(_attachments); Array.Sort( _attachments, delegate( SO_vNWS_Attachment arg1_in, SO_vNWS_Attachment arg2_in ) { if (arg1_in.Order_isNull && !arg2_in.Order_isNull) { return(1); } if (!arg1_in.Order_isNull && arg2_in.Order_isNull) { return(-1); } if ( arg1_in.Order_isNull || arg2_in.Order_isNull ) { return(string.Compare( arg1_in.Name, arg2_in.Name, false, System.Globalization.CultureInfo.CurrentCulture )); } else { return(arg1_in.Order.CompareTo(arg2_in.Order)); } } ); #endregion Dictionary <long, SO_vNWS_Attachment> _dic_attachments_only = new Dictionary <long, SO_vNWS_Attachment>( _attachments.Length ); foreach (SO_vNWS_Attachment _attachment in _attachments) { if (!_dic_attachments_only.ContainsKey(_attachment.IDAttachment)) { _dic_attachments_only.Add( _attachment.IDAttachment, _attachment ); } } #region SO_vNWS_Attachment[] _attachments_only; _dic_attachments_only.Values.CopyTo(_attachments_only); SO_vNWS_Attachment[] _attachments_only = new SO_vNWS_Attachment[ _dic_attachments_only.Keys.Count ]; _dic_attachments_only.Values.CopyTo( _attachments_only, 0 ); #endregion this.REP_Attachments.DataSource = _attachments_only; this.REP_Attachments.DataBind(); System.Web.UI.HtmlControls.HtmlAnchor _a_attachment; System.Web.UI.HtmlControls.HtmlImage _img_attachment; wuc_txt_Dic _dic_name; wuc_txt_Dic _dic_description; List <SO_DIC__TextLanguage> _attachment_name; List <SO_DIC__TextLanguage> _attachment_description; for (int i = 0; i < this.REP_Attachments.Items.Count; i++) { _dic_name = (wuc_txt_Dic)this.REP_Attachments.Items[i].FindControl("DIC_Name"); _dic_description = (wuc_txt_Dic)this.REP_Attachments.Items[i].FindControl("dic_Description"); _a_attachment = (System.Web.UI.HtmlControls.HtmlAnchor) this.REP_Attachments.Items[i].FindControl("a_Attachment"); _img_attachment = (System.Web.UI.HtmlControls.HtmlImage) this.REP_Attachments.Items[i].FindControl("img_Attachment"); _img_attachment.Src = _a_attachment.HRef = string.Format( System.Globalization.CultureInfo.CurrentCulture, "~/{0}/news/{1}/{2}-{3}/{4}", PUBLIC_UPLOADS, _attachments_only[i].IFContent, _attachments_only[i].IDAttachment, _attachments_only[i].GUID, _attachments_only[i].FileName ); #region _dic_???.Texts = ...; _attachment_name = new List <SO_DIC__TextLanguage>( _attachments.Length ); _attachment_description = new List <SO_DIC__TextLanguage>( _attachments.Length ); foreach (SO_vNWS_Attachment _attachment in _attachments) { if (_attachment.IDAttachment == _attachments_only[i].IDAttachment) { _attachment_name.Add(new SO_DIC__TextLanguage( _attachment.IDLanguage, _attachment.Name )); _attachment_description.Add(new SO_DIC__TextLanguage( _attachment.IDLanguage, _attachment.Description )); } } _dic_name.Texts = _attachment_name.ToArray(); _dic_description.Texts = _attachment_description.ToArray(); #endregion } } #endregion #endregion return; } } this.Bind_empty(); }