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/instance/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 bool CanDelete(DataRow record)
{
	DataRow[] rows = Manager.Channels.Select(Alias.Channel.ID + " IS NOT NULL AND " + Alias.Instance.InnerID + "=" + record[Alias.Instance.InnerID]);
	if (rows.Length == 0)
		return true;
	else
		return false;
}

                        protected int t2530IDRecordCount
                        {
                            get
                            {
                                int instanceID;
instanceID = InstanceID;
                                using (IlgharCMS.SystemModule.IInstance bll = (IlgharCMS.SystemModule.IInstance)Manager.CreateObject("Instance", instanceID, ContentLang, true))
                                {
                                    string condition = null;


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2530IDCounter = 0;
                            protected object t2530IDRecord = null;
                            private DataTable t2530IDData;
                            protected DataTable t2530ID
                            {
                                get
                                {
                                    if (t2530IDData != null)
                                        return t2530IDData;

                                    t2530IDData = t2530ID_;
                                    return t2530IDData;
                                }
                            }
                        
                                private DataTable t2530ID_
                                {
                                    get
                                    {
                                        string condition = null;


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.SystemModule.IInstance bll = (IlgharCMS.SystemModule.IInstance)Manager.CreateObject("Instance", instanceID, ContentLang, true))
                                        {
                                            t2530IDData = bll.List(-1, -1, condition, sort);
                                        }

                                        return t2530IDData;
                                    }
                                }
                            
                            protected string t2530
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2530");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    
                                        replacementPair["{#t3094#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {string t3094 = String.Empty;
if (CanDelete((t2530IDRecord as System.Data.DataRow)))
{t3094 = _xmlTemplate.SelectSingleNode("/" + "/t3094/If").InnerText;}

                                                                            return t3094;
                                                                        }
                                                                        );
                                                
                                        replacementPair[@"{#ImagePath#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t2755 = ImagePath;
                                                                            if (t2755 != null)
                                                                                return t2755.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                
                                        replacementPair[@"{#ContentLang#}"] = new CustomBuild(
                                                                        delegate(DataRow record, int index)
                                                                        {
                                                                            object t2881 = ContentLang;
                                                                            if (t2881 != null)
                                                                                return t2881.ToString();
                                                                            else
                                                                                return String.Empty;
                                                                        }
                                                                        );
                                                replacementPair["{#InnerID#}"] = IlgharCMS.SystemModule.Alias.Instance.InnerID;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Instance.Name;
                                    StringBuilder all = Manager.Build(node, t2530ID_, replacementPair, ref t2530IDRecord, ref t2530IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
