Exemple #1
0
		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();
		}
Exemple #2
0
		public static DataTable getDataTable(
			SO_vNWS_Attachment[] serializableObjects_in
		) {
			DataTable _output = new DataTable();
			_output.Locale = System.Globalization.CultureInfo.CurrentCulture;
			DataRow _dr;

			DataColumn _dc_idattachment = new DataColumn("IDAttachment", typeof(long));
			_output.Columns.Add(_dc_idattachment);
			DataColumn _dc_idlanguage = new DataColumn("IDLanguage", typeof(int));
			_output.Columns.Add(_dc_idlanguage);
			DataColumn _dc_ifcontent = new DataColumn("IFContent", typeof(long));
			_output.Columns.Add(_dc_ifcontent);
			DataColumn _dc_guid = new DataColumn("GUID", typeof(string));
			_output.Columns.Add(_dc_guid);
			DataColumn _dc_order = new DataColumn("Order", typeof(long));
			_output.Columns.Add(_dc_order);
			DataColumn _dc_isimage = new DataColumn("IsImage", typeof(bool));
			_output.Columns.Add(_dc_isimage);
			DataColumn _dc_name = new DataColumn("Name", typeof(string));
			_output.Columns.Add(_dc_name);
			DataColumn _dc_description = new DataColumn("Description", typeof(string));
			_output.Columns.Add(_dc_description);
			DataColumn _dc_filename = new DataColumn("FileName", typeof(string));
			_output.Columns.Add(_dc_filename);

			foreach (SO_vNWS_Attachment _serializableObject in serializableObjects_in) {
				_dr = _output.NewRow();

				_dr[_dc_idattachment] = _serializableObject.IDAttachment;
				_dr[_dc_idlanguage] = _serializableObject.IDLanguage;
				_dr[_dc_ifcontent] = _serializableObject.IFContent;
				_dr[_dc_guid] = _serializableObject.GUID;
				_dr[_dc_order] = _serializableObject.Order;
				_dr[_dc_isimage] = _serializableObject.IsImage;
				_dr[_dc_name] = _serializableObject.Name;
				_dr[_dc_description] = _serializableObject.Description;
				_dr[_dc_filename] = _serializableObject.FileName;

				_output.Rows.Add(_dr);
			}

			return _output;
		}
Exemple #3
0
		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;
		}