Exemplo n.º 1
0
        private Logger()
        {
            if (!_log.IsAttached || _logw == null)
            {
                Config cfg = new Config();
                cfg.Load(HttpContext.Current.Server.MapPath("~/Config/trackprotect.config"));
                string logfile = cfg["logfile"];
                if (logfile.StartsWith("~"))
                    logfile = HttpContext.Current.Server.MapPath(logfile);

                //Page page = HttpContext.Current.Handler as Page;
                //page.Response.Write (string.Format ("logfile: {0}<br/>", logfile));

                _logw = new LogWriter(_log, logfile);
                _log.Start();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["culture"] == null)
                {
                    string culture = Request.UserLanguages[0];
                    Session["culture"] = culture;
                    Culture = culture;
                    UICulture = culture;

                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
                }
            }

            if (!User.Identity.IsAuthenticated)
            {
                ClearUserSession();
            }
            else
            {
                if (Session["userid"] != null &&
                    Session["useruid"] != null &&
                    Session["access"] != null &&
                    Session["subscriptiontype"] != null)
                {
                    Response.Redirect("~/Member/MemberHome.aspx", false);
                }
            }

            IncludePage(DefaultInc, Resources.Resource.incDefault);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement);

            if (!IsPostBack)
            {
                Config cfg = new Config();
                cfg.Load(Server.MapPath("~/Config/trackprotect.config"));

                using (Database db = new MySqlDatabase())
                {
                    RegisterStarterButton.CommandName = "-1";
                    RegisterMediumButton.CommandName = "-1";
                    RegisterProButton.CommandName = "-1";
                    RegisterEnterpriseButton.CommandName = "-1";

                    ProductInfoList pil = db.GetProducts();
                    foreach (ProductInfo pi in pil)
                    {
                        switch (pi.ProductId)
                        {
                            case 1: RegisterStarterButton.CommandName = pi.ProductId.ToString(); break;
                            case 2: RegisterMediumButton.CommandName = pi.ProductId.ToString(); break;
                            case 3: RegisterProButton.CommandName = pi.ProductId.ToString(); break;
                            case 4: RegisterEnterpriseButton.CommandName = pi.ProductId.ToString(); break;
                        }
                    }
                }
            }
            else { }
        }