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/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();
                            }
                        
}

bool CanAdd(DataRow record)
{
	if (Guid.Equals(record[Alias.Module.ID], new Guid("{60E576FB-24BF-4CFA-8756-F69D4C13FE46}")))
		return false;
		
	return true;
}

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


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int t2397IDCounter = 0;
                            protected object t2397IDRecord = null;
                            private DataTable t2397IDData;
                            protected DataTable t2397ID
                            {
                                get
                                {
                                    if (t2397IDData != null)
                                        return t2397IDData;

                                    t2397IDData = t2397ID_;
                                    return t2397IDData;
                                }
                            }
                        
                                private DataTable t2397ID_
                                {
                                    get
                                    {
                                        string condition = null;


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.SystemModule.IModule bll = (IlgharCMS.SystemModule.IModule)Manager.CreateObject("Module", instanceID, ContentLang, false))
                                        {
                                            t2397IDData = bll.List(-1, -1, condition, sort);
                                        }

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

                                                                            return t2462;
                                                                        }
                                                                        );
                                                replacementPair["{#ID#}"] = IlgharCMS.SystemModule.Alias.Module.ID;replacementPair["{#Name#}"] = IlgharCMS.SystemModule.Alias.Module.Name;
                                    StringBuilder all = Manager.Build(node, t2397ID_, replacementPair, ref t2397IDRecord, ref t2397IDCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          }
