using System;
using System.Data;
using System.Xml;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Web;
using IlgharCMS;
using IlgharCMS.ShopModule;
public partial class CGoods : IlgharCMS.Page
{
public CGoods()
: base("goods.dwt.aspx")
{}
protected XmlDocument _xmlTemplate;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
_xmlTemplate = XmlData.GetXmlDocument();
if (!String.IsNullOrEmpty(Request.QueryString["GetPageCount"]))
                            {
                                Response.Write(1);
                                Response.End();
                            }
                        
Response.AddCacheItemDependency("ClearAllCache");
}
protected string MetaKeywords
                                            {
                                                get
                                                {
                                                    StringBuilder result = new StringBuilder();
                                                    
                                                    if (!String.IsNullOrEmpty(Goods[IlgharCMS.ShopModule.Alias.Goods.MetaKeywords].ToString()))
                                                        result.Append(Goods[IlgharCMS.ShopModule.Alias.Goods.MetaKeywords].ToString());
                                                    else
                                                    
                                    if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.MetaKeywords].ToString()))
                                        result.Append(" - " + Channel[IlgharCMS.SystemModule.Alias.Channel.MetaKeywords]);

                                    if (!String.IsNullOrEmpty(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.MetaKeywords + PageLang].ToString()))
                                        result.Append(" - " + Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.MetaKeywords + PageLang]);
                                    
                                                    return result.ToString();
                                                }
                                            }
                            protected string MetaDescription
                                            {
                                                get
                                                {
                                                    StringBuilder result = new StringBuilder();
                                                    
                                                    if (!String.IsNullOrEmpty(Goods[IlgharCMS.ShopModule.Alias.Goods.MetaDescription].ToString()))
                                                        result.Append(Goods[IlgharCMS.ShopModule.Alias.Goods.MetaDescription].ToString());
                                                    else
                                                    
                                    if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.MetaDescription].ToString()))
                                        result.Append(" - " + Channel[IlgharCMS.SystemModule.Alias.Channel.MetaDescription]);

                                    if (!String.IsNullOrEmpty(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.MetaDescription + PageLang].ToString()))
                                        result.Append(" - " + Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.MetaDescription + PageLang]);
                                    
                                                    return result.ToString();
                                                }
                                            }
                            protected string Footer
                                            {
                                                get
                                                {
                                                    if (String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.Footer].ToString()))
                                                        return Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Footer + PageLang].ToString();
                                                    else
                                                        return Channel[IlgharCMS.SystemModule.Alias.Channel.Footer].ToString();
                                                }
                                            }
                            protected string StatisticsCode
                                            {
                                                get
                                                {
                                                    if (String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.StatisticsCode].ToString()))
                                                        return Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.StatisticsCode + PageLang].ToString();
                                                    else
                                                        return Channel[IlgharCMS.SystemModule.Alias.Channel.StatisticsCode].ToString();
                                                }
                                            }
                            
                            protected Dictionary<string, object> Goods
                            {
                                get
                                {
                                    object id = null;
                                    id = Convert.ToString(Request.QueryString["ID"]);
                                    if (_GoodsID != null && _GoodsID == id)
                                        return _Goods;

                                    int instanceID;
instanceID = InstanceID;

                                    using (IlgharCMS.ShopModule.IGoods bll = (IlgharCMS.ShopModule.IGoods)Manager.CreateObject("Goods", instanceID, PageLang, false))
                                    {
                                        _GoodsID = id;
                                        _Goods = bll.Get(id);
                                    }

                                    return _Goods;
                                }
                            }
                            private Dictionary<string, object> _Goods;
                            private object _GoodsID;
                            
                            protected string t1148Default
                            {
                                get
                                {
                                    StringBuilder result = new StringBuilder(_xmlTemplate.SelectSingleNode("//t1148").InnerText);
                                    object t1250 = ImagePath;
result.Replace("{#t1250#}",t1250 == null ? "" : t1250.ToString());

                                    return result.ToString();
                                }
                            }
                            protected string t1148
                            {
                                get
                                {
                                    int instanceID;
                                    DataRow[] rows = Manager.Instances.Select(IlgharCMS.SystemModule.Alias.Module.Namespace + "='IlgharCMS.AdModule'");if (rows.Length == 0)
{instanceID = 0;}
else
{instanceID = (int)rows[0][IlgharCMS.SystemModule.Alias.Instance.InnerID];}
                                    if (instanceID == 0)
                                        return t1148Default;

                                    string path = String.Empty;
                                    int id = -1;
                                    
                            using (IlgharCMS.AdModule.IPosition bll = (IlgharCMS.AdModule.IPosition)Manager.CreateObject("Position", instanceID, PageLang, false))
                            {
                                id = bll.GetInnerIDFromGuid(new Guid("{099A2FEC-2278-4b03-BC08-A3C1FC3ADC66}"));
                                path = Manager.GetCachePath() + "ad/" + instanceID + "_" + PageLang + "_" + id + ".js";
                                if (id > 0 && !System.IO.File.Exists(Manager.MapPath(path)))
                                {
                                    path = bll.GenerateCacheFile(id);
                                    if (String.IsNullOrEmpty(path))
                                        id = -1;
                                }
                            }
                            

                                    if (id <= 0)
                                        return t1148Default;
                                    else
                                        return "<script type=\"text/javascript\" src=\"" + path + "\"></script>";
                                }
                            }
                            
                            private string t1611BuildUrl(DataRow record)
                            {
                                string url = record[IlgharCMS.SystemModule.Alias.Menu.Path].ToString();
                                if (url.StartsWith("http://") || url.StartsWith("/"))
                                {
                                    if (url.StartsWith("/") && (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1))
                                        return Manager.GetWebPath() + "ilghar.aspx?" + url;
                                    else
                                        return url;
                                }

                                DataRow[] rows = Manager.Channels.Select(IlgharCMS.SystemModule.Alias.Channel.ID + "='" + record[IlgharCMS.SystemModule.Alias.Menu.ChannelID] + "'");
                                if (rows.Length == 0)
                                    return url;

                                DataRow channel = rows[0];
                                if (!Convert.IsDBNull(Channel[IlgharCMS.SystemModule.Alias.Channel.TranslateLang]))
                                {
                                    string instance = null;
                                    if (Convert.IsDBNull(channel[IlgharCMS.SystemModule.Alias.Instance.ID]))
                                        instance = IlgharCMS.SystemModule.Alias.Instance.ID + " IS NULL AND ";
                                    else
                                        instance = IlgharCMS.SystemModule.Alias.Instance.ID + "='" + channel[IlgharCMS.SystemModule.Alias.Instance.ID] + "' AND ";
                                    rows = Manager.Channels.Select(IlgharCMS.SystemModule.Alias.Channel.ID + " IS NOT NULL AND " + instance + IlgharCMS.SystemModule.Alias.Channel.TemplateLang + "='" + Channel[IlgharCMS.SystemModule.Alias.Channel.TemplateLang] + "' AND " + IlgharCMS.SystemModule.Alias.Channel.TranslateLang + "='" + Channel[IlgharCMS.SystemModule.Alias.Channel.TranslateLang] + "'");
                                    if (rows.Length > 0)
                                        channel = rows[0];
                                }

                                string content = record[IlgharCMS.SystemModule.Alias.Menu.Content].ToString();
                                if (!String.IsNullOrEmpty(content))
                                {
                                    if (!Convert.IsDBNull(record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate]))
                                    {
                                        if (record[IlgharCMS.SystemModule.Alias.Menu.PageExtension].ToString() == String.Empty)
                                            url = BuildUrl(channel, record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + channel[IlgharCMS.SystemModule.Alias.Channel.Extension]);
                                        else
                                            url = BuildUrl(channel, record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + record[IlgharCMS.SystemModule.Alias.Menu.PageExtension]);
                                    }
                                    else
                                    {
                                        rows = Manager.Pages.Select(IlgharCMS.SystemModule.Alias.Template.Page.TemplatePath + "='" + channel[IlgharCMS.SystemModule.Alias.Channel.TemplatePath] + "' AND " + IlgharCMS.SystemModule.Alias.Template.Page.Mark + "='System' AND " + IlgharCMS.SystemModule.Alias.Template.Page.Object + "='Menu'");
                                        if (rows.Length == 0)
                                        {
                                            url = String.Empty;
                                        }
                                        else
                                        {
                                            if (record[IlgharCMS.SystemModule.Alias.Menu.PageExtension].ToString() == String.Empty)
                                                url = BuildUrl(channel, rows[0][IlgharCMS.SystemModule.Alias.Template.Page.PathInTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + channel[IlgharCMS.SystemModule.Alias.Channel.Extension]);
                                            else
                                                url = BuildUrl(channel, rows[0][IlgharCMS.SystemModule.Alias.Template.Page.PathInTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + record[IlgharCMS.SystemModule.Alias.Menu.PageExtension]);
                                        }
                                    }
                                }
                                else
                                {
                                    string channelPath = String.Empty;
                                    if (!String.IsNullOrEmpty(channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                    {
                                        Uri domain = new Uri(channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString().Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)[0]);
                                        if (channel == Channel)
                                            channelPath = domain.LocalPath;
                                        else
                                            channelPath = domain.ToString();
                                    }
                                    else if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                    {
                                       channelPath = Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Domain].ToString() + channel[IlgharCMS.SystemModule.Alias.Channel.Path].ToString().TrimStart('/');
                                    }
                                    else
                                    {
                                        channelPath = channel[IlgharCMS.SystemModule.Alias.Channel.Path].ToString();
                                        
                                    }
                                    if (!String.IsNullOrEmpty(url))
                                    {
                                        url = channelPath + url;
                                        url = url.Replace(".ext", channel[IlgharCMS.SystemModule.Alias.Channel.Extension].ToString());
                                    }
                                    else
                                    {
                                        url = channelPath + channel[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString() + channel[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                    }

                                    if (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1)
                                        url = Manager.GetWebPath() + "ilghar.aspx?" + url;
                                }

                                return url;
                            }

                            private int t1611IDCounter = 0;
                            private object t1611IDRecord = null;
                            private DataTable t1611ID;
                            private DataTable t1611ID_
                            {
                                get
                                {
                                    string condition = null;
condition += "P2131_24_403=";
condition += "true";
condition += " and P2131_24_264 IS ";
condition += "NULL";
condition += " and P2131_24_263 IS ";
condition += "NULL";


                                    string sort = null;

                                    using (IlgharCMS.SystemModule.IMenu bll = (IlgharCMS.SystemModule.IMenu)Manager.CreateObject("Menu", SystemInstanceID, PageLang, false))
                                    {
                                        t1611ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t1611ID;
                                }
                            }
                            protected string t1611
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t1611");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#URL#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            return t1611BuildUrl(record);
                                                                        }
                                                                        );
                                                replacementPair["{#Target#}"] = IlgharCMS.SystemModule.Alias.Menu.Target;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Menu.Name;
                                    StringBuilder all = Manager.Build(node, t1611ID_, replacementPair, ref t1611IDRecord, ref t1611IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t2103IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ShopModule.IGoodsCategory bll = (IlgharCMS.ShopModule.IGoodsCategory)Manager.CreateObject("GoodsCategory", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P1896_6_113 IS ";
condition += "NULL";


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2103IDCounter = 0;
                            protected object t2103IDRecord = null;
                            private DataTable t2103IDData;
                            protected DataTable t2103ID
                            {
                                get
                                {
                                    if (t2103IDData != null)
                                        return t2103IDData;

                                    t2103IDData = t2103ID_;
                                    return t2103IDData;
                                }
                            }
                        
                                private DataTable t2103ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P1896_6_113 IS ";
condition += "NULL";


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ShopModule.IGoodsCategory bll = (IlgharCMS.ShopModule.IGoodsCategory)Manager.CreateObject("GoodsCategory", instanceID, PageLang, false))
                                        {
                                            t2103IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t2103IDData;
                                    }
                                }
                            
                            protected string t2103
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2103");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t2225 = BuildUrl(Channel,"goods_category","ID=" + t2103ID.Rows[t2103IDCounter]["P1896_6_428"] + "&Ext=" + t2103ID.Rows[t2103IDCounter]["P1896_6_429"] + "&PageTemplate=" + t2103ID.Rows[t2103IDCounter]["P1896_6_427"]);
                                                                            if (t2225 != null)
                                                                                return t2225.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Name#}"] = IlgharCMS.ShopModule.Alias.GoodsCategory.Name;
                                    StringBuilder all = Manager.Build(node, t2103ID_, replacementPair, ref t2103IDRecord, ref t2103IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t2406IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ShopModule.IGoods bll = (IlgharCMS.ShopModule.IGoods)Manager.CreateObject("Goods", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P1896_2_64=";
condition += "false";
condition += " and P1896_2_63=";
condition += "true";


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2406IDCounter = 0;
                            protected object t2406IDRecord = null;
                            private DataTable t2406IDData;
                            protected DataTable t2406ID
                            {
                                get
                                {
                                    if (t2406IDData != null)
                                        return t2406IDData;

                                    t2406IDData = t2406ID_;
                                    return t2406IDData;
                                }
                            }
                        
                                private DataTable t2406ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P1896_2_64=";
condition += "false";
condition += " and P1896_2_63=";
condition += "true";


                                        string sort = null;sort = "P1896_2_57 DESC";

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ShopModule.IGoods bll = (IlgharCMS.ShopModule.IGoods)Manager.CreateObject("Goods", instanceID, PageLang, false))
                                        {
                                            t2406IDData = bll.List(1, 10, condition, sort);
                                        }

                                        return t2406IDData;
                                    }
                                }
                            
                            protected string t2406
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2406");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t2610 = BuildUrl(Channel,"goods","ID=" + t2406ID.Rows[t2406IDCounter]["P1896_2_415"] + "&Ext=" + t2406ID.Rows[t2406IDCounter]["P1896_2_416"] + "&PageTemplate=" + t2406ID.Rows[t2406IDCounter]["P1896_2_414"]);
                                                                            if (t2610 != null)
                                                                                return t2610.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Name#}"] = IlgharCMS.ShopModule.Alias.Goods.Name;replacementPair["{#Thumbnail#}"] = IlgharCMS.ShopModule.Alias.Goods.Thumbnail;
                                    StringBuilder all = Manager.Build(node, t2406ID_, replacementPair, ref t2406IDRecord, ref t2406IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t2942IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = (int)SystemChannel[IlgharCMS.SystemModule.Alias.Instance.InnerID];
                                using (IlgharCMS.SystemModule.ILink bll = (IlgharCMS.SystemModule.ILink)Manager.CreateObject("Link", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P2131_46_402=";
condition += "true";


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2942IDCounter = 0;
                            protected object t2942IDRecord = null;
                            private DataTable t2942IDData;
                            protected DataTable t2942ID
                            {
                                get
                                {
                                    if (t2942IDData != null)
                                        return t2942IDData;

                                    t2942IDData = t2942ID_;
                                    return t2942IDData;
                                }
                            }
                        
                                private DataTable t2942ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P2131_46_402=";
condition += "true";


                                        string sort = null;

                                        int instanceID;
instanceID = (int)SystemChannel[IlgharCMS.SystemModule.Alias.Instance.InnerID];

                                        using (IlgharCMS.SystemModule.ILink bll = (IlgharCMS.SystemModule.ILink)Manager.CreateObject("Link", instanceID, PageLang, false))
                                        {
                                            t2942IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t2942IDData;
                                    }
                                }
                            
                            protected string t2942
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2942");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#URL#}"] = IlgharCMS.SystemModule.Alias.Link.URL;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Link.Name;replacementPair["{#Logo#}"] = IlgharCMS.SystemModule.Alias.Link.Logo;
                                    StringBuilder all = Manager.Build(node, t2942ID_, replacementPair, ref t2942IDRecord, ref t2942IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                            private int t3377IDCounter = 0;
                            private object t3377IDRecord = null;
                            private DataTable t3377ID_;
                            private DataTable t3377ID
                            {
                                get
                                {
                                    if (t3377ID_ != null)
                                        return t3377ID_;

                                    t3377ID_ = new DataTable();
                                    t3377ID_.Columns.Add("Name", typeof(string));
                                    t3377ID_.Columns.Add("URL", typeof(string));

                                    DataRow newRow = null;

                                    
                                newRow = t3377ID_.NewRow();
                                newRow["Name"] = Channel[IlgharCMS.SystemModule.Alias.Channel.Name + PageLang];
                                if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                {
                                    newRow["URL"] = "/";
                                }
                                else
                                {
                                    newRow["URL"] = Channel[IlgharCMS.SystemModule.Alias.Channel.Path] + Channel[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString()  + Channel[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                    
                                }
                                if (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1)
                                    newRow["URL"] = Manager.GetWebPath() + "ilghar.aspx?" + newRow["URL"];
                                t3377ID_.Rows.Add(newRow);

                    

                                    Guid parentID = (Guid)Channel[IlgharCMS.SystemModule.Alias.Channel.ParentID];
                                    while (parentID != Guid.Empty)
                                    {
                                        DataRow row = Manager.Channels.Select(IlgharCMS.SystemModule.Alias.Channel.ID + "='" + parentID + "'")[0];

                                        newRow = t3377ID_.NewRow();
                                        newRow["Name"] = row[IlgharCMS.SystemModule.Alias.Channel.Name + PageLang];
                                        string path = row[IlgharCMS.SystemModule.Alias.Channel.Path].ToString();
                                        if (Convert.IsDBNull(row[IlgharCMS.SystemModule.Alias.Channel.TemplatePath]))
                                            newRow["URL"] = path;
                                        else if (!String.IsNullOrEmpty(row[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                            newRow["URL"] = row[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString().Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries) + row[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString() + row[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                        else if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                            newRow["URL"] = Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Domain] + path.TrimStart('/') + row[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString() + row[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                        else
                                            newRow["URL"] = Manager.GetWebPath() + path.TrimStart('/') + row[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString() + row[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                        if (newRow["URL"].ToString().StartsWith("/") && (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1))
                                            newRow["URL"] = Manager.GetWebPath() + "ilghar.aspx?" + newRow["URL"];
                                        t3377ID_.Rows.InsertAt(newRow, 0);

                                        parentID = (Guid)row[IlgharCMS.SystemModule.Alias.Channel.ParentID];
                                    }

                                    
                            int instanceID;
instanceID = InstanceID;
                            using (IlgharCMS.ShopModule.IGoodsCategory bll = (IlgharCMS.ShopModule.IGoodsCategory)Manager.CreateObject("GoodsCategory", instanceID, PageLang, false))
                            {
                                string condition = null;
                                condition = IlgharCMS.ShopModule.Alias.GoodsCategory.ID + "={" + (Goods==null?null:Goods[IlgharCMS.ShopModule.Alias.Goods.CategoryID]) + "}";


                                DataTable table = bll.List(1, 1, condition, null);
                                if (table.Rows.Count == 0)
                                    return t3377ID_;

                                int pos = t3377ID_.Rows.Count;

                                newRow = t3377ID_.NewRow();
                                newRow["Name"] = table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.Name].ToString();
                                newRow["URL"] = BuildUrl(Channel, "goods_category", "ID=" + table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.InnerID]);
                                t3377ID_.Rows.InsertAt(newRow, pos);

                                while (!Guid.Equals(table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.ParentID], Guid.Empty))
                                {
                                    table = bll.List(1, 1, IlgharCMS.ShopModule.Alias.GoodsCategory.ID + "=" + table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.ParentID], null);

                                    newRow = t3377ID_.NewRow();
                                    newRow["Name"] = table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.Name].ToString();
                                    newRow["URL"] = BuildUrl(Channel, "goods_category", "ID=" + table.Rows[0][IlgharCMS.ShopModule.Alias.GoodsCategory.InnerID]);
                                    t3377ID_.Rows.InsertAt(newRow, pos);
                                }
                            }
                            

                                    return t3377ID_;
                                }
                            }
                            protected string t3377
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t3377");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#URL#}"] = "URL";replacementPair["{#Name#}"] = "Name";
                                    StringBuilder all = Manager.Build(node, t3377ID, replacementPair, ref t3377IDRecord, ref t3377IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t4205IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ShopModule.Goods.IProperty bll = (IlgharCMS.ShopModule.Goods.IProperty)Manager.CreateObject("Goods.Property", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P1896_3_87=";
object v0 = (Goods==null?null:Goods[IlgharCMS.ShopModule.Alias.Goods.ID]);
                                            if (v0 == null)
                                                condition = condition.Substring(0, condition.Length - 11);
                                            else if (v0.ToString() == String.Empty)
                                                condition = condition.Substring(0, condition.Length - 1) + " IS NULL ";
                                            else
                                                condition += v0.ToString();
                                            

                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t4205IDCounter = 0;
                            protected object t4205IDRecord = null;
                            private DataTable t4205IDData;
                            protected DataTable t4205ID
                            {
                                get
                                {
                                    if (t4205IDData != null)
                                        return t4205IDData;

                                    t4205IDData = t4205ID_;
                                    return t4205IDData;
                                }
                            }
                        
                                private DataTable t4205ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P1896_3_87=";
object v0 = (Goods==null?null:Goods[IlgharCMS.ShopModule.Alias.Goods.ID]);
                                            if (v0 == null)
                                                condition = condition.Substring(0, condition.Length - 11);
                                            else if (v0.ToString() == String.Empty)
                                                condition = condition.Substring(0, condition.Length - 1) + " IS NULL ";
                                            else
                                                condition += v0.ToString();
                                            

                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ShopModule.Goods.IProperty bll = (IlgharCMS.ShopModule.Goods.IProperty)Manager.CreateObject("Goods.Property", instanceID, PageLang, false))
                                        {
                                            t4205IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t4205IDData;
                                    }
                                }
                            
                            protected string t4205
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t4205");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#Name#}"] = IlgharCMS.ShopModule.Alias.Goods.Property.Name;replacementPair["{#Value#}"] = IlgharCMS.ShopModule.Alias.Goods.Property.Value;
                                    StringBuilder all = Manager.Build(node, t4205ID_, replacementPair, ref t4205IDRecord, ref t4205IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                            private string t4647BuildUrl(DataRow record)
                            {
                                string url = record[IlgharCMS.SystemModule.Alias.Menu.Path].ToString();
                                if (url.StartsWith("http://") || url.StartsWith("/"))
                                {
                                    if (url.StartsWith("/") && (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1))
                                        return Manager.GetWebPath() + "ilghar.aspx?" + url;
                                    else
                                        return url;
                                }

                                DataRow[] rows = Manager.Channels.Select(IlgharCMS.SystemModule.Alias.Channel.ID + "='" + record[IlgharCMS.SystemModule.Alias.Menu.ChannelID] + "'");
                                if (rows.Length == 0)
                                    return url;

                                DataRow channel = rows[0];
                                if (!Convert.IsDBNull(Channel[IlgharCMS.SystemModule.Alias.Channel.TranslateLang]))
                                {
                                    string instance = null;
                                    if (Convert.IsDBNull(channel[IlgharCMS.SystemModule.Alias.Instance.ID]))
                                        instance = IlgharCMS.SystemModule.Alias.Instance.ID + " IS NULL AND ";
                                    else
                                        instance = IlgharCMS.SystemModule.Alias.Instance.ID + "='" + channel[IlgharCMS.SystemModule.Alias.Instance.ID] + "' AND ";
                                    rows = Manager.Channels.Select(IlgharCMS.SystemModule.Alias.Channel.ID + " IS NOT NULL AND " + instance + IlgharCMS.SystemModule.Alias.Channel.TemplateLang + "='" + Channel[IlgharCMS.SystemModule.Alias.Channel.TemplateLang] + "' AND " + IlgharCMS.SystemModule.Alias.Channel.TranslateLang + "='" + Channel[IlgharCMS.SystemModule.Alias.Channel.TranslateLang] + "'");
                                    if (rows.Length > 0)
                                        channel = rows[0];
                                }

                                string content = record[IlgharCMS.SystemModule.Alias.Menu.Content].ToString();
                                if (!String.IsNullOrEmpty(content))
                                {
                                    if (!Convert.IsDBNull(record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate]))
                                    {
                                        if (record[IlgharCMS.SystemModule.Alias.Menu.PageExtension].ToString() == String.Empty)
                                            url = BuildUrl(channel, record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + channel[IlgharCMS.SystemModule.Alias.Channel.Extension]);
                                        else
                                            url = BuildUrl(channel, record[IlgharCMS.SystemModule.Alias.Menu.PageTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + record[IlgharCMS.SystemModule.Alias.Menu.PageExtension]);
                                    }
                                    else
                                    {
                                        rows = Manager.Pages.Select(IlgharCMS.SystemModule.Alias.Template.Page.TemplatePath + "='" + channel[IlgharCMS.SystemModule.Alias.Channel.TemplatePath] + "' AND " + IlgharCMS.SystemModule.Alias.Template.Page.Mark + "='System' AND " + IlgharCMS.SystemModule.Alias.Template.Page.Object + "='Menu'");
                                        if (rows.Length == 0)
                                        {
                                            url = String.Empty;
                                        }
                                        else
                                        {
                                            if (record[IlgharCMS.SystemModule.Alias.Menu.PageExtension].ToString() == String.Empty)
                                                url = BuildUrl(channel, rows[0][IlgharCMS.SystemModule.Alias.Template.Page.PathInTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + channel[IlgharCMS.SystemModule.Alias.Channel.Extension]);
                                            else
                                                url = BuildUrl(channel, rows[0][IlgharCMS.SystemModule.Alias.Template.Page.PathInTemplate].ToString(), "ID=" + record[IlgharCMS.SystemModule.Alias.Menu.PageID] + "&Ext=" + record[IlgharCMS.SystemModule.Alias.Menu.PageExtension]);
                                        }
                                    }
                                }
                                else
                                {
                                    string channelPath = String.Empty;
                                    if (!String.IsNullOrEmpty(channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                    {
                                        Uri domain = new Uri(channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString().Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)[0]);
                                        if (channel == Channel)
                                            channelPath = domain.LocalPath;
                                        else
                                            channelPath = domain.ToString();
                                    }
                                    else if (!String.IsNullOrEmpty(Channel[IlgharCMS.SystemModule.Alias.Channel.Domain].ToString()))
                                    {
                                       channelPath = Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Domain].ToString() + channel[IlgharCMS.SystemModule.Alias.Channel.Path].ToString().TrimStart('/');
                                    }
                                    else
                                    {
                                        channelPath = channel[IlgharCMS.SystemModule.Alias.Channel.Path].ToString();
                                        
                                    }
                                    if (!String.IsNullOrEmpty(url))
                                    {
                                        url = channelPath + url;
                                        url = url.Replace(".ext", channel[IlgharCMS.SystemModule.Alias.Channel.Extension].ToString());
                                    }
                                    else
                                    {
                                        url = channelPath + channel[IlgharCMS.SystemModule.Alias.Channel.DefaultDocument].ToString() + channel[IlgharCMS.SystemModule.Alias.Channel.Extension];
                                    }

                                    if (Convert.ToBoolean(Manager.Site[IlgharCMS.SystemModule.Alias.InstanceConfig.Fake404]) || Request.RawUrl.IndexOf("/ilghar.aspx?/") != -1)
                                        url = Manager.GetWebPath() + "ilghar.aspx?" + url;
                                }

                                return url;
                            }

                            private int t4647IDCounter = 0;
                            private object t4647IDRecord = null;
                            private DataTable t4647ID;
                            private DataTable t4647ID_
                            {
                                get
                                {
                                    string condition = null;
condition += "P2131_24_264=";
condition += "{BAC035A8-F6BB-4772-8D51-A7F4F3AB7AD3}";


                                    string sort = null;

                                    using (IlgharCMS.SystemModule.IMenu bll = (IlgharCMS.SystemModule.IMenu)Manager.CreateObject("Menu", SystemInstanceID, PageLang, false))
                                    {
                                        t4647ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t4647ID;
                                }
                            }
                            protected string t4647
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t4647");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#URL#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            return t4647BuildUrl(record);
                                                                        }
                                                                        );
                                                replacementPair["{#Target#}"] = IlgharCMS.SystemModule.Alias.Menu.Target;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Menu.Name;
                                    StringBuilder all = Manager.Build(node, t4647ID_, replacementPair, ref t4647IDRecord, ref t4647IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
