コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session != null)
            {
                // Store essential session information temporarily
                string culture = Session["culture"] as string ?? "nl-NL";

                Session["culture"] = null;

                // Restore the essential session information
                Session["culture"] = culture;
            }

            if (!Request.IsAuthenticated)
            {
                if (Request.Params["pid"] != null || Request.Params["tid"] != null)
                {
                    Response.Redirect(string.Format("~/Account/Login.aspx?tid={0}&pid={1}",
                                    Request.Params["tid"],
                                    Request.Params["pid"]), false);
                }
                else
                {
                    Response.Redirect("~/Default.aspx", false);
                }
            }

            ShowLoggedOnView();

            Literal name = HeadLoginView.FindControl("HeadLoginName") as Literal;
            if (name != null)
            {
                if (Session["userid"] != null)
                {
                    long userId = Util.UserId;
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(userId);
                        name.Text = string.Format(" {0}", ci.FirstName);// ci.GetFullName());
                    }
                }
            }
            if (!IsPostBack)
            {
                BasePage obj = new BasePage();
                obj.IncludePage(FooterLiteral, Resources.Resource.FooterSection);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
                Response.Redirect("~/");

            long userid = Util.UserId;

            if (!IsPostBack)
            {
                Country.Items.Clear();
                string[] countries = Util.GetCountries();
                foreach (string country in countries)
                    Country.Items.Add(new ListItem(country));

                Country.SelectedIndex = Country.Items.IndexOf(Country.Items.FindByText("Netherlands"));

                if (userid > 0)
                {
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(userid);
                        if (ci != null && ci.ClientId > 0)
                        {
                            LastName.Text = ci.LastName;
                            FirstName.Text = ci.FirstName;
                            AddressLine1.Text = ci.AddressLine1;
                            AddressLine2.Text = ci.AddressLine2;
                            Zipcode.Text = ci.ZipCode;
                            State.Text = ci.State;
                            City.Text = ci.City;
                            Country.SelectedIndex = Country.Items.IndexOf(Country.Items.FindByText(ci.Country));
                            Telephone.Text = ci.Telephone;
                            Cellular.Text = ci.Cellular;
                            AccountOwner.Text = ci.AccountOwner;
                            TwitterID.Text = ci.TwitterId;
                            FacebookID.Text = ci.FacebookId;
                            OwnerKind.SelectedIndex = OwnerKind.Items.IndexOf(OwnerKind.Items.FindByText(ci.OwnerKind));
                            CreditCardNr.Text = ci.CreditCardNr;
                            CVVNr.Text = ci.CreditCardCvv;
                            EmailForReceipt.Text = ci.EmailReceipt;
                            Referer.Text = ci.Referer;
                        }
                    }
                }
            }
        }
        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;
        }
コード例 #5
0
        protected void Page_PreRender(Object o, EventArgs e)
        {
            using (Database db = new MySqlDatabase())
            {
                ClientInfo ci = db.GetClientInfo(Util.UserId);

                bool isNotExpired = true;

                Facebook.AuthenticationService authService = new Facebook.AuthenticationService();

                Facebook.Me me;
                string accessToken = string.Empty;

                if (authService.TryAuthenticate(out me, out accessToken))
                {
                    isNotExpired = true;
                }
                else
                {
                    db.RemoveSocialCredential(ci.ClientId, SocialConnector.Facebook);
                    db.UpdateFacebookID(ci.ClientId);

                    isNotExpired = false;
                }

                if (!string.IsNullOrEmpty(ci.SoundCloudId))
                    SoundcloudItag.Attributes.Add("class", "soundcloud");
                else
                    SoundcloudItag.Attributes.Add("class", "soundcloud disabled");

                if (isNotExpired)
                    FacebookHeading.Attributes.Add("class", "social facebook");
                else
                    FacebookHeading.Attributes.Add("class", "social facebook disabled");

                if (!string.IsNullOrEmpty(ci.TwitterId))
                    TwitterHeading.Attributes.Add("class", "social twitter");
                else
                    TwitterHeading.Attributes.Add("class", "social twitter disabled");
            }
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["bodyid"] = "firstlogin"; //"user-home";

            if (!IsPostBack)
            {
                if (isProfileCompleted())
                {
                    Response.Redirect("Member/MemberHome.aspx");
                }
                else
                {
                    bool flagIsActive = false;
                    //Get the value of isActive
                    if (Convert.ToInt32(Session["isActive"]) > 0)
                        flagIsActive = true;

                    //End getting value isActive
                    if (!string.IsNullOrEmpty(Request.QueryString["userId"]) && !string.IsNullOrEmpty(Request.QueryString["key"]) && !string.IsNullOrEmpty(Request.QueryString["mode"]))
                    {
                        if (Convert.ToInt32(Request.QueryString["mode"].Trim()) == 1)
                            Session["SignUpMode"] = "Facebook logon";
                        else if (Convert.ToInt32(Request.QueryString["mode"].Trim()) == 2)
                            Session["SignUpMode"] = "Manual Sign Up";
                        else
                            Session["SignUpMode"] = "Sign Up";

                        if (!flagIsActive)
                        {
                            SendMail(Convert.ToInt64(Request.QueryString["userId"]));
                            updateUserStatus(Convert.ToInt64(Request.QueryString["userId"]));
                        }

                        AuthenticateUser();
                    }
                    else
                    {
                        Session["SignUpMode"] = Resources.Resource.FirstLogonHeader; //"Sign Up";
                        if (!flagIsActive)
                        {
                            SendMail(Util.UserId);
                            updateUserStatus(Util.UserId);
                        }
                        using (Database db = new MySqlDatabase())
                        {
                            ClientInfo ci = db.GetClientInfo(Util.UserId);
                            Session["UserName"] = ci.GetFullName();
                        }
                    }

                    LogonMode.Text = Convert.ToString(Session["SignUpMode"]);
                    //FirstNameLiteral.Text = Convert.ToString(Session["UserName"]);
                    Dictionary<string, string> param1 = new Dictionary<string, string>();
                    TrackProtect.ParamsDictionary param = new ParamsDictionary();
                    //Replacing value of first Name from inc file.
                    param.Add("VarFirstName", Convert.ToString(Session["UserName"]));
                    IncludePage(ltrFirstLogon, Resources.Resource.FirstLogon, param);

                }

                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);
                }
            }
        }
コード例 #8
0
        public static ConfirmationResult ProcessConfirmation(string guid, int relationType)
        {
            ConfirmationResult result = ConfirmationResult.ConfirmationFailed;

            string emailRequested = string.Empty;
            string emailRequesting = string.Empty;
            ClientInfo requestingClientInfo = null;
            ClientInfo requestedClientInfo = null;

            using (Database db = new MySqlDatabase())
            {
                result = db.ProcessConfirmation(guid, relationType, out emailRequested, out emailRequesting);

                long requestedUserId = db.GetUserIdByEmail(emailRequested);
                long requestingUserId = db.GetUserIdByEmail(emailRequesting);

                requestingClientInfo = db.GetClientInfo(requestingUserId);
                requestedClientInfo = db.GetClientInfo(requestedUserId);
            }

            if (result == ConfirmationResult.Success)
            {
                string _template = string.Empty;

                if (relationType == 1)
                    _template = Resources.Resource.ConfirmRequestorTemplate;
                else
                    _template = Resources.Resource.TemplateConfirmrelationcreate;

                using (TextReader rdr = new StreamReader(HttpContext.Current.Server.MapPath(_template)))
                {
                    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%}", requestingClientInfo.GetFullName());
                    body = body.Replace("{%firstname%}", requestedClientInfo.FirstName);
                    body = body.Replace("{%lastname%}", requestedClientInfo.LastName);
                    body = body.Replace("{%firstname_invitee%}", requestedClientInfo.FirstName);
                    body = body.Replace("{%firstname_invitor%}", requestingClientInfo.FirstName);
                    body = body.Replace("{%lastname_invitor%}", requestingClientInfo.LastName);
                    body = body.Replace("{%FAQ%}", ConfigurationManager.AppSettings["SiteNavigationLink"] + "/FAQ.aspx");

                    try
                    {
                        Util.SendEmail(new string[] { emailRequesting }, "*****@*****.**",
                                       Resources.Resource.ConfirmationManagedMusician, body, null, 0);
                    }
                    catch (Exception ex)
                    {
                        Logger.Instance.Write(LogLevel.Error, ex, "[ProcessConfirmation]");
                    }
                }
            }
            return result;
        }
コード例 #9
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
            {
            }
        }
コード例 #10
0
        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;
        }
コード例 #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 ClientInfo GetClientInfo(long userId)
 {
     using (Database db = new MySqlDatabase())
     {
         return db.GetClientInfo(userId);
     }
 }
コード例 #13
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);
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session != null)
            {
                // Store essential session information temporarily
                string culture = Session["culture"] as string ?? "nl-NL";
                // Restore the essential session information
                Session.Clear();
                Session.RemoveAll();

                Session["culture"] = culture;
            }

            if (!IsPostBack)
            {
                long userId = Util.UserId;
                Session["bodyid"] = "user-home";
                #region Generating product information and binding their price ------- !

                List<Product> listProductInformation = new List<Product>();
                using (Database db = new MySqlDatabase())
                {
                    ClientInfo ci = null;
                    if (userId > -1)
                        ci = db.GetClientInfo(userId);

                    string currency = "EUR";
                    string countryIso2 = "NL";
                    string currencyFmt = "{0} {1:N2}";
                    if (ci != null)
                    {
                        countryIso2 = Util.GetCountryIso2(ci.Country);
                        currency = Util.GetCurrencyIsoNameByCountryIso2("NL");
                        currencyFmt = Util.GetCurrencyFormatByCountryIso2("NL");
                    }

                    string culture = "en-US";
                    if (Session["culture"] != null)
                        culture = Session["culture"] as string;

                    if (culture.Length == 2)
                    {
                        switch (culture)
                        {
                            case "nl":
                                culture += "-NL";
                                break;
                            case "en":
                                culture += "US";
                                break;
                            case "NL":
                                culture = "nl-" + culture;
                                break;
                            case "US":
                                culture = "en" + culture;
                                break;
                        }
                    }

                    ProductInfoList pil = db._GetProducts();
                    string price = string.Empty;
                    string link = string.Empty;
                    int i = 0;
                    foreach (ProductInfo prod in pil)
                    {
                        //Added by Nagesh

                        ProductPriceInfoList ppil = db.GetProductPrices(prod.ProductId, culture);

                        if (ppil[0].Price > 0m)
                        {
                            price = string.Format(
                                currencyFmt,
                                Util.GetCurrencySymbolByCountryIso2("NL"),
                                ppil[0].Price);
                        }
                        else
                        {
                            price = Resources.Resource.Quotation;
                        }

                        if (ppil[0].Price > 0m)
                        {
                            // Normal products, just process them
                            //link = string.Format(Session["userid"] != null ?
                            //    "/Member/BuyProduct.aspx?pid={0}&country={1}&price={2}" :
                            //    "/Account/Login.aspx?pid={0}&country={1}&price={2}",
                            //    prod.ProductId, countryIso2, ppil[0].Price);

                            link = string.Format(Session["userid"] != null ?
                                "/Member/BuyProduct.aspx?pid={0}&country={1}&price={2}" :
                                "/Account/Login.aspx?pid={0}&country={1}&price={2}",
                                prod.ProductId, "NL", ppil[0].Price);

                        }
                        else
                        {
                            // Special products, check the description field to
                            // find out more about the product
                            switch (prod.Extra.ToLower())
                            {
                                case "subscription":
                                    link = string.Format(Session["userid"] != null ?
                                        "/Member/Subscription.aspx?pid={0}&country={1}&price={2}" :
                                        "/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=1"
                                        );
                                    break;

                                default:
                                    link = string.Format(Session["userid"] != null ?
                                        "/Member/Quotation.aspx?pid={0}&country={1}&price={2}" :
                                        "/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=0",
                                        prod.ProductId, countryIso2, 0);

                                    break;
                            }
                        }
                        //End Here
                        string desc = db.GetProduct_Desc_Price(prod.ProductId, culture);

                        Product _product = new Product();
                        _product.ProductPlan = prod.ProductPlan;
                        _product.Credits = Convert.ToString(prod.Credits);
                        _product.ProductDesc = desc.Split('#')[0];
                        _product.ProductPrice = desc.Split('#')[1];
                        _product.ProductId = prod.ProductId;
                        listProductInformation.Add(_product);
                        string planCss = "plans";
                        if (i == 3)
                        {
                            planCss = "plans managed";
                        }
                        ltrProducts.Text = ltrProducts.Text + "<li> <div class='" + planCss + "'><div class='icon-img'><i class='icon-logo'></i></div><h2 class='plan-title'> " + _product.ProductPlan + "<span class='number'>" + _product.Credits + "</span></h2><p class='description'>" + _product.ProductDesc + "</p><div class='row'><div class='small-6 columns'> <h2 class='price'>" + price + "</h2></div> <div class='small-6 columns'><a href=" + link + " class='button'>" + Resources.Resource.BuyNow + "</a></div></div><p class='footnote'> " + _product.ProductPrice + "</p> </div></li>";
                        i++;
                    }
                }

                #endregion

                #region Setting en/nl contents ------- !

                //ProductList.DataSource = listProductInformation;
                //ProductList.DataBind();

                if (Session["culture"] == null)
                {
                    string _culture = "nl-NL";

                    string lang = "en";
                    if (Request.UserLanguages != null)
                        lang = Request.UserLanguages[0] ?? "en";

                    lang = lang.Split(';')[0].Trim();
                    switch (lang)
                    {
                        case "en":
                            _culture = "en-US";
                            break;
                        case "nl":
                            _culture = "nl-NL";
                            break;
                    }

                    Session["culture"] = _culture;
                    Culture = _culture;
                    UICulture = _culture;

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

                IncludePage(InfoGraphicLiteral, Resources.Resource.InfoGraphicSection);
                IncludePage(UpsLiteral, Resources.Resource.UpsSection);
                IncludePage(AboutLiteral, Resources.Resource.AboutSection);
                IncludePage(IntroLiteral, Resources.Resource.IntroSection);
                IncludePage(FooterLiteral, Resources.Resource.FooterSection);
                IncludePage(FAQLiteral, Resources.Resource.FAQTop10);
                IncludePage(newsLiteral, Resources.Resource.NewsLiteral);

                #endregion
                FormsAuthentication.SignOut();
            }

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

            if (Convert.ToString(Session["culture"]).Contains("nl"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "btnNLSmall" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "btnENSmall" + "');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageUS" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageNL" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "btnENSmall" + "');", true);
                ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "btnNLSmall" + "');", true);
            }
        }
コード例 #15
0
        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;
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludePage(SelectProductInc, Resources.Resource.incSelectProduct);
            IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);

            long userId = Util.UserId;

            divSignUp.Visible = (Session["userid"] == null);

            if (!IsPostBack)
            {
                using (Database db = new MySqlDatabase())
                {
                    ClientInfo ci = null;
                    if (userId > -1)
                        ci = db.GetClientInfo(userId);

                    string currency = "EUR";
                    string countryIso2	= "NL";
                    string currencyFmt = "{0} {1:N2}";
                    if (ci != null)
                    {
                        countryIso2 = Util.GetCountryIso2(ci.Country);
                        currency = Util.GetCurrencyIsoNameByCountryIso2("NL");
                        currencyFmt = Util.GetCurrencyFormatByCountryIso2("NL");
                    }

                    string culture = "en-US";
                    if (Session["culture"] != null)
                        culture = Session["culture"] as string;
                    if (culture.Length == 2)
                    {
                        switch (culture)
                        {
                        case "nl":
                            culture += "-NL";
                            break;
                        case "en":
                            culture += "US";
                            break;
                        case "NL":
                            culture = "nl-" + culture;
                            break;
                        case "US":
                            culture = "en" + culture;
                            break;
                        }
                    }
                    ProductInfoList pil = db.GetProducts();
                    int i = 0;
                    foreach (ProductInfo prod in pil)
                    {
                        ProductPriceInfoList ppil = db.GetProductPrices(prod.ProductId, culture);
                        TableRow row = new TableRow();
                        row.VerticalAlign = VerticalAlign.Top;

                        TableCell cell = new TableCell();
                        if (i < 4)
                        {
                            Image img = new Image();
                            img.ImageUrl = string.Format(Resources.Resource.imgVaultFmt, _desc[i]);
                            cell.Controls.Add(img);
                            ++i;
                        }
                        else
                        {
                            cell.Text = "&nbsp;";
                        }
                        row.Cells.Add(cell);

                        string desc = db.GetProductTitle(prod.ProductId, culture);
                        cell = new TableCell();
                        Literal lit = new Literal();
                        lit.Text = "<div style=\"margin-left:8px;margin-right:8px;\">" + desc + "</div>";
                        cell.Controls.Add(lit);
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        cell.Width = Unit.Pixel(50);
                        cell.Font.Bold = true;
                        cell.HorizontalAlign = HorizontalAlign.Center;
                        if (ppil[0].Price > 0m)
                        {
                            cell.Text = string.Format(
                                currencyFmt,
                                Util.GetCurrencySymbolByCountryIso2("NL"),
                                ppil[0].Price);
                        }
                        else
                        {
                            cell.Text = Resources.Resource.Quotation;
                        }
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        HyperLink hl = new HyperLink();
                        hl.CssClass = "linkBuy";
                        if (string.IsNullOrEmpty(countryIso2))
                            countryIso2 = "NL";
                        if (ppil[0].Price > 0m)
                        {
                            // Normal products, just process them
                            hl.NavigateUrl = string.Format(Session["userid"] != null ?
                                "~/Member/BuyProduct.aspx?pid={0}&country={1}&price={2}" :
                                "~/Account/Login.aspx?pid={0}&country={1}&price={2}",
                                prod.ProductId, countryIso2, ppil[0].Price);
                            hl.ImageUrl = Resources.Resource.imgBuyCredits;
                        }
                        else
                        {
                            // Special products, check the description field to
                            // find out more about the product
                            switch (prod.Extra.ToLower())
                            {
                            case "subscription":
                                hl.NavigateUrl = string.Format(Session["userid"] != null ?
                                    "~/Member/Subscription.aspx?pid={0}&country={1}&price={2}" :
                                    "~/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=1"
                                    );
                                break;

                            default:
                                hl.NavigateUrl = string.Format(Session["userid"] != null ?
                                    "~/Member/Quotation.aspx?pid={0}&country={1}&price={2}" :
                                    "~/Account/Login.aspx?pid={0}&country={1}&price={2}&sub=0",
                                    prod.ProductId, countryIso2, 0);
                                hl.ImageUrl = Resources.Resource.imgQuotation;
                                break;
                            }
                        }
                        cell.Controls.Add(hl);
                        row.Cells.Add (cell);

                        ProductTable.Rows.Add (row);
                    }
                }
            }
            else
            {
            }
        }
コード例 #17
0
        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);
            }
        }
コード例 #18
0
        public static ConfirmationRequestResult RequestConfirmation(
            string email,
            string firstname,
            string lastname,
            string guid,
            long requestingUserId,
            int relationType,
            string language = "")
        {
            long requestedUserId = 0;
            ClientInfo requestingClientInfo = null;
            ClientInfo requestedClientInfo = null;

            using (Database db = new MySqlDatabase())
            {
                requestedUserId = db.GetUserIdByEmail(email);
                requestingClientInfo = db.GetClientInfo(requestingUserId);
                requestedClientInfo = db.GetClientInfo(requestedUserId);

                if (db.RelationExists(requestingUserId, requestedUserId, relationType))
                    return ConfirmationRequestResult.Exists;

                if (db.ConfirmationExists(requestingUserId, email))
                    return ConfirmationRequestResult.AlreadyRequested;

                db.RequestConfirmation(guid, requestingUserId, requestedUserId, email, relationType);
            }

            string fullName = requestedClientInfo.GetFullName();
            if (string.IsNullOrEmpty(fullName) || fullName == " ")
                fullName = firstname;
            if (!string.IsNullOrEmpty(fullName))
                fullName += " ";
            fullName += lastname;

            string templatePath = string.Empty;

            string subject = string.Empty;

            if (relationType == 1)
            {
                if (!string.IsNullOrEmpty(language))
                {
                    if (language.ToLower().Contains("en"))
                    {
                        templatePath = "~/Templates/confirmmgmt.tpl";

                        subject = "invites you as a managed musician";
                    }
                    else if (language.ToLower().Contains("du"))
                    {
                        templatePath = "~/Templates/nl/confirmmgmt.tpl";

                        subject = "nodigt je uit als managed muzikant";
                    }
                }
                else
                {
                    templatePath = Resources.Resource.ConfirmMgmtTemplate;

                    subject = Resources.Resource.InviteManagedArtistSubject;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(language))
                {
                    if (language.ToLower().Contains("en"))
                    {
                        templatePath = "~/Templates/confirm.tpl";

                        subject = "invites you as a co-creator";
                    }
                    else if (language.ToLower().Contains("du"))
                    {
                        templatePath = "~/Templates/nl/confirm.tpl";

                        subject = "heeft je als co-creator uitgenodigd";
                    }
                }
                else
                {
                    templatePath = Resources.Resource.ConfirmTemplate;

                    subject = Resources.Resource.InviteRelationsubject;
                }
            }

            using (TextReader rdr = new StreamReader(HttpContext.Current.Server.MapPath(templatePath)))
            {
                string body = rdr.ReadToEnd();

                string link = string.Empty;

                if (requestedUserId != 0)
                    link =
                        string.Format(ConfigurationManager.AppSettings["SiteNavigationLink"] + "/Member/Confirm.aspx?id={0}&amp;tp={1}", guid, relationType);
                else
                    link =
                        string.Format(ConfigurationManager.AppSettings["SiteNavigationLink"] +
                        "/Member/Confirm.aspx?id={0}&amp;tp={1}&requestingUserinfo={2}", guid, relationType, EncryptionClass.Encrypt(fullName));

                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%}", fullName);
                body = body.Replace("{%firstname%}", requestingClientInfo.FirstName);
                body = body.Replace("{%lastname%}", requestingClientInfo.LastName);

                body = body.Replace("{%confirmlink%}", link);

                if (!string.IsNullOrEmpty(requestedClientInfo.FirstName))
                    body = body.Replace("{%firstname_invitee%}", requestedClientInfo.FirstName);
                else
                    body = body.Replace("{%firstname_invitee%}", fullName);
                body = body.Replace("{%firstname_invitor%}", requestingClientInfo.FirstName);
                body = body.Replace("{%FAQ%}", ConfigurationManager.AppSettings["SiteNavigationLink"] + "/FAQ.aspx");

                body = body.Replace("{%lastname_invitor%}", requestingClientInfo.LastName);

                try
                {
                    Util.SendEmail(new string[] { email }, "*****@*****.**", requestingClientInfo.FirstName + " " + subject, body, null, 0);
                }
                catch { return ConfirmationRequestResult.Failed; }
            }

            return ConfirmationRequestResult.Success;
        }
コード例 #19
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);
            }
        }