protected void AuthenticateUser()
        {
            string userID = Request.QueryString["userId"];

            string key = Request.QueryString["key"].Replace(" ", "+");
            string pwd = EncryptionClass.Decrypt(key);
            string email = string.Empty;

            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(Convert.ToInt64(userID));
                email = ui.Email;

                ClientInfo ci = db.GetClientInfo(Convert.ToInt64(userID));

                Session["UserName"] = ci.GetFullName();
            }

            string username = Membership.GetUserNameByEmail(email);

            FormsAuthentication.SetAuthCookie(username, false);

            FormsAuthenticationTicket ticket1 =
               new FormsAuthenticationTicket(
                    1,                                   // version
                    username,   // get username  from the form
                    DateTime.Now,                        // issue time is now
                    DateTime.Now.AddMinutes(10),         // expires in 10 minutes
                    false,      // cookie is not persistent
                    ""                              // role assignment is stored
                // in userData
                    );
            HttpCookie cookie1 = new HttpCookie(
              FormsAuthentication.FormsCookieName,
              FormsAuthentication.Encrypt(ticket1));
            Response.Cookies.Add(cookie1);

            Membership.ValidateUser(username, pwd);

            // 4. Do the redirect.
            String returnUrl1;

            // the login is successful
            returnUrl1 = "FirstLogon.aspx";
            Response.Redirect(returnUrl1);
        }
        public override bool ValidateUser(string username, string password)
        {
            bool isValid = false;

            using (Database db = new MySqlDatabase())
            {
                UserState us = db.VerifyUser(username, password);
                if (us.State >= 0)
                {
                    UserInfo ui = db.GetUser(username, password);
                    if (ui != null && CheckPassword(md5(password), ui.Password))
                    {
                        if (ui.IsApproved > 0)
                        {
                            isValid = true;
                            HttpContext.Current.Session["access"] = password;
                            HttpContext.Current.Session["useruid"] = ui.UserUid;
                            HttpContext.Current.Session["userid"] = ui.UserId;

                            db.UpdateUserLogon(username, _applicationName);
                            string culture = "en-US";
                            ClientInfo ci = db.GetClientInfo(ui.UserId);
                            if (ci != null)
                            {
                                if (!string.IsNullOrEmpty(ci.Country) && !string.IsNullOrEmpty(ci.Language))
                                {
                                    string cultLang = Util.GetLanguageCodeByEnglishName(ci.Language);
                                    string cultCtry = Util.GetCountryIso2(ci.Country);
                                    culture = string.Format("{0}-{1}", cultLang, cultCtry);
                                }
                            }
                            if (string.IsNullOrEmpty(culture) || culture == "-")
                                culture = "en-US";

                            //HttpContext.Current.Session["culture"] = culture;
                        }
                    }
                }
            }

            return isValid;
        }
 public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
 {
     MembershipUser u = null;
     using (Database db = new MySqlDatabase())
     {
         u = db.GetUser(Name, providerUserKey, _applicationName, userIsOnline);
     }
     return u;
 }
 public override MembershipUser GetUser(string username, bool userIsOnline)
 {
     MembershipUser user = null;
     using (Database db = new MySqlDatabase())
     {
         user = db.GetUser(Name, username, _applicationName, userIsOnline);
     }
     return user;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "user-home";

            //IncludePage(PayResultInc, Resources.Resource.incPayResult);
            //IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

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

                name = ci.FirstName;
                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 res = Request.Params["res"] ?? "unknown";
            if (!string.IsNullOrEmpty(res))
            {
                switch (res.ToLower())
                {
                    case "success":
                        ProcessTransaction();
                        break;

                    case "error":
                        ProcessFailure();
                        break;

                    case "postback":
                        ProcessPostback();
                        break;

                    default:
                        break;
                }
            }

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

            CreditsLiteral.Text = Convert.ToString(Util.GetUserCredits(Util.UserId));
        }
        private void SendMail(long userId)
        {
            string SignUpBody = string.Empty;

            string SignUpSubject = Resources.Resource.ManualSighUpEmailSubject;

            if (Convert.ToString(Session["SignUpMode"]).Contains("Facebook logon"))
                SignUpBody = Resources.Resource.FBAccountCreation;
            else
                SignUpBody = Resources.Resource.ManualSighUpEmailBody;

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

                StringBuilder body = new StringBuilder();
                using (TextReader rdr = new StreamReader(Server.MapPath(SignUpBody)))
                {
                    string fname = ci.FirstName;
                    string text = rdr.ReadToEnd();

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

                    text = text.Replace("{%firstname%}", ci.FirstName);
                    text = text.Replace("{%email%}", ui.Email);
                    text = text.Replace("{%password%}", Convert.ToString(ViewState["pwd"]));

                    //string link = "<a href=\"http://test.trackprotect.com/FirstLogon.aspx?userId=\"" + Util.UserId + "&email=" + ui.Email + "&password="******"\"> Click Here </a>";

                    string loginlink = ConfigurationManager.AppSettings["SiteNavigationLink"];
                    text = text.Replace("{%loginlink%}", loginlink);

                    string memberlink = ConfigurationManager.AppSettings["SiteNavigationLink"] + "/Member/MemberHome.aspx";
                    text = text.Replace("{%memberhomelink%}", memberlink);

                    body.Append(text);
                }

                Util.SendEmail(new string[] { ui.Email }, "*****@*****.**", SignUpSubject, body.ToString(), null,0);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string culture = "nl-NL";
            if (Session["culture"] != null)
                culture = Session["culture"] as string;

            IncludePage(ShowProductInc, Resources.Resource.incShowProduct);
            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);
            }

            long userid = Util.UserId;

            if (!IsPostBack)
            {
                DescriptionLiteral.Text = string.Empty;
                int pid = 0;
                if (Request.Params["pid"] != null)
                {
                    string tmp = Request.Params["pid"];
                    if (!string.IsNullOrEmpty(tmp))
                    {
                        int iTmp;
                        if (int.TryParse(tmp, out iTmp))
                            pid = iTmp;
                    }
                }
                if (pid <= 0)
                {
                    DescriptionLiteral.Text = Resources.Resource.NoProductDescription;
                }
                else
                {
                    string[] _desc = new string[] { "starter", "medium", "pro", "bulk" };

                    DescriptionImage.ImageUrl = string.Format(Resources.Resource.imgVaultFmt, _desc[pid - 1]);
                    using (Database db = new MySqlDatabase())
                    {
                        ProductInfoList pil = db.GetProducts();
                        foreach (ProductInfo pi in pil)
                        {
                            if (pi.ProductId == pid)
                            {
                                BuyProductButton.Visible = true;
                                BuyProductButton.CommandName = pid.ToString();
                                /*
                                if (User.Identity.IsAuthenticated)
                                    BuyProductButton.Visible = true;
                                */

                                StringBuilder pricingInfo = new StringBuilder();
                                string iso2Country = "NL";
                                string isoCurrency = "EUR";
                                if (userid > -1)
                                {
                                    ClientInfo ci = db.GetClientInfo(userid);
                                    if (ci != null)
                                    {
                                        iso2Country = Util.GetCountryIso2(ci.Country);
                                        isoCurrency = Util.GetCurrencyIsoNameByCountryIso2(iso2Country);
                                    }
                                }
                                ProductPriceInfoList ppil = db.GetProductPrices(pi.ProductId, culture);
                                if (ppil.Count > 0)
                                {
                                    pricingInfo.Append("<table cellpadding='4'>");
                                    foreach (ProductPriceInfo ppi in ppil)
                                    {
                                        if (ppi.Price == 0m)
                                        {
                                            pricingInfo.AppendFormat(
                                                "<tr><td><span class='priceInfo'>{0}</span></td></tr>", Resources.Resource.RequestQuotation);
                                        }
                                        else
                                        {
                                            string curr = Util.GetCurrencySymbolByCountryIso2("NL");
                                            string currFmt = Util.GetCurrencyFormatByCountryIso2("NL");
                                            pricingInfo.AppendFormat("<tr><td><span class='priceInfo'>{0}</span></td><td><span class='priceInfo'>", Resources.Resource.Price);
                                            pricingInfo.AppendFormat(currFmt, curr, ppi.Price);
                                            pricingInfo.Append("</span></td></tr>");
                                        }
                                    }
                                    pricingInfo.Append("</table>");
                                }

                                TitleLiteral.Text = db.GetProductTitle(pi.ProductId, culture);

                                string desc = db.GetProductDescription(pi.ProductId, culture);
                                if (string.IsNullOrEmpty(desc))
                                    desc = pi.Description;

                                if (string.IsNullOrEmpty(desc))
                                    DescriptionLiteral.Text = "<p><h1>" + pi.Name + "</h1></p>" + pricingInfo.ToString();
                                else
                                    DescriptionLiteral.Text = desc + pricingInfo.ToString();
                            }
                        }
                    }
                }
            }
            else
            {
            }
        }
        private bool isProfileCompleted()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["userId"]))
            {
                Util.UserId = Convert.ToInt64(Request.QueryString["userId"]);
            }

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

                string userDocPath = db.GetUserDocumentPath(ui.UserId, Session["access"] as string);
                decimal percentComplete = DetermineCompletion(userDocPath, ui, ci);
                Session["percentComplete"] = percentComplete;

                Session["isActive"] = ui.IsActive;
                if (percentComplete < 100)
                    return false;
                else
                    return true;
            }
        }
        internal static string CreateInvoice(long userId, string status, string transid, string paymentmethod, ProductInfo productInfo, ProductPriceInfo ppi)
        {
            string companyName = string.Empty;
            string userPath = String.Empty;
            string password = HttpContext.Current.Session["access"] as string;
            UserInfo userInfo = null;
            ClientInfo clientInfo = null;
            using (Database db = new MySqlDatabase())
            {
                userPath = db.GetUserDocumentPath(userId, password);

                userPath = userPath.Replace("\\", "/");

                if (!Directory.Exists(userPath))
                    Directory.CreateDirectory(userPath);

                userInfo = db.GetUser(userId, password);
                clientInfo = db.GetClientInfo(userId);

                companyName = clientInfo.CompanyName;
            }
            // complete userPath with document name
            string filename = String.Format("INV{0}.pdf", transid);
            userPath = Path.Combine(userPath, filename);

            // Get the invoice template from the proper location
            string templatePath = Resource.InvoiceTemplate;
            string invoiceTemplate = HttpContext.Current.Server.MapPath(templatePath);
            try
            {
                InvoiceForm form = new InvoiceForm(invoiceTemplate);
                string culture = "nl-NL";
                if (HttpContext.Current.Session["culture"] != null)
                    culture = HttpContext.Current.Session["culture"] as string;
                CultureInfo cultureInfo = new CultureInfo(culture);

                List<string> fields = new List<string>();
                fields.Add(clientInfo.GetFullName());
                fields.Add(clientInfo.AddressLine1);
                if (!string.IsNullOrEmpty(clientInfo.AddressLine2))
                    fields.Add(clientInfo.AddressLine2);
                string tmpResidence = clientInfo.ZipCode + " " + clientInfo.City.ToUpper();
                if (!string.IsNullOrEmpty(tmpResidence))
                    fields.Add(tmpResidence);
                if (!string.IsNullOrEmpty(clientInfo.Country))
                    fields.Add(clientInfo.Country);
                while (fields.Count < 5)
                    fields.Add(" ");

                form.ClientAddress = fields.ToArray();
                form.InvoiceDate = DateTime.Now.ToString("d", cultureInfo);
                form.InvoiceNumber = transid;
                using (Database db = new MySqlDatabase())
                {
                    Transaction transaction = db.GetTransaction(Util.UserId, transid);
                    foreach (TransactionLine tl in transaction.TransactionLines)
                    {
                        form.InvoiceLines.Add(new PdfInvoiceLine()
                        {
                            Description = tl.Description,
                            Quantity = tl.Quantity,
                            UnitPrice = tl.Price,
                            VatRate = tl.VatPercentage
                        });
                    }
                }
                form.GenerateInvoice(userPath, companyName);
            }
            catch (Exception ex)
            {
                Logger.Instance.Write(LogLevel.Error, ex, "[CreateInvoice]");
            }

            SendInvoice(userId, userPath);

            return userPath;
        }
示例#10
0
 private static UserInfo GetUserInfo()
 {
     UserInfo res = new UserInfo();
     using (Database db = new MySqlDatabase())
     {
         res = db.GetUser(Util.UserId);
     }
     return res;
 }
示例#11
0
        public static void SendRegistration(long userId, string userPath, string trackname, params string[] attachments)
        {
            UserInfo ui = null;
            ClientInfo ci = null;
            using (Database db = new MySqlDatabase())
            {
                ui = db.GetUser(userId);
                ci = db.GetClientInfo(userId);
            }

            using (TextReader rdr = new StreamReader(HttpContext.Current.Server.MapPath(Resource.tplRegistration)))
            {
                string body = rdr.ReadToEnd();
                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());
                string subject = string.Format(Resources.Resource.SubjectYourRegistration, trackname);
                SendEmail(new string[] { ui.Email }, "*****@*****.**", subject, body, attachments, userId);
            }
        }
示例#12
0
 public static UserInfo GetUserInfo(long userId)
 {
     using (Database db = new MySqlDatabase())
     {
         return db.GetUser(userId);
     }
 }
示例#13
0
        public static void GetUserClearanceLevels(long userId, out int vcl, out int ecl)
        {
            vcl = 0;
            ecl = 0;
            using (Database db = new MySqlDatabase())
            {
                UserInfo ui = db.GetUser(userId);
                if (string.IsNullOrEmpty(ui.Comment))
                    return;

                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(ui.Comment);
                    XmlNodeList settings = doc.SelectNodes("/settings/setting");
                    foreach (XmlNode setting in settings)
                    {
                        if (setting.Attributes.Count > 0)
                        {
                            string attrName = string.Empty;
                            string attrValue = string.Empty;
                            foreach (XmlAttribute attr in setting.Attributes)
                            {
                                if (attr.Name.ToLower() == "name")
                                    attrName = attr.Value;
                                if (attr.Name.ToLower() == "value")
                                {
                                    switch (attrName.ToLower())
                                    {
                                        case "vcl": vcl = Convert.ToInt32(attr.Value); break;
                                        case "ecl": ecl = Convert.ToInt32(attr.Value); break;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Instance.Write(LogLevel.Error, ex, "[Util.GetUserClearanceLevels]");
                }
            }
        }
示例#14
0
        private static void SendInvoice(long userId, string userPath)
        {
            UserInfo ui = null;
            ClientInfo ci = null;
            using (Database db = new MySqlDatabase())
            {
                ui = db.GetUser(userId);
                ci = db.GetClientInfo(userId);
            }

            string email = ui.Email;
            if (!String.IsNullOrEmpty(ci.EmailReceipt))
                email = ci.EmailReceipt;

            List<string> attachments = new List<string>();

            attachments.Add(userPath);
            using (TextReader rdr = new StreamReader(HttpContext.Current.Server.MapPath(Resources.Resource.tplInvoice)))
            {
                string body = rdr.ReadToEnd();

                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());
                SendEmail(new string[] { email }, null, Resource.SubjectYourInvoice, body,
                          attachments.ToArray(), 0);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Logger logger = Logger.Instance;

            IncludePage(BuyProductInc, Resources.Resource.incBuyProduct);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            string activeModule = 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 = Util.GetUserCredits(Util.UserId).ToString();
                ProtectedLiteral.Text = protectedTracks.ToString();
                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);
                divAccPerCompleted.Visible = ClickToLinkLiteral.Visible = (CompletedLiteral.Text != string.Empty);
            }

            if (!IsPostBack)
            {
                long prodid = -1;
                long transid = -1;
                ParamsDictionary parms = new ParamsDictionary();
                string desc = "???";
                if (Request.Params["pid"] != null /* && Request.Params["tid"] == null */)
                {
                    prodid = Convert.ToInt64(Request.Params["pid"]);
                    if (prodid > -1)
                    {
                        using (Database db = new MySqlDatabase())
                        {
                            ProductInfo pi = db.GetProductById(prodid);
                            ProductPriceInfoList ppil = db.GetProductPrices(prodid);
                            decimal price = 0m;
                            foreach (ProductPriceInfo ppi in ppil)
                            {
                                if (ppi.IsoCurrency == "EUR")
                                {
                                    price = ppi.Price;
                                    break;
                                }
                            }

                            desc = pi.Name;
                            parms.Add("{%product%}", desc);
                            parms.Add("{%credits%}", pi.Credits.ToString());
                            parms.Add("{%price%}", string.Format("{0:C}", price));
                        }

                        string _priceInEuro = parms["{%price%}"];

                        if (_priceInEuro.Contains("$"))
                        {
                            parms.Remove("{%price%}");
                            _priceInEuro = _priceInEuro.Replace("$", "€").Replace(".", ",");
                            parms.Add("{%price%}", _priceInEuro);
                        }
                    }
                }

                if (Request.Params["tid"] != null /* && Request.Params["pid"] != null */)
                {
                    transid = Convert.ToInt64(Request.Params["tid"]);
                    if (transid > -1)
                    {
                        using (Database db = new MySqlDatabase())
                        {
                            Transaction transaction = db.GetQuotation(transid);
                            string statuscode = transaction.StatusCode;
                            string[] parts = statuscode.Split('(', ':', ')');
                            int credits = 0;
                            if (parts.Length >= 3)
                                credits = Convert.ToInt32(parts[2]);
                            desc = string.Format(Resources.Resource.BulkPurchase, credits, transaction.Amount);
                            parms.Add("{%product%}", desc);
                            parms.Add("{%credits%}", credits.ToString());
                        }
                    }
                }

                IncludePage(ProductInc, Resources.Resource.incBuyProductText, parms);

                //ProductLiteral.Text = string.Format(Resources.Resource.Purchase1, 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);
            }
        }