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/add.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"]))
			return Request.QueryString["CategoryID"];
		else if (Request.Cookies["CategoryID"] != null)
			return Request.Cookies["CategoryID"].Value;
		else
			return null;
	}
}

                        protected int t4200IDRecordCount
                        {
                            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 t4200IDCounter = 0;
                            protected object t4200IDRecord = null;
                        
                            private DataTable t4200ID;
                            private DataTable t4200ID_
                            {
                                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))
                                    {
                                        t4200ID = bll.List(-1, -1, condition, sort);
                                    }

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

                                                                            return t4685;
                                                                        }
                                                                        );
                                                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, t4200ID_, replacementPair, IlgharCMS.SystemModule.Alias.MenuCategory.ParentID, IlgharCMS.SystemModule.Alias.MenuCategory.ID, ref t4200IDRecord, ref t4200IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                        protected int t5764IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.SystemModule.IChannel bll = (IlgharCMS.SystemModule.IChannel)Manager.CreateObject("Channel", instanceID, ContentLang, false))
                                {
                                    string condition = null;


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t5764IDCounter = 0;
                            protected object t5764IDRecord = null;
                        
                            private DataTable t5764ID;
                            private DataTable t5764ID_
                            {
                                get
                                {
                                    string condition = null;


                                    string sort = null;

                                    int instanceID;
instanceID = InstanceID;

                                    using (IlgharCMS.SystemModule.IChannel bll = (IlgharCMS.SystemModule.IChannel)Manager.CreateObject("Channel", instanceID, ContentLang, false))
                                    {
                                        t5764ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t5764ID;
                                }
                            }
                        
                            protected string t5764
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t5764");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#Control#}"] = null;replacementPair["{#ChildRecords#}"] = null;replacementPair["{#ID#}"] = IlgharCMS.SystemModule.Alias.Channel.ID;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Channel.Name;
                                    StringBuilder all = Manager.BuildTree(node, t5764ID_, replacementPair, IlgharCMS.SystemModule.Alias.Channel.ParentID, IlgharCMS.SystemModule.Alias.Channel.ID, ref t5764IDRecord, ref t5764IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
