Example #1
0
        ////protected PlaceHolder CenterPlaceHolder;
        ////protected PlaceHolder CategoryListPlaceHolder;
        ////protected PlaceHolder CategoryPathPlaceHolder;
        protected void Page_Load(object sender, System.EventArgs e)
        {
            PlaceHolder  CLPLH =   new PlaceHolder() ; //CenterPlaceHolder
            PlaceHolder CPLH = new PlaceHolder()   ;// CategoryListPlaceHolder;
            PlaceHolder CPPLH = new PlaceHolder(); //CategoryPathPlaceHolder;

            goto nx;
            if (Request.Cookies["forum"] == null)
            {
                string QStr;

                if(Request.QueryString.HasKeys())
                    QStr = Request.Url.Query;
                else
                    QStr = "";

                Response.Redirect("/registration/login.asp?page=protected&pagesreturn=/catalog/index.aspx" + Server.UrlEncode(QStr),true);
            }
            if(Request.Cookies["customer_uid"] == null)
            {
                this.customer_uid = Session.SessionID;
                HttpCookie cookieCustomerUId = new HttpCookie("customer_uid", this.customer_uid);
                cookieCustomerUId.Expires = System.DateTime.Today.AddMonths(1);
                Response.Cookies.Add(cookieCustomerUId);
            }
            else
            {
                try
                {
                    if (Request.Cookies["forum"]["shID"] != null)
                        this.customer_uid = Request.Cookies["forum"]["shID"];
                    else
                        //this.customer_uid = Request.Cookies["customer_uid"].Value;
                        Response.Redirect("/registration/login.asp?page=protected&pagesreturn=/catalog/index.aspx" + Server.UrlEncode(Request.Url.Query),true);
                }
                catch
                {
                    this.customer_uid = Request.Cookies["customer_uid"].Value;
                }
            }
            nx:
            customer = new BLCustomer();
            customer.UID = this.customer_uid;
            customer.Retrieve();
            //            }
            if customer.ID <= 0)
            {
                customer.UID = this.customer_uid;
                customer.Update();
                customer.Retrieve();
            }

            NameValueCollection queryString = Page.Request.QueryString;
            this.selPage = queryString.Get("page");

            XmlDocument configXml = new XmlDocument();
            configXml.Load(MapPath(PATH_TO_CONFIG));

            XmlElement pageConf = (XmlElement)configXml.DocumentElement.GetElementsByTagName("pageconfig")[0];
            XmlElement tmpEl = (XmlElement)pageConf.SelectSingleNode("(//page)[@code='"+this.selPage+"']");

            if(tmpEl == null)
            {
                this.selPage = "home";
                tmpEl = (XmlElement)pageConf.SelectSingleNode("(//page)[@code='"+this.selPage+"']");
            }

            XmlNodeList tmpList = tmpEl.ChildNodes;
            int cnt = tmpList.Count;
            for(int i = 0; i < cnt; i++)
            {
                tmpEl = (XmlElement) tmpList[i];
                switch ( tmpEl.Name)
                {
                    case "title" : title = tmpEl.InnerText; break;
                    case "module" : centerModuleUrl = tmpEl.InnerText; break;
                    case "javascript" : javascript = tmpEl.InnerText; break;
                    case "login" : login = tmpEl.InnerText; break;
                    case "leftmenuoff" : leftMenuOff = tmpEl.InnerText == "yes"; break;
                }
            }

            string search;
            search = this.Request.Form["txtSearch"];
            if( search == null )
                try
                {
                    search = this.ViewState["searchParam"].ToString();	}
                catch{}

            if( search != null )
                this.ViewState["searchParam"] = search;

            this.navPage = this.selPage;
            if (leftMenuOff)
            {
                //tdLeftMenu.Visible = false;
                //tblCenter.Width = "556";
                imgLefCorner.Src = "../downloads/img/corner_r31.gif";
                imgLefCorner.Width = 152;
                tdLeftBordur.Visible = true;
            }
             //	CenterPlaceHolder
            CPLH.Controls.Add(LoadControl(centerModuleUrl));
            if (!leftMenuOff)
            //	CategoryListPlaceHolder
                    CLPLH.Controls.Add(LoadControl("category_list.ascx"));
            Trace.Write("in index Page_Load");
            //CategoryPathPlaceHolder
                CPPLH.Controls.Add(LoadControl("category_path.ascx"));
        }