using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Ion.Storage; using Holo.Managers; namespace Holo.Source.Virtual.Catalogue { public class cataloguePage { #region Fields private int mIndexID; private int mOrderID; private byte mMinRank; private string mIndexName; private string mDisplayName; private string mStyle_Layout; private string mImg_Header; private string mImg_Side; private string mLabel_Description; private string mLabel_Misc; private string mLabel_Moredetails; #endregion #region Properties public int IndexID { get { return mIndexID; } } public int OrderID { get { return mOrderID; } } public byte MinRank { get { return mMinRank; } } public string IndexName { get { return mIndexName; } } public string DisplayName { get { return mDisplayName; } } public string Style_Layout { get { return mStyle_Layout; } } public string Img_Header { get { return mImg_Header; } } public string Img_Side { get { return mImg_Side; } } public string Label_Description { get { return mLabel_Description; } } public string Label_Misc { get { return mLabel_Misc; } } public string Label_Moredetails { get { return mLabel_Moredetails; } } #endregion #region Methods public static cataloguePage Parse(DataRow row) { cataloguePage page = new cataloguePage(); page.mIndexID = Convert.ToInt32(row["indexid"]); page.mOrderID = Convert.ToInt32(row["orderid"]); page.mMinRank = Convert.ToByte(row["minrank"]); page.mIndexName = row["indexname"].ToString(); page.mDisplayName = row["displayname"].ToString(); page.mStyle_Layout = row["style_layout"].ToString(); page.mImg_Header = row["img_header"].ToString(); page.mImg_Side = row["img_side"].ToString(); page.mLabel_Description = row["label_description"].ToString(); page.mLabel_Misc = row["label_misc"].ToString(); page.mLabel_Moredetails = row["label_moredetails"].ToString(); return page; } public string ToFuseString() { List Products = catalogueManager.getProducts(mIndexID); FuseBuilder fBuilder = new FuseBuilder(); fBuilder.Append("i:"); fBuilder.AppendString(mIndexName, 13); fBuilder.Append("n:"); fBuilder.AppendString(mDisplayName, 13); fBuilder.Append("l:"); fBuilder.AppendString(mStyle_Layout, 13); if (mImg_Header != "") // If there's a headline image set, add it { fBuilder.Append("g:"); fBuilder.AppendString(mImg_Header, 13); } if (mImg_Side != "") // If there is/are side image(s) set, add it/them { fBuilder.Append("e:"); fBuilder.AppendString(mImg_Side, 13); } if (mLabel_Description != "") // If there's a description set, add it { fBuilder.Append("h:"); fBuilder.AppendString(mLabel_Description, 13); } if (mLabel_Moredetails != "") // If there's a 'Click here for more details' label set, add it { fBuilder.Append("w:"); fBuilder.AppendString(mLabel_Moredetails, 13); } if (mLabel_Misc != "") // If the misc additions field is not blank { string[] miscDetail = mLabel_Misc.Split(Convert.ToChar(13)); for (int m = 0; m < miscDetail.Length; m++) fBuilder.AppendString(miscDetail[m], 13); } foreach (catalogueProduct product in Products) { fBuilder.Append(product.ToFuseString()); } return fBuilder.ToString(); } #endregion } }