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_category/edit.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 Dictionary<string, object> MenuCategory
                            {
                                get
                                {
                                    object id = null;
                                    id = Convert.ToInt32(Request.QueryString["ID"]);
                                    if (_MenuCategoryID != null && _MenuCategoryID == id)
                                        return _MenuCategory;

                                    int instanceID;
instanceID = InstanceID;

                                    using (IlgharCMS.SystemModule.IMenuCategory bll = (IlgharCMS.SystemModule.IMenuCategory)Manager.CreateObject("MenuCategory", instanceID, ContentLang, true))
                                    {
                                        _MenuCategoryID = id;
                                        _MenuCategory = bll.Get(id);
                                    }

                                    return _MenuCategory;
                                }
                            }
                            private Dictionary<string, object> _MenuCategory;
                            private object _MenuCategoryID;
                            
                        protected int t2671IDRecordCount
                        {
                            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 t2671IDCounter = 0;
                            protected object t2671IDRecord = null;
                        
                            private DataTable t2671ID;
                            private DataTable t2671ID_
                            {
                                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))
                                    {
                                        t2671ID = bll.List(-1, -1, condition, sort);
                                    }

                                    return t2671ID;
                                }
                            }
                        
                            protected string t2671
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2671");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#t3156#}"] = new CustomBuildTree(
                                                                        delegate(TreeNode record, int index)
                                                                        {string t3156 = String.Empty;
if (Guid.Equals((t2671IDRecord as TreeNode).Row[IlgharCMS.SystemModule.Alias.MenuCategory.ID],(MenuCategory==null?null:MenuCategory[IlgharCMS.SystemModule.Alias.MenuCategory.ParentID])))
{t3156 = _xmlTemplate.SelectSingleNode("/" + "/t3156/If").InnerText;}
else
{t3156 = _xmlTemplate.SelectSingleNode("/" + "/t3156/Else").InnerText;}

                                                                            return t3156;
                                                                        }
                                                                        );
                                                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, t2671ID_, replacementPair, IlgharCMS.SystemModule.Alias.MenuCategory.ParentID, IlgharCMS.SystemModule.Alias.MenuCategory.ID, ref t2671IDRecord, ref t2671IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
