protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["pid"] != null)
            {
                long productId;
                if (!long.TryParse(Request.Params["pid"], out productId))
                    productId = 0;
                Session["quotation.pid"] = productId;
            }

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludePage(HowItWorksInc, Resources.Resource.incHowItWorks);
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            string fullname = string.Empty;
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                fullname = ci.FirstName; //ci.GetFullName();
                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", fullname);
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            string email = Request.Params["email"] ?? "???";
            string format = Resources.Resource.fmtInviteSuccess;
            if (Request.Params["mode"] != null)
            {
                if (Request.Params["mode"] == "1")
                    format = Resources.Resource.fmtInviteExists;
            }
            InviteSuccessLiteral.Text = string.Format(format, email);

            if (!IsPostBack)
            {
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                IncludePage(AccountOverviewInc, Resources.Resource.incMemberHome);
                IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

                using (Database db = new MySqlDatabase())
                {

                    UserInfo ui = db.GetUser(Util.UserId);
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); //ci.GetFullName());
                    CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                    ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);

                    string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                    decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                    Session["percentComplete"] = percentComplete;
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
                }

                FillAccountInformation();

                int couponEntry = 0;
                if (Session["coupon.entry"] != null)
                    couponEntry = (int)Session["coupon.entry"];

                if (!IsPostBack)
                {
                    using (Database db = new MySqlDatabase())
                    {
                        int violationState = db.GetUserWhmcsClientId(Util.UserId);
                        if (violationState == 1)
                            couponEntry = 3;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Write(LogLevel.Error, ex, "AccountOverView<Exception>");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            Session["loggedinUserEmail"] = string.Empty;
            Util.GetUserClearanceLevels(Util.UserId, out _vcl, out _ecl);
            if (_vcl < 100 && _ecl < 100)
            {
                divManaccChk.Visible = false;
            }
            else
            {
                divManaccChk.Visible = true;
            }
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;
                Session["loggedinUserEmail"] = ui.Email;
                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);

                ddl_Language.SelectedValue = "nl";
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);

                ddl_Language.SelectedValue = "en";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "tracks";
            IncludePage(SelectProductInc, Resources.Resource.incSelectProduct);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            long userId = Util.UserId;

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            getProductList(userId);

            SetProductItemLinks();

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludePage(FAQInc, Resources.Resource.incFAQ);
            //IncludePage(ProtectInc, Resources.Resource.incProtect);
            //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement);
            UserInformation();
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                //CreditsLiteral.Text     = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
                //ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                ProtectedLiteral.Text = Convert.ToString(protectedTracks);
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "HighLightMenu", "HighLightMenu('" + "Menu4" + "');", true);
        }
        private void UserInformation()
        {
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = Convert.ToString(protectedTracks);

                MemberSince.Text = Convert.ToString(ui.MemberSince);

                string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                Session["percentComplete"] = percentComplete;
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "trackprotect";

            if (!IsPostBack)
            {
                using (Database db = new MySqlDatabase())
                {
                    UserInfo ui = db.GetUser(Util.UserId);
                    _ManAccClientInfo = db.GetClientInfo(Util.UserId);

                    Session["TPForUser"] = _ManAccClientInfo.FirstName;

                    #region Fill Managed User Info

                    FillManagedArtistDropDown();

                    PopulateSocialMediaInfo(db);

                    #endregion

                    Genre1.DataSource = db.getGenreList();
                    Genre1.DataTextField = "Value";
                    Genre1.DataValueField = "Key";
                    Genre1.DataBind();
                    Genre1.Items.Insert(0, new ListItem("--Select--", null));

                    Genre2.DataSource = db.getGenreList();
                    Genre2.DataTextField = "Value";
                    Genre2.DataValueField = "Key";
                    Genre2.DataBind();
                    Genre2.Items.Insert(0, new ListItem("--Select--", null));

                    Genre3.DataSource = db.getGenreList();
                    Genre3.DataTextField = "Value";
                    Genre3.DataValueField = "Key";
                    Genre3.DataBind();
                    Genre3.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre1.DataSource = null;
                    SubGenre1.DataBind();
                    SubGenre1.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre2.DataSource = null;
                    SubGenre2.DataBind();
                    SubGenre2.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre3.DataSource = null;
                    SubGenre3.DataBind();
                    SubGenre3.Items.Insert(0, new ListItem("--Select--", null));

                    #region Control Panel information

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = _ManAccClientInfo.FirstName;//_ManAccClientInfo.GetFullName();
                    CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
                    ProtectedLiteral.Text = Convert.ToString(protectedTracks);
                    decimal percentComplete = 0m;
                    if (Session["percentComplete"] != null)
                        percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);

                    #endregion

                    #region Removed Code

                    //string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                    //string identDocName = string.Format("ID{0:D10}.cer", ui.UserId);
                    //string identDocPath = Path.Combine(userDocPath, identDocName);

                    //if (!File.Exists(Server.MapPath(identDocPath)))
                    //{
                    //    litDialogText.Text = Resources.Resource.InfoIncomplete;
                    //    Master.PrepareMessageBox("Message", Resources.Resource.InfoIncomplete);
                    //}

                    #endregion

                    ShareToMyWall.Text = string.Format(Resources.Resource.ShareToMyWall, _ManAccClientInfo.FirstName);
                    ShareToMyFriends.Text = string.Format(Resources.Resource.ShareToMyFriends, _ManAccClientInfo.FirstName);
                    ShareToMyPages.Text = string.Format(Resources.Resource.ShareToMyPages, _ManAccClientInfo.FirstName);
                }

                Session["CoArtistsTable"] = null;

                Session["ReturnUrl"] = Request.QueryString["ReturnUrl"];
                CoArtistsTable = CreateCoArtistsTable();

                long userId = Util.UserId;
                int credits = Util.GetUserCredits(userId);
                bool controlsEnabled = (credits > 0);
                FileUpload1.Enabled = controlsEnabled;
                FileUpload2.Enabled = controlsEnabled;
                FileUpload3.Enabled = controlsEnabled;
                RegisterDocumentButton.Enabled = controlsEnabled;

                FillCoArtistsDropDown();
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "HighLightMenu", "HighLightMenu('" + "Menu3" + "');", true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "user-home";

            if (!IsPostBack)
            {
                int ecl, vcl;
                Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl);

                int tmp = 0;
                int pid = -1;
                decimal tmpDec = 0m;
                decimal unitprice = 0m;

                if (Request.Params["pid"] != null)
                {
                    if (int.TryParse(Request.Params["pid"], out tmp))
                        pid = tmp;
                    Session["subscription.productid"] = pid;
                    Session["pid"] = pid;
                }

                string desc = string.Empty;
                using (Database db = new MySqlDatabase())
                {
                    UserInfo ui = db.GetUser(Util.UserId);
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                    CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
                    ProtectedLiteral.Text = Convert.ToString(protectedTracks);
                    decimal percentComplete = 0m;
                    if (Session["percentComplete"] != null)
                        percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);

                    string unitpriceStr = db.GetSetting("unitprice");
                    if (decimal.TryParse(unitpriceStr, out tmpDec))
                        unitprice = tmpDec;
                    Session["subscription.unitprice"] = unitprice;
                    Session["amt"] = unitprice;

                    CultureInfo culture = null;

                    if (Convert.ToString(Session["culture"]).Contains("nl"))
                    {
                        culture = new CultureInfo("nl-NL");
                    }
                    else if (Convert.ToString(Session["culture"]).Contains("en"))
                    {
                        culture = new CultureInfo("en-US");
                    }
                    else
                    {
                        culture = new CultureInfo("nl-NL");
                    }

                    desc = db.GetProductDescription(pid, culture);
                    if (vcl >= 100 || ecl >= 100)
                        desc = Resources.Resource.SubscriptionPurchase;
                }

                SubscriptionLiteral.Text = desc;
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            this.Page.Form.DefaultButton = SubscriptionSubmit.UniqueID;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (Request.Params["res"] != null)
            {
                if (Request.Params["res"].ToLower() == "ok")
                    result0.Text = Resources.Resource.UploadCredentialsSuccess;
                else if (Request.Params["res"].ToLower() == "err")
                    result0.Text = Resources.Resource.UploadCredentialsFailed;
            }

            string res1 = string.Empty;
            if (!string.IsNullOrEmpty(Request.Params["t1"]))
            {
                char errCode = Request.Params["t1"][0];
                string file = Request.Params["t1"].Substring(1);
                switch (errCode)
                {
                    case 'E':
                        res1 = string.Format(Resources.Resource.FileStoreFailed, file);
                        break;
                    case 'O':
                        res1 = string.Format(Resources.Resource.FileStoreSuccess, file);
                        break;
                }
            }

            string res2 = string.Empty;
            if (!string.IsNullOrEmpty(Request.Params["t2"]))
            {
                char errCode = Request.Params["t2"][0];
                string file = Request.Params["t2"].Substring(1);
                switch (errCode)
                {
                    case 'E':
                        res2 = string.Format(Resources.Resource.FileStoreFailed, file);
                        break;
                    case 'O':
                        res2 = string.Format(Resources.Resource.FileStoreSuccess, file);
                        break;
                }
            }
            result1.Text = res1;
            result2.Text = res2;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "trackprotect";

            if (!IsPostBack)
            {
                RedirectToManaccPage();

                using (Database db = new MySqlDatabase())
                {
                    UserInfo ui = db.GetUser(Util.UserId);
                    _clientInfo = db.GetClientInfo(Util.UserId);

                    Session["TPForUser"] = _clientInfo.FirstName;

                    ViewState["isSoundCloudActive"] = FillSoundCloudInfo();

                    if (Convert.ToBoolean(ViewState["isSoundCloudActive"]) == true)
                    {
                        ViewState["isFacebookActive"] = FillFacebookInfo();

                        if (Convert.ToBoolean(ViewState["isFacebookActive"]))
                        {
                            FillFBPageList(Convert.ToString(Session["FBACC"]));
                            FillFBFriendList(Convert.ToString(Session["FBACC"]));
                        }

                        FillTwitterInfo();
                    }
                    else
                    {
                        #region Deactivate Facebook

                        Session["FBACC"] = Session["FBID"] = Session["AppId"] = Session["AppSecret"] = null;

                        cbxSendToFacebook.Enabled = false;

                        FacebookMsg.Enabled = false;

                        cbxSendToFacebook.Visible = false;

                        #endregion

                        #region Deactivate Facebook Pages

                        divShareToPages.Visible = false;

                        cbxShareToPages.Enabled = false;

                        cbxShareToPages.Visible = false;

                        dlPageList.Enabled = false;

                        #endregion

                        #region Deactivate Facebook Friends

                        divShareToFriends.Visible = false;

                        cbxShareToFriends.Enabled = false;

                        cbxShareToFriends.Visible = false;

                        dlFriendList.Enabled = false;

                        #endregion

                        #region Deactivate Twitter

                        cbxSendToTwitter.Enabled = false;

                        TwitterMsg.Enabled = false;

                        cbxSendToTwitter.Visible = false;

                        #endregion
                    }

                    Genre1.DataSource = db.getGenreList();
                    Genre1.DataTextField = "Value";
                    Genre1.DataValueField = "Key";
                    Genre1.DataBind();
                    Genre1.Items.Insert(0, new ListItem("--Select--", null));

                    Genre2.DataSource = db.getGenreList();
                    Genre2.DataTextField = "Value";
                    Genre2.DataValueField = "Key";
                    Genre2.DataBind();
                    Genre2.Items.Insert(0, new ListItem("--Select--", null));

                    Genre3.DataSource = db.getGenreList();
                    Genre3.DataTextField = "Value";
                    Genre3.DataValueField = "Key";
                    Genre3.DataBind();
                    Genre3.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre1.DataSource = null;
                    SubGenre1.DataBind();
                    SubGenre1.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre2.DataSource = null;
                    SubGenre2.DataBind();
                    SubGenre2.Items.Insert(0, new ListItem("--Select--", null));

                    SubGenre3.DataSource = null;
                    SubGenre3.DataBind();
                    SubGenre3.Items.Insert(0, new ListItem("--Select--", null));

                    #region Control Panel information

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", _clientInfo.FirstName);// _clientInfo.GetFullName());
                    CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));

                    if (string.IsNullOrEmpty(CreditsLiteral.Text.Trim()))
                        Response.Redirect("SelectProduct.aspx");
                    else if (Convert.ToInt32(CreditsLiteral.Text.Trim()) <= 0)
                        Response.Redirect("SelectProduct.aspx");

                    //ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                    ProtectedLiteral.Text = Convert.ToString(protectedTracks);
                    decimal percentComplete = 0m;
                    if (Session["percentComplete"] != null)
                        percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);

                    #endregion

                    #region Removed Code

                    //string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                    //string identDocName = string.Format("ID{0:D10}.cer", ui.UserId);
                    //string identDocPath = Path.Combine(userDocPath, identDocName);

                    //if (!File.Exists(Server.MapPath(identDocPath)))
                    //{
                    //    //litDialogText.Text = Resources.Resource.InfoIncomplete;
                    //    Master.PrepareMessageBox("Message", Resources.Resource.InfoIncomplete);
                    //}

                    #endregion

                    ShareToFriends.Text = string.Format(Resources.Resource.ShareToFriends, _clientInfo.FirstName);
                    ShareToPages.Text = string.Format(Resources.Resource.ShareToPages, _clientInfo.FirstName);
                }

                Session["CoArtistsTable"] = null;

                Session["ReturnUrl"] = Request.QueryString["ReturnUrl"];

                int credits = Util.GetUserCredits(Util.UserId);
                bool controlsEnabled = (credits > 0);
                FileUpload1.Enabled = controlsEnabled;
                FileUpload2.Enabled = controlsEnabled;
                FileUpload3.Enabled = controlsEnabled;
                IsrcPostfix.Enabled = controlsEnabled;
                RegisterDocumentButton.Enabled = controlsEnabled;

                using (Database db = new MySqlDatabase())
                {
                    ClientInfo ci = db.GetClientInfo(Util.UserId);
                    IsrcHandle.Text = string.Format("ISRC {0}-{1:D2}-", ci.IsrcCode, DateTime.Now.Year % 100);
                }

                FillCoArtistsDropDown();
            }

            if (CoArtistsTable == null)
            {
                DataTable table = new DataTable("coartists");
                table.Columns.Add("name", typeof(string));
                table.Columns.Add("role", typeof(string));
                table.Columns.Add("clientid", typeof(long));
                CoArtistsTable = table;
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "HighLightMenu", "HighLightMenu('" + "Menu3" + "');", true);
        }
        private void FillRegistrationGrid()
        {
            if (HttpContext.Current.Session["userid"] == null)
                return;

            int credits = Util.GetUserCredits(Util.UserId);

            long userid = Util.UserId;
            using (Database db = new MySqlDatabase())
            {
                DataSet registry = db.GetRegister(userid);

                if (registry.Tables["Table"].Rows.Count > 0)
                {
                    NotifyTpProtectTrackDiv.Visible = false;
                    DataView dataView = new DataView(registry.Tables["Table"]);
                    // RegistrationGrid.DataSource = dataView;
                    //RegistrationGrid.DataBind();
                    dlMyTracks.DataSource = dataView;
                    dlMyTracks.DataBind();
                }
                else
                {
                    NotifyTpProtectTrackDiv.Visible = true;
                    dlMyTracks.Visible = false;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            IncludePage(ProtectInc, Resources.Resource.incProtect);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            string email = Request.Params["email"] ?? "???";
            int error = Convert.ToInt32(Request.Params["err"] ?? "0");
            string errorText = string.Empty;
            switch (error)
            {
                case 0:
                    break;
                case 1: // bad email address
                    errorText = string.Format(Resources.Resource.errEmailBadFormat);
                    break;
                case 2: // can't send email
                    errorText = string.Format(Resources.Resource.errEmailCantSend);
                    InviteFailureLiteral.Text = string.Format(Resources.Resource.fmtInviteFailure, email, errorText);
                    break;
                case 3:
                    InviteFailureLiteral.Text = string.Format(Resources.Resource.fmtInviteSent, email);
                    break;
                case 4:
                    InviteFailureLiteral.Text = Resources.Resource.fmtInviteSelf;
                    break;
            }

            if (!IsPostBack)
            {
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "credits";
            IncludePage(FinancialEditInc, Resources.Resource.incFinancialOverview);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
                if (Session["culture"] != null)
                    _culture = Session["culture"] as string;
                long userId = Util.UserId;
                string passwd = Session["access"] as string;
                List<CreditHistory> creditHistory = null;
                using (Database db = new MySqlDatabase())
                {
                    _userDocumentPath = db.GetUserDocumentPath(userId, passwd);
                    creditHistory = db.GetCreditHistory(userId);
                }

                dlMyTracks.DataSource = creditHistory;
                dlMyTracks.DataBind();
                //Transactions transactions = Util.GetTransactions(Util.UserId);
                AddHeaders(FinancialOverviewTable);
                //foreach (Transaction transaction in transactions)
                //{
                //    AddTransaction(FinancialOverviewTable, transaction);
                //}
                foreach (CreditHistory ch in creditHistory)
                {
                    AddCreditHistory(FinancialOverviewTable, ch);
                }
                AddFooters(FinancialOverviewTable);
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "relationships";
            //IncludePage(ProtectInc, Resources.Resource.incProtect);
            //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            Util.GetUserClearanceLevels(Util.UserId, out _vcl, out _ecl);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
                TpIdButton.Height = TpIdText.Height;

                if (ManagedRelations == null)
                {
                    DataTable dt = new DataTable("artists");
                    dt.Columns.Add("name", typeof(string));
                    dt.Columns.Add("userid", typeof(long));
                    dt.Columns.Add("reltype", typeof(int));
                    dt.Columns.Add("manage", typeof(bool));
                    ManagedRelations = dt;
                }
                FillManagedRelationsTable();
                if (Invitations == null)
                {
                    DataTable dt = new DataTable("confirmations");
                    dt.Columns.Add("name", typeof(string));
                    dt.Columns.Add("email", typeof(string));
                    dt.Columns.Add("confirmation_id", typeof(long));
                    dt.Columns.Add("relation_type", typeof(int));
                    Invitations = dt;
                }
                FillInvitationsTable();
            }

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "user-home";

            bool couponEntryState = true;
            UserInfo ui = null;
            ClientInfo ci = null;
            string userDocPath = null;
            using (Database db = new MySqlDatabase())
            {
                db.ResetUserWhmcsClientd(Util.UserId);

                ui = db.GetUser(Util.UserId);
                ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); //ci.GetFullName());
                //CreditsLiteral.Text     = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
                //ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                ProtectedLiteral.Text = Convert.ToString(protectedTracks);

                couponEntryState = (db.GetUserWhmcsClientId(Util.UserId) == 0);
                userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
            }

            int vcl = 0, ecl = 0;
            Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl);
            //divManagedArtists.Visible = (vcl >= 100 || ecl >= 100);
            // managedArtist.Visible = (vcl >= 100 || ecl >= 100);
            fieldsMissing = false;
            decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
            ////Added by Nagesh to redirect user to complete profile page.
            //if (ui.IsActive == 0)
            //    Response.Redirect("~/FirstLogon.aspx?userId=" + ui.UserId);

            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(ci.GetFullName()))
                AddLine(sb, Resources.Resource.NoName);

            if (string.IsNullOrEmpty(ci.AddressLine1))
                AddLine(sb, Resources.Resource.NoAddress);

            if (string.IsNullOrEmpty(ci.City))
                AddLine(sb, Resources.Resource.NoResidence);

            if (string.IsNullOrEmpty(ci.OwnerKind))
                AddLine(sb, Resources.Resource.NoOwnerKind);

            if (string.IsNullOrEmpty(ci.TwitterId))
                AddLine(sb, Resources.Resource.NoTwitterId);

            if (string.IsNullOrEmpty(ci.FacebookId))
                AddLine(sb, Resources.Resource.NoFacebookId);

            if (string.IsNullOrEmpty(ci.SenaCode))
                AddLine(sb, Resources.Resource.NoSenaCode);

            if (string.IsNullOrEmpty(ci.IsrcCode))
                AddLine(sb, Resources.Resource.NoIsrcCode);

            string identDocName = string.Format("ID{0:D10}.cer", ui.UserId);
            string identDocPath = Path.Combine(userDocPath, identDocName);
            //if (!File.Exists(Server.MapPath(Request.ApplicationPath + identDocPath)))
            if (!File.Exists(identDocPath))
                AddLine(sb, Resources.Resource.NoCredentials);

            if (fieldsMissing)
                AddLine(sb, Resources.Resource.ClickToEdit);

            //MissingInfoPanel.Text = sb.ToString();
            //MissingInfoDiv.Visible = fieldsMissing;

            Session["percentComplete"] = percentComplete;

            CompletedLiteral.Text = string.Empty;
            if (percentComplete < 100)
                CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
            divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);

            //CouponCodeEdit.Enabled = couponEntryState;
            //CouponCodeGo.Enabled = couponEntryState;

            //------- Highlight the selected lang button ------- !

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "HighLightMenu", "HighLightMenu('" + "Menu1" + "');", true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "user-home";

            if (!IsPostBack)
            {
                using (Database db = new MySqlDatabase())
                {
                    UserInfo ui = db.GetUser(Util.UserId);
                    ClientInfo ci = db.GetClientInfo(Util.UserId);

                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                    CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                    ProtectedLiteral.Text = protectedTracks.ToString();
                    decimal percentComplete = 0m;
                    if (Session["percentComplete"] != null)
                        percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
                }

                //using (Database db = new MySqlDatabase())
                //{
                //    ClientInfo ci = db.GetClientInfo(Util.UserId);
                //    string accessToken = db.GetSocialCredential(ci.ClientId, SocialConnector.Facebook, "accesstoken");

                //    FriendService fbFriendService = new FriendService(accessToken);

                //    //GetFacebookFriendList(accessToken);

                //    List<Friend> friendList = fbFriendService.Get();
                //}
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "tracks";
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["id"]))
                {
                    long managedUserId = Convert.ToInt64(Request["id"]);
                    Session["managed.userid"] = managedUserId;
                    FillRegistrationGrid(Util.UserId, managedUserId);
                }
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript
                    (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript
                    (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        private void UpdateUserStatusPanel()
        {
            UserInfo ui = null;
            ClientInfo ci = null;
            string userDocPath = null;
            using (Database db = new MySqlDatabase())
            {
                db.ResetUserWhmcsClientd(Util.UserId);

                ui = db.GetUser(Util.UserId);
                ci = db.GetClientInfo(Util.UserId);
                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.GetFullName());
                CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);

                userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
            }

            int vcl = 0, ecl = 0;
            Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl);

            decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
            CompletedLiteral.Text = string.Empty;
            if (percentComplete < 100)
                CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
            ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "coupon";
            UserInfo ui = null;
            ClientInfo ci = null;

            new BasePage();

            using (Database db = new MySqlDatabase())
            {
                ui = db.GetUser(Util.UserId);
                ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName); // ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);

                if (Convert.ToString(Session["culture"]).Contains("nl"))
                {
                    ClientScript.RegisterStartupScript
                        (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                    ClientScript.RegisterStartupScript
                        (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript
                        (this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                    ClientScript.RegisterStartupScript
                        (this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                }

                divTrackProtected.Visible = true;

                if (Convert.ToBoolean(Session["TrackProtected"]) == true)
                {
                    TrackProtected.Text = Resources.Resource.TrackProtectedSuccessNotify;

                    #region SoundCloud

                    divSoundCloudPost.Visible = true;

                    if (Convert.ToString(Session["SoundCloud.Response"]).Contains("Deactive"))
                        divSoundCloudPost.Visible = false;
                    else if (Convert.ToString(Session["SoundCloud.Response"]).Contains("Error"))
                        SoundCloudPost.Text = Resources.Resource.SoundCloudPostFailureNotify;
                    else if (!string.IsNullOrEmpty(Convert.ToString(Session["SoundCloud.Response"])))
                        SoundCloudPost.Text = Resources.Resource.SoundCloudPostSuccessNotify;

                    #endregion

                    #region Facebook My/User wall

                    if (Request.QueryString["type"] == "own")
                    {
                        divFacebookPost.Visible = true;

                        if (Convert.ToString(Session["Facebook.Response"]).Contains("Deactive"))
                            divFacebookPost.Visible = false;
                        else if (Convert.ToString(Session["Facebook.Response"]).Contains("Error"))
                            FacebookPost.Text = string.Format(Resources.Resource.FacebookPostOnOwnWallFailureNotify, Convert.ToString(Session["TPForUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["Facebook.Response"])))
                            FacebookPost.Text = string.Format(Resources.Resource.FacebookPostOnOwnWallSuccessNotify, Convert.ToString(Session["TPForUser"]));
                    }
                    else
                    {
                        divFacebookPost.Visible = true;

                        if (Convert.ToString(Session["Facebook.Response"]).Contains("Deactive"))
                            divFacebookPost.Visible = false;
                        else if (Convert.ToString(Session["Facebook.Response"]).Contains("Error"))
                            FacebookPost.Text = string.Format(Resources.Resource.FacebookPostOnUserWallFailureNotify, Convert.ToString(Session["ManagedUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["Facebook.Response"])))
                            FacebookPost.Text = string.Format(Resources.Resource.FacebookPostOnUserWallSuccessNotify, Convert.ToString(Session["ManagedUser"]));
                    }

                    #endregion

                    #region Facebook Genre

                    divFacebookGenreCommunityPost.Visible = true;

                    if (Convert.ToString(Session["FacebookGenre.Response"]).Contains("Deactive"))
                        divFacebookGenreCommunityPost.Visible = false;
                    else if (Convert.ToString(Session["FacebookGenre.Response"]).Contains("Error"))
                        FacebookGenreCommunityPost.Text = string.Format(Resources.Resource.FacebookGenreCommunityPostFailureNotify, Convert.ToString(Session["GenrePageName"]));
                    else if (!string.IsNullOrEmpty(Convert.ToString(Session["FacebookGenre.Response"])))
                        FacebookGenreCommunityPost.Text = string.Format(Resources.Resource.FacebookGenreCommunityPostSuccessNotify, Convert.ToString(Session["GenrePageName"]));

                    #endregion

                    #region Facebook SubGenre

                    divFacebookSubGenreCommunityPost.Visible = true;

                    if (Convert.ToString(Session["FacebookSubGenre.Response"]).Contains("Deactive"))
                        divFacebookSubGenreCommunityPost.Visible = false;
                    else if (Convert.ToString(Session["FacebookSubGenre.Response"]).Contains("Error"))
                        FacebookSubGenreCommunityPost.Text = string.Format(Resources.Resource.FacebookGenreCommunityPostFailureNotify, Convert.ToString(Session["SubGenrePageName"]));
                    else if (!string.IsNullOrEmpty(Convert.ToString(Session["FacebookSubGenre.Response"])))
                        FacebookSubGenreCommunityPost.Text = string.Format(Resources.Resource.FacebookGenreCommunityPostSuccessNotify, Convert.ToString(Session["SubGenrePageName"]));

                    #endregion

                    #region Facebook to Friends

                    if (Request.QueryString["type"] == "own")
                    {
                        divPostOnFriendWall.Visible = true;

                        if (Convert.ToString(Session["ShareToFriends"]).Contains("Deactive"))
                            divPostOnFriendWall.Visible = false;
                        else if (Convert.ToString(Session["ShareToFriends"]).Contains("Error"))
                            PostOnFriendWall.Text = string.Format(Resources.Resource.PostOnMyFriendWallFailureNotify, Convert.ToString(Session["TPForUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToFriends"])))
                            PostOnFriendWall.Text = string.Format(Resources.Resource.PostOnMyFriendWallSuccessNotify, Convert.ToString(Session["TPForUser"]));
                    }
                    else
                    {
                        divPostOnFriendWall.Visible = true;

                        if (Convert.ToString(Session["ShareToFriends"]).Contains("Deactive"))
                            divPostOnFriendWall.Visible = false;
                        else if (Convert.ToString(Session["ShareToFriends"]).Contains("Error"))
                            PostOnFriendWall.Text = string.Format(Resources.Resource.PostOnFriendWallFailureNotify, Convert.ToString(Session["ManagedUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToFriends"])))
                            PostOnFriendWall.Text = string.Format(Resources.Resource.PostOnFriendWallSuccessNotify, Convert.ToString(Session["ManagedUser"]));
                    }

                    #endregion

                    #region Facebook to Pages

                    if (Request.QueryString["type"] == "own")
                    {
                        divPostOnPages.Visible = true;

                        if (Convert.ToString(Session["ShareToPages"]).Contains("Deactive"))
                            divPostOnPages.Visible = false;
                        else if (Convert.ToString(Session["ShareToPages"]).Contains("Error"))
                            PostOnPages.Text = string.Format(Resources.Resource.PostOnMyPagesFailureNotify, Convert.ToString(Session["TPForUser"]), "");
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToPages"])))
                            PostOnPages.Text = string.Format(Resources.Resource.PostOnMyPagesSuccessNotify, Convert.ToString(Session["TPForUser"]), "");
                    }
                    else
                    {
                        divPostOnPages.Visible = true;

                        if (Convert.ToString(Session["ShareToPages"]).Contains("Deactive"))
                            divPostOnPages.Visible = false;
                        else if (Convert.ToString(Session["ShareToPages"]).Contains("Error"))
                            PostOnPages.Text = string.Format(Resources.Resource.PostOnPagesFailureNotify, Convert.ToString(Session["ManagedUser"]), "");
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToPages"])))
                            PostOnPages.Text = string.Format(Resources.Resource.PostOnPagesSuccessNotify, Convert.ToString(Session["ManagedUser"]), "");
                    }

                    #endregion

                    if (Request.QueryString["type"] != "own")
                    {
                        divPostToOwnWall.Visible = true;

                        if (Convert.ToString(Session["FacebookOwnPage.Response"]).Contains("Deactive"))
                            divPostOnPages.Visible = false;
                        else if (Convert.ToString(Session["FacebookOwnPage.Response"]).Contains("Error"))
                            PostToOwnWall.Text =
                              string.Format(Resources.Resource.FacebookPostOnOwnWallFailureNotify, Convert.ToString(Session["TPForUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["FacebookOwnPage.Response"])))
                            PostToOwnWall.Text =
                                string.Format(Resources.Resource.FacebookPostOnOwnWallSuccessNotify, Convert.ToString(Session["TPForUser"]));

                        divPostOnMyFriendWall.Visible = true;

                        if (Convert.ToString(Session["ShareToOwnFriends"]).Contains("Deactive"))
                            divPostOnMyFriendWall.Visible = false;
                        else if (Convert.ToString(Session["ShareToOwnFriends"]).Contains("Error"))
                            PostOnMyFriendWall.Text = string.Format(Resources.Resource.PostOnMyFriendWallFailureNotify, Convert.ToString(Session["TPForUser"]));
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToOwnFriends"])))
                            PostOnMyFriendWall.Text = string.Format(Resources.Resource.PostOnMyFriendWallSuccessNotify, Convert.ToString(Session["TPForUser"]));

                        divPostOnMyPages.Visible = true;

                        if (Convert.ToString(Session["ShareToOwnPages"]).Contains("Deactive"))
                            divPostOnMyPages.Visible = false;
                        else if (Convert.ToString(Session["ShareToOwnPages"]).Contains("Error"))
                            PostOnMyPages.Text = string.Format(Resources.Resource.PostOnMyPagesFailureNotify, Convert.ToString(Session["TPForUser"]), "");
                        else if (!string.IsNullOrEmpty(Convert.ToString(Session["ShareToOwnPages"])))
                            PostOnMyPages.Text = string.Format(Resources.Resource.PostOnMyPagesSuccessNotify, Convert.ToString(Session["TPForUser"]), "");
                    }

                    #region Twitter

                    divTwitterpost.Visible = true;

                    if (Convert.ToString(Session["Twitter.Response"]).Contains("Deactive"))
                        divTwitterpost.Visible = false;
                    else if (Convert.ToString(Session["Twitter.Response"]).Contains("Error"))
                        Twitterpost.Text = Resources.Resource.TwitterpostFailureNotify;
                    else if (!string.IsNullOrEmpty(Convert.ToString(Session["Twitter.Response"])))
                        Twitterpost.Text = Resources.Resource.TwitterpostSuccessNotify;

                    #endregion
                }
                else
                {
                    TrackProtected.Text = Resources.Resource.TrackProtectedFailureNotify;
                }
            }
        }
        /// <summary>
        /// Handler for the Page_Load event of this page
        /// </summary>
        /// <param name="sender">the sender of this event</param>
        /// <param name="e">the arguments associated with this event</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                IncludePage(MemberHomeInc, Resources.Resource.incMemberHome);
                IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

                using (Database db = new MySqlDatabase())
                {
                    UserInfo ui = db.GetUser(Util.UserId);
                    ClientInfo ci = db.GetClientInfo(Util.UserId);
                    DataSet ds = db.GetRegister(Util.UserId);
                    int protectedTracks = ds.Tables[0].Rows.Count;

                    LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                    LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.GetFullName());
                    CreditsLiteral.Text = string.Format(Resources.Resource.spnCredits, Util.GetUserCredits(Util.UserId));
                    ProtectedLiteral.Text = string.Format(Resources.Resource.spnProtected, protectedTracks);
                    string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                    decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                    Session["percentComplete"] = percentComplete;
                    CompletedLiteral.Text = string.Empty;
                    if (percentComplete < 100)
                        CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                    ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
                }

                if (!IsPostBack)
                {
                    FillAccountInformation();
                    Language.Attributes["onchange"] = string.Format("storeSelection({0}, {1});", Language.ClientID,
                                                                    LanguageIndex.ClientID);
                    TriggerCountryOnChange(Language.ClientID, LanguageIndex.ClientID, _countrySelectedIndex);

                    //Birthday.MaxDate = DateTime.Now;
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Write(LogLevel.Error, ex, "MemberEdit<Exception>");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "coupon";
            // IncludePage(ProtectInc, Resources.Resource.incProtect);
            //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Util.UserId);
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName);// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

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

                int couponCodeCount = 0;
                if (Session["coupon.entry"] != null)
                    couponCodeCount = (int)Session["coupon.entry"];
                if (couponCodeCount < 3)
                    ++couponCodeCount;
                Session["coupon.entry"] = couponCodeCount;

                if (couponCodeCount < 3)
                {
                    ErrorCode.Text = string.Format("<span style=\"color: orange;\">{0}</span>", Resources.Resource.CouponIncorrect);
                }
                else
                {
                    string couponCode = Request.Params["couponcode"];
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(Util.UserId);
                        ErrorCode.Text = string.Format("<span style=\"color: red;\">{0}</span>",
                                                       Resources.Resource.CouponError);
                        StringBuilder body = new StringBuilder();
                        body.AppendFormat("The user with id {0} ({1}) entered too many invalid coupon codes.",
                                          Util.UserId, ci.GetFullName());
                        body.Append(Environment.NewLine);
                        body.AppendFormat("The last coupon code entered was {0}.", couponCode);
                        body.Append(Environment.NewLine);
                        body.Append("Coupon code entry was disabled");

                        Util.SendEmail(new string[] { cfg["email.admin"] }, "*****@*****.**", "Invalid coupon entry", body.ToString(), null,0);

                        // Register entry violation in the database
                        // Alright. Some abuse here, we're going to use the whmcsclient_id here to store the violation.
                        // The id isn't used anymore since whmcs has been abandoned and thus it remains simply an integer.
                        db.UpdateUserWhmcsClientId(Util.UserId, 1);
                    }
                }
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // IncludePage(ProtectInc, Resources.Resource.incProtect);
            //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);
            Session["bodyid"] = "coupon";
            UserInfo ui = null;
            ClientInfo ci = null;
            using (Database db = new MySqlDatabase())
            {
                ui = db.GetUser(Util.UserId);
                ci = db.GetClientInfo(Util.UserId);

                DataSet ds = db.GetRegister(Util.UserId);
                int protectedTracks = ds.Tables[0].Rows.Count;

                LoggedOnTitle.Text = Resources.Resource.LoggedOnTitle;
                LoggedOnUserName.Text = string.Format("<span><b>{0}</b></span>", ci.FirstName );// ci.GetFullName());
                CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                decimal percentComplete = 0m;
                if (Session["percentComplete"] != null)
                    percentComplete = Convert.ToDecimal(Session["percentComplete"]);
                CompletedLiteral.Text = string.Empty;
                if (percentComplete < 100)
                    CompletedLiteral.Text = string.Format(Resources.Resource.PercentComplete, percentComplete / 100m);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_HeadLoginView_LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_HeadLoginView_LanguageNL" + "');", true);
            }

            int addedCredits = 0;

            addedCredits = Convert.ToInt32(Request.Params["cradd"]);
            CouponCredits.Text = string.Format(Resources.Resource.fmtCouponCredits, addedCredits, Util.GetUserCredits(Util.UserId));

            string body = Util.GetEmailTemplate(HttpContext.Current.Server.MapPath(Resources.Resource.tplCouponActivated));

            body = body.Replace("{%EmailHeaderLogo%}", ConfigurationManager.AppSettings["EmailHeaderLogo"]);
            body = body.Replace("{%EmailmailToLink%}", ConfigurationManager.AppSettings["EmailmailToLink"]);
            body = body.Replace("{%SiteNavigationLink%}", ConfigurationManager.AppSettings["SiteNavigationLink"]);
            body = body.Replace("{%EmailFooterLogo%}", ConfigurationManager.AppSettings["EmailFooterLogo"]);
            body = body.Replace("{%EmailFBlink%}", ConfigurationManager.AppSettings["EmailFBlink"]);
            body = body.Replace("{%EmailFBLogo%}", ConfigurationManager.AppSettings["EmailFBLogo"]);
            body = body.Replace("{%EmailTwitterLink%}", ConfigurationManager.AppSettings["EmailTwitterLink"]);
            body = body.Replace("{%EmailTwitterLogo%}", ConfigurationManager.AppSettings["EmailTwitterLogo"]);
            body = body.Replace("{%EmailSoundCloudLink%}", ConfigurationManager.AppSettings["EmailSoundCloudLink"]);
            body = body.Replace("{%EmailSoundCloudLogo%}", ConfigurationManager.AppSettings["EmailSoundCloudLogo"]);

            body = body.Replace("{%receivingRelation%}", ci.GetFullName());
            body = body.Replace("{%credits%}", addedCredits.ToString());
            Util.SendEmail(new string[] { ui.Email }, "*****@*****.**", Resources.Resource.CouponSubject, body, null, 0);

            CreditsLiteral.Text = Util.GetUserCredits(Util.UserId).ToString();
        }