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.SystemModule;
public partial class CIlgharCMS : IlgharCMS.Lib.AdminPageBase
{
public CIlgharCMS()
: base("IlgharCMS.SystemModule/menu/list.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();
                            }
                        
}

protected string CurrentCategoryID
{
	get
	{
		if (!String.IsNullOrEmpty(Request.QueryString["CategoryID"]) && Request.QueryString["CategoryID"] != Guid.Empty.ToString())
			return Request.QueryString["CategoryID"];
		else if (Request.Cookies["CategoryID"] != null)
			return Request.Cookies["CategoryID"].Value;
		else
			return "";
	}
}

                        protected int t2794IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.SystemModule.IMenuCategory bll = (IlgharCMS.SystemModule.IMenuCategory)Manager.CreateObject("MenuCategory", instanceID, ContentLang, false))
                                {
                                    string condition = null;


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2794IDCounter = 0;
                            protected object t2794IDRecord = null;
                        
                            private DataTable t2794ID;
                            private DataTable t2794ID_
                            {
                                get
                                {
                                    string condition = null;


                                    string sort = null;

                                    int instanceID;
instanceID = InstanceID;

                                    using (IlgharCMS.SystemModule.IMenuCategory bll = (IlgharCMS.SystemModule.IMenuCategory)Manager.CreateObject("MenuCategory", instanceID, ContentLang, false))
                                    {
                                        t2794ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t2794ID;
                                }
                            }
                        
                            protected string t2794
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2794");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#t3231#}"] = new CustomBuildTree(
                                                                        delegate(TreeNode record, int index)
                                                                        {string t3231 = String.Empty;
if ((Convert.ToString((t2794IDRecord as TreeNode).Row[IlgharCMS.SystemModule.Alias.MenuCategory.ID])==CurrentCategoryID))
{t3231 = _xmlTemplate.SelectSingleNode("/" + "/t3231/If").InnerText;}
else
{t3231 = _xmlTemplate.SelectSingleNode("/" + "/t3231/Else").InnerText;}

                                                                            return t3231;
                                                                        }
                                                                        );
                                                replacementPair["{#Control#}"] = null;replacementPair["{#ChildRecords#}"] = null;replacementPair["{#ID#}"] = IlgharCMS.SystemModule.Alias.MenuCategory.ID;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.MenuCategory.Name;
                                    StringBuilder all = Manager.BuildTree(node, t2794ID_, replacementPair, IlgharCMS.SystemModule.Alias.MenuCategory.ParentID, IlgharCMS.SystemModule.Alias.MenuCategory.ID, ref t2794IDRecord, ref t2794IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t3865IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.SystemModule.IMenu bll = (IlgharCMS.SystemModule.IMenu)Manager.CreateObject("Menu", instanceID, ContentLang, true))
                                {
                                    string condition = null;
condition += "P2131_24_264=";
object v0 = CurrentCategoryID;
                                            if (v0 == null)
                                                condition = condition.Substring(0, condition.Length - 13);
                                            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 t3865IDCounter = 0;
                            protected object t3865IDRecord = null;
                        
                            private DataTable t3865ID;
                            private DataTable t3865ID_
                            {
                                get
                                {
                                    string condition = null;
condition += "P2131_24_264=";
object v0 = CurrentCategoryID;
                                            if (v0 == null)
                                                condition = condition.Substring(0, condition.Length - 13);
                                            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.SystemModule.IMenu bll = (IlgharCMS.SystemModule.IMenu)Manager.CreateObject("Menu", instanceID, ContentLang, true))
                                    {
                                        t3865ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t3865ID;
                                }
                            }
                        
                            protected string t3865
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t3865");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#t5284#}"] = new CustomBuildTree(
                                                                        delegate(TreeNode record, int index)
                                                                        {string t5284 = String.Empty;
if (Convert.ToBoolean((t3865IDRecord as TreeNode).Row[IlgharCMS.SystemModule.Alias.Menu.IsDisplay]))
{t5284 = _xmlTemplate.SelectSingleNode("/" + "/t5284/If").InnerText;}
else
{t5284 = _xmlTemplate.SelectSingleNode("/" + "/t5284/Else").InnerText;}

                                                                            return t5284;
                                                                        }
                                                                        );
                                                replacementPair["{#Control#}"] = null;replacementPair["{#ChildRecords#}"] = null;
                                        replacementPair[@"{#ImagePath#}"] = new CustomBuildTree(
                                                                        delegate(TreeNode record, int index)
                                                                        {
                                                                            object t5081 = ImagePath;
                                                                            if (t5081 != null)
                                                                                return t5081.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                
                                        replacementPair[@"{#ContentLang#}"] = new CustomBuildTree(
                                                                        delegate(TreeNode record, int index)
                                                                        {
                                                                            object t5232 = ContentLang;
                                                                            if (t5232 != null)
                                                                                return t5232.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#InnerID#}"] = IlgharCMS.SystemModule.Alias.Menu.InnerID;replacementPair["{#ParentInnerID#}"] = IlgharCMS.SystemModule.Alias.Menu.InnerID;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Menu.Name;replacementPair["{#CategoryID#}"] = IlgharCMS.SystemModule.Alias.Menu.CategoryID;
                                    StringBuilder all = Manager.BuildTree(node, t3865ID_, replacementPair, IlgharCMS.SystemModule.Alias.Menu.ParentID, IlgharCMS.SystemModule.Alias.Menu.ID, ref t3865IDRecord, ref t3865IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
