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.ArticleModule;
public partial class CIndex : IlgharCMS.Page
{
public CIndex()
: base("index.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 DataRow ShopChannel
                                {
                                    get
                                    {
                                        if (_ShopChannel == null)
                                            _ShopChannel = Manager.GetExtraInstance(Channel, "Shop");

                                        return _ShopChannel;
                                    }
                                }
                                private DataRow _ShopChannel;

                            protected string MetaKeywords
                                            {
                                                get
                                                {
                                                    StringBuilder result = new StringBuilder();
                                                    result.Append(Channel[IlgharCMS.SystemModule.Alias.Channel.Name + PageLang]);
                                    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();
                                                    result.Append(Channel[IlgharCMS.SystemModule.Alias.Channel.Name + PageLang]);
                                    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 string t855Default
                            {
                                get
                                {
                                    StringBuilder result = new StringBuilder(_xmlTemplate.SelectSingleNode("//t855").InnerText);
                                    object t957 = ImagePath;
result.Replace("{#t957#}",t957 == null ? "" : t957.ToString());

                                    return result.ToString();
                                }
                            }
                            protected string t855
                            {
                                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 t855Default;

                                    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 t855Default;
                                    else
                                        return "<script type=\"text/javascript\" src=\"" + path + "\"></script>";
                                }
                            }
                            
                            private string t1318BuildUrl(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 t1318IDCounter = 0;
                            private object t1318IDRecord = null;
                            private DataTable t1318ID;
                            private DataTable t1318ID_
                            {
                                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))
                                    {
                                        t1318ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t1318ID;
                                }
                            }
                            protected string t1318
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t1318");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#URL#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            return t1318BuildUrl(record);
                                                                        }
                                                                        );
                                                replacementPair["{#Target#}"] = IlgharCMS.SystemModule.Alias.Menu.Target;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Menu.Name;
                                    StringBuilder all = Manager.Build(node, t1318ID_, replacementPair, ref t1318IDRecord, ref t1318IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t1810IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ArticleModule.IArticleCategory bll = (IlgharCMS.ArticleModule.IArticleCategory)Manager.CreateObject("ArticleCategory", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P2194_1_104=";
condition += "true";
condition += " and P2194_1_3 IS ";
condition += "NULL";


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t1810IDCounter = 0;
                            protected object t1810IDRecord = null;
                            private DataTable t1810IDData;
                            protected DataTable t1810ID
                            {
                                get
                                {
                                    if (t1810IDData != null)
                                        return t1810IDData;

                                    t1810IDData = t1810ID_;
                                    return t1810IDData;
                                }
                            }
                        
                                private DataTable t1810ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P2194_1_104=";
condition += "true";
condition += " and P2194_1_3 IS ";
condition += "NULL";


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ArticleModule.IArticleCategory bll = (IlgharCMS.ArticleModule.IArticleCategory)Manager.CreateObject("ArticleCategory", instanceID, PageLang, false))
                                        {
                                            t1810IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t1810IDData;
                                    }
                                }
                            
                            protected string t1810
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t1810");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t1953 = BuildUrl(Channel,"article_category","ID=" + t1810ID.Rows[t1810IDCounter]["P2194_1_101"] + "&Ext=" + t1810ID.Rows[t1810IDCounter]["P2194_1_102"] + "&PageTemplate=" + t1810ID.Rows[t1810IDCounter]["P2194_1_100"] + "&PageUrl=" + HttpUtility.UrlEncode(t1810ID.Rows[t1810IDCounter]["P2194_1_103"].ToString()));
                                                                            if (t1953 != null)
                                                                                return t1953.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Name#}"] = IlgharCMS.ArticleModule.Alias.ArticleCategory.Name;
                                    StringBuilder all = Manager.Build(node, t1810ID_, replacementPair, ref t1810IDRecord, ref t1810IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t2129IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = (int)ShopChannel[IlgharCMS.SystemModule.Alias.Instance.InnerID];
                                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 t2129IDCounter = 0;
                            protected object t2129IDRecord = null;
                            private DataTable t2129IDData;
                            protected DataTable t2129ID
                            {
                                get
                                {
                                    if (t2129IDData != null)
                                        return t2129IDData;

                                    t2129IDData = t2129ID_;
                                    return t2129IDData;
                                }
                            }
                        
                                private DataTable t2129ID_
                                {
                                    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 = (int)ShopChannel[IlgharCMS.SystemModule.Alias.Instance.InnerID];

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

                                        return t2129IDData;
                                    }
                                }
                            
                            protected string t2129
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2129");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t2345 = BuildUrl(ShopChannel,"goods","ID=" + t2129ID.Rows[t2129IDCounter]["P1896_2_415"] + "&Ext=" + t2129ID.Rows[t2129IDCounter]["P1896_2_416"] + "&PageTemplate=" + t2129ID.Rows[t2129IDCounter]["P1896_2_414"]);
                                                                            if (t2345 != null)
                                                                                return t2345.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Name#}"] = IlgharCMS.ShopModule.Alias.Goods.Name;replacementPair["{#Thumbnail#}"] = IlgharCMS.ShopModule.Alias.Goods.Thumbnail;
                                    StringBuilder all = Manager.Build(node, t2129ID_, replacementPair, ref t2129IDRecord, ref t2129IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t2677IDRecordCount
                        {
                            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 t2677IDCounter = 0;
                            protected object t2677IDRecord = null;
                            private DataTable t2677IDData;
                            protected DataTable t2677ID
                            {
                                get
                                {
                                    if (t2677IDData != null)
                                        return t2677IDData;

                                    t2677IDData = t2677ID_;
                                    return t2677IDData;
                                }
                            }
                        
                                private DataTable t2677ID_
                                {
                                    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))
                                        {
                                            t2677IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t2677IDData;
                                    }
                                }
                            
                            protected string t2677
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2677");
                                    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, t2677ID_, replacementPair, ref t2677IDRecord, ref t2677IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                            private int t3112IDCounter = 0;
                            private object t3112IDRecord = null;
                            private DataTable t3112ID_;
                            private DataTable t3112ID
                            {
                                get
                                {
                                    if (t3112ID_ != null)
                                        return t3112ID_;

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

                                    DataRow newRow = null;

                                    

                                    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 = t3112ID_.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"];
                                        t3112ID_.Rows.InsertAt(newRow, 0);

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

                                    

                                    return t3112ID_;
                                }
                            }
                            protected string t3112
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t3112");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#URL#}"] = "URL";replacementPair["{#Name#}"] = "Name";
                                    StringBuilder all = Manager.Build(node, t3112ID, replacementPair, ref t3112IDRecord, ref t3112IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t3373IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ArticleModule.IArticleCategory bll = (IlgharCMS.ArticleModule.IArticleCategory)Manager.CreateObject("ArticleCategory", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P2194_1_104=";
condition += "true";
condition += " and P2194_1_3 IS ";
condition += "NULL";


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t3373IDCounter = 0;
                            protected object t3373IDRecord = null;
                            private DataTable t3373IDData;
                            protected DataTable t3373ID
                            {
                                get
                                {
                                    if (t3373IDData != null)
                                        return t3373IDData;

                                    t3373IDData = t3373ID_;
                                    return t3373IDData;
                                }
                            }
                        
                                private DataTable t3373ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P2194_1_104=";
condition += "true";
condition += " and P2194_1_3 IS ";
condition += "NULL";


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ArticleModule.IArticleCategory bll = (IlgharCMS.ArticleModule.IArticleCategory)Manager.CreateObject("ArticleCategory", instanceID, PageLang, false))
                                        {
                                            t3373IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t3373IDData;
                                    }
                                }
                            
                            protected string t3373
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t3373");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#t3576#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        { return t3576;}
                                                                        );
                                                
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t3500 = BuildUrl(Channel,"article_category","ID=" + t3373ID.Rows[t3373IDCounter]["P2194_1_101"] + "&Ext=" + t3373ID.Rows[t3373IDCounter]["P2194_1_102"] + "&PageTemplate=" + t3373ID.Rows[t3373IDCounter]["P2194_1_100"] + "&PageUrl=" + HttpUtility.UrlEncode(t3373ID.Rows[t3373IDCounter]["P2194_1_103"].ToString()));
                                                                            if (t3500 != null)
                                                                                return t3500.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Name#}"] = IlgharCMS.ArticleModule.Alias.ArticleCategory.Name;
                                    StringBuilder all = Manager.Build(node, t3373ID_, replacementPair, ref t3373IDRecord, ref t3373IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t3576IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.ArticleModule.IArticle bll = (IlgharCMS.ArticleModule.IArticle)Manager.CreateObject("Article", instanceID, PageLang, false))
                                {
                                    string condition = null;
condition += "P2194_2_42=";
condition += "false";
condition += " and P2194_2_41=";
condition += "true";
condition += " and P2194_2_51=";
condition += t3373ID.Rows[t3373IDCounter][IlgharCMS.ArticleModule.Alias.ArticleCategory.ID];


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t3576IDCounter = 0;
                            protected object t3576IDRecord = null;
                            private DataTable t3576IDData;
                            protected DataTable t3576ID
                            {
                                get
                                {
                                    if (t3576IDData != null)
                                        return t3576IDData;

                                    t3576IDData = t3576ID_;
                                    return t3576IDData;
                                }
                            }
                        
                                private DataTable t3576ID_
                                {
                                    get
                                    {
                                        string condition = null;
condition += "P2194_2_42=";
condition += "false";
condition += " and P2194_2_41=";
condition += "true";
condition += " and P2194_2_51=";
condition += t3373ID.Rows[t3373IDCounter][IlgharCMS.ArticleModule.Alias.ArticleCategory.ID];


                                        string sort = null;sort = "P2194_2_46 DESC";

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.ArticleModule.IArticle bll = (IlgharCMS.ArticleModule.IArticle)Manager.CreateObject("Article", instanceID, PageLang, false))
                                        {
                                            t3576IDData = bll.List(1, 10, condition, sort);
                                        }

                                        return t3576IDData;
                                    }
                                }
                            
                            protected string t3576
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t3576");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair[@"{#BuildUrl()#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t3798 = BuildUrl(Channel,"article","ID=" + t3576ID.Rows[t3576IDCounter]["P2194_2_89"] + "&Ext=" + t3576ID.Rows[t3576IDCounter]["P2194_2_90"] + "&PageTemplate=" + t3576ID.Rows[t3576IDCounter]["P2194_2_88"] + "&PageUrl=" + HttpUtility.UrlEncode(t3576ID.Rows[t3576IDCounter]["P2194_2_91"].ToString()));
                                                                            if (t3798 != null)
                                                                                return t3798.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#Title#}"] = IlgharCMS.ArticleModule.Alias.Article.Title;replacementPair["{#UpdateTime#}"] = IlgharCMS.ArticleModule.Alias.Article.UpdateTime;
                                    StringBuilder all = Manager.Build(node, t3576ID_, replacementPair, ref t3576IDRecord, ref t3576IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                            private string t4128BuildUrl(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 t4128IDCounter = 0;
                            private object t4128IDRecord = null;
                            private DataTable t4128ID;
                            private DataTable t4128ID_
                            {
                                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))
                                    {
                                        t4128ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t4128ID;
                                }
                            }
                            protected string t4128
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t4128");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#URL#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            return t4128BuildUrl(record);
                                                                        }
                                                                        );
                                                replacementPair["{#Target#}"] = IlgharCMS.SystemModule.Alias.Menu.Target;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Menu.Name;
                                    StringBuilder all = Manager.Build(node, t4128ID_, replacementPair, ref t4128IDRecord, ref t4128IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
