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/skin/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(t2658);
                                Response.End();
                            }
                        
}

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


                                    return bll.GetRecordCount(condition);
                                }
                            }
                        }
                        
                            protected int ListCounter = 0;
                            protected object ListRecord = null;
                            private DataTable ListData;
                            protected DataTable List
                            {
                                get
                                {
                                    if (ListData != null)
                                        return ListData;

                                    ListData = List_;
                                    return ListData;
                                }
                            }
                        
                                private DataTable List_
                                {
                                    get
                                    {
                                        string condition = null;


                                        string sort = null;

                                        int instanceID;
instanceID = InstanceID;

                                        using (IlgharCMS.SystemModule.ISkin bll = (IlgharCMS.SystemModule.ISkin)Manager.CreateObject("Skin", instanceID, ContentLang, true))
                                        {
                                            ListData = bll.List(Convert.ToInt32(PageNumber), 20, condition, sort);
                                        }

                                        return ListData;
                                    }
                                }
                            
                            protected string t1883
                            {
                                get
                                {
                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t1883");
                                    Dictionary<string, object> replacementPair = new Dictionary<string, object>();
                                    replacementPair["{#Path#}"] = IlgharCMS.SystemModule.Alias.Skin.Path;replacementPair["{#Picture#}"] = IlgharCMS.SystemModule.Alias.Skin.Picture;replacementPair["{#Thumbnail#}"] = IlgharCMS.SystemModule.Alias.Skin.Thumbnail;
                                    StringBuilder all = Manager.Build(node, List_, replacementPair, ref ListRecord, ref ListCounter);
                                    
                                    
                                    
                                    return all.ToString();
                                }
                            }
                          
                            
                        private string t2658URL_ = null;
                        private string t2658URL
                        {
                            get
                            {
                                if (t2658URL_ != null)
                                    return t2658URL_;

                                StringBuilder result = new StringBuilder("?Page={Page}");
                                for (int i = 0; i < Request.QueryString.Count; i++)
                                {
                                    if (Request.QueryString.GetKey(i).ToLower() == "page")
                                        continue;

                                    result.Append("&amp;" + Request.QueryString.GetKey(i) + "=" + Server.UrlEncode(Request.QueryString[i]));
                                }

                                t2658URL_ = result.ToString();
                                return t2658URL_;
                            }
                        }
                        
                            private int t2658Page;
                            private int t2658PageCount;
                            private int t2658RecordCount;
                            private int t2658PageSize;
                            private int t2658Index;
                            protected string t2658
                            {
                                get
                                {
                                    t2658Page = Convert.ToInt32(PageNumber);
                                    if (t2658Page <= 0)
                                        t2658Page = 1;
                                    t2658PageSize = 20;
                                    t2658RecordCount = Convert.ToInt32(ListRecordCount);

                                    XmlNode node = _xmlTemplate.SelectSingleNode("//t2658");

                                    StringBuilder all = new StringBuilder(node.SelectSingleNode("All").InnerText);

                                    t2658PageCount = t2658RecordCount / t2658PageSize;
                                    if (t2658RecordCount % t2658PageSize > 0)
                                        t2658PageCount += 1;

                                    if (!String.IsNullOrEmpty(Request.QueryString["GetPageCount"]))
                                        return t2658PageCount.ToString();

                                    //--------------------------------------
                                    //Start : FirstPage
                                    StringBuilder firstPage = new StringBuilder();
                                    string firstPageYesTpl = node.SelectSingleNode("FirstPage/Yes").InnerText;
                                    string firstPageNoTpl = node.SelectSingleNode("FirstPage/No").InnerText;
                                    if (t2658Page > 1)
                                    {
                                        firstPage.Append(firstPageNoTpl);
                                        object t3170 = ImagePath;
firstPage.Replace("{#t3170#}", t3170 == null ? "" : t3170.ToString());
object t3251 = PageNumber;
firstPage.Replace("{#t3251#}", t3251 == null ? "" : t3251.ToString());
object t3297 = ImagePath;
firstPage.Replace("{#t3297#}", t3297 == null ? "" : t3297.ToString());

                                    }
                                    else
                                    {
                                        firstPage.Append(firstPageYesTpl);
                                        object t2970 = ImagePath;
firstPage.Replace("{#t2970#}", t2970 == null ? "" : t2970.ToString());
object t3035 = ImagePath;
firstPage.Replace("{#t3035#}", t3035 == null ? "" : t3035.ToString());

                                    }
                                    all.Replace("{#FirstPage#}", firstPage.ToString());
                                    //End : FirstPage
                                    //--------------------------------------

                                    //--------------------------------------
                                    //Start : CurrentPage
                                    StringBuilder currentPage = new StringBuilder();

                                    if (t2658PageCount > 1)
                                    {
                                        string currentPageYesTpl = node.SelectSingleNode("CurrentPage/Yes").InnerText;
                                        string currentPageNoTpl = node.SelectSingleNode("CurrentPage/No").InnerText;

                                        bool isAll = false;
                                        int pageEnd = 0;
                                        if (isAll)
                                        {
                                            t2658Index = 1;
                                            pageEnd = t2658PageCount;
                                        }
                                        else
                                        {
                                            t2658Index = t2658Page - 5;
                                            if (t2658Index <= 0)
                                                t2658Index = 1;

                                            pageEnd = t2658Page + 5;
                                            if (pageEnd > t2658PageCount)
                                                pageEnd = t2658PageCount;
                                        }

                                        while (t2658Index <= pageEnd)
                                        {
                                            if (t2658Index == t2658Page)
                                            {
                                                currentPage.Append(currentPageYesTpl);
                                                object t3483 = t2658Index;
currentPage.Replace("{#t3483#}", t3483 == null ? "" : t3483.ToString());

                                            }
                                            else
                                            {
                                                currentPage.Append(currentPageNoTpl);
                                                object t3578 = t2658Index;
currentPage.Replace("{#t3578#}", t3578 == null ? "" : t3578.ToString());
object t3592 = t2658Index;
currentPage.Replace("{#t3592#}", t3592 == null ? "" : t3592.ToString());

                                            }
                                            t2658Index++;
                                        }
                                    }
                                    all.Replace("{#CurrentPage#}", currentPage.ToString());
                                    //End : CurrentPage
                                    //--------------------------------------

                                    //--------------------------------------
                                    //Start : LastPage
                                    StringBuilder lastPage = new StringBuilder();

                                    string lastPageYesTpl = node.SelectSingleNode("LastPage/Yes").InnerText;
                                    string lastPageNoTpl = node.SelectSingleNode("LastPage/No").InnerText;

                                    if (t2658Page < t2658PageCount)
                                    {
                                        lastPage.Append(lastPageNoTpl);
                                        object t3899 = PageNumber;
lastPage.Replace("{#t3899#}", t3899 == null ? "" : t3899.ToString());
object t3945 = ImagePath;
lastPage.Replace("{#t3945#}", t3945 == null ? "" : t3945.ToString());
object t4025 = t2658PageCount;
lastPage.Replace("{#t4025#}", t4025 == null ? "" : t4025.ToString());
object t4052 = ImagePath;
lastPage.Replace("{#t4052#}", t4052 == null ? "" : t4052.ToString());

                                    }
                                    else
                                    {
                                        lastPage.Append(lastPageYesTpl);
                                        object t3718 = ImagePath;
lastPage.Replace("{#t3718#}", t3718 == null ? "" : t3718.ToString());
object t3782 = ImagePath;
lastPage.Replace("{#t3782#}", t3782 == null ? "" : t3782.ToString());

                                    }
                                    all.Replace("{#LastPage#}", lastPage.ToString());
                                    //End : LastPage
                                    //--------------------------------------

                                    object t2796 = t2658RecordCount;
all.Replace("{#t2796#}", t2796 == null ? "" : t2796.ToString());
object t2821 = PageNumber;
all.Replace("{#t2821#}", t2821 == null ? "" : t2821.ToString());
object t2841 = (t2658Page - 1) * t2658PageSize + 1;
all.Replace("{#t2841#}", t2841 == null ? "" : t2841.ToString());
object t2857 = t2658RecordCount < t2658Page * t2658PageSize ? t2658RecordCount : t2658Page * t2658PageSize;
all.Replace("{#t2857#}", t2857 == null ? "" : t2857.ToString());


                                    return all.ToString();
                                }
                            }
                          }
