private void InitializePageContent()
        {
            bool   exists      = false;
            string ImgFilename = string.Empty;
            bool   existing    = false;

            AppLogic.LogEvent(ThisCustomer.CustomerCode, 10, ItemCode);

            pnlRequireReg.Visible         = (RequiresReg && ThisCustomer.IsNotRegistered);
            this.pnlEmailToFriend.Visible = !(RequiresReg && ThisCustomer.IsNotRegistered);

            emailproduct_aspx_1.Text = "<br><br><br><br><b>" + AppLogic.GetString("emailproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br><br><br><a href=\"signin.aspx?returnurl=showproduct.aspx?" + Server.HtmlEncode(Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))) + "\">" + AppLogic.GetString("emailproduct.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("emailproduct.aspx.3", SkinID, ThisCustomer.LocaleSetting);

            String ProdPic = String.Empty;

            using (SqlConnection con = DB.NewSqlConnection())
            {
                con.Open();
                using (IDataReader reader = DB.GetRSFormat(con, "SELECT Filename FROM InventoryOverrideImage with (NOLOCK) WHERE ItemCode = {0} AND WebSiteCode = {1} AND IsDefaultIcon = 1", DB.SQuote(InterpriseHelper.GetInventoryItemCode(productID)), DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode)))
                {
                    existing = reader.Read();
                    if (existing)
                    {
                        ImgFilename = (DB.RSField(reader, "Filename"));
                    }
                }
            }
            ProdPic             = AppLogic.LocateImageFilenameUrl("Product", InterpriseHelper.GetInventoryItemCode(productID), "medium", ImgFilename, AppLogic.AppConfigBool("Watermark.Enabled"), out exists);
            imgProduct.ImageUrl = ProdPic;

            string imgAltText = "";

            using (SqlConnection con = DB.NewSqlConnection())
            {
                con.Open();
                using (IDataReader reader = DB.GetRSFormat(con, "exec EcommerceDefaultMediumImage @ItemCode={0}, @WebSiteCode={1}, @LanguageCode={2} ", DB.SQuote(InterpriseHelper.GetInventoryItemCode(productID)), DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), DB.SQuote(Customer.Current.LanguageCode)))
                {
                    existing = reader.Read();
                    if (existing)
                    {
                        imgAltText = (DB.RSField(reader, "SEAltTextMedium"));
                    }
                }
            }

            imgProduct.AlternateText = imgAltText;

            ProductNavLink.NavigateUrl = InterpriseHelper.MakeItemLink(ItemCode);
            ProductNavLink.Text        = AppLogic.GetString("emailproduct.aspx.23", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_4.Text   = AppLogic.GetString("emailproduct.aspx.4", SkinID, ThisCustomer.LocaleSetting) + " " + Security.HtmlEncode(ProductName) + CommonLogic.IIF(VariantName.Length > 0, " - " + Security.HtmlEncode(VariantName), "");
            emailproduct_aspx_11.Text  = AppLogic.GetString("emailproduct.aspx.11", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_12.Text  = AppLogic.GetString("emailproduct.aspx.12", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_22.Text  = AppLogic.GetString("emailproduct.aspx.21", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_15.Text  = AppLogic.GetString("emailproduct.aspx.15", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_18.Text  = AppLogic.GetString("emailproduct.aspx.18", SkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_19.Text  = AppLogic.GetString("emailproduct.aspx.19", SkinID, ThisCustomer.LocaleSetting);
            txtMessage.Text            = AppLogic.GetString("emailproduct.aspx.22", SkinID, ThisCustomer.LocaleSetting, true);
            btnSubmit.Text             = AppLogic.GetString("emailproduct.aspx.20", SkinID, ThisCustomer.LocaleSetting, true);

            if (ThisCustomer.IsInEditingMode())
            {
                AppLogic.EnableButtonCaptionEditing(btnSubmit, "emailproduct.aspx.20");
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            ltMessage.Text = AppLogic.GetString("savenotification.aspx.cs.1", Customer.Current.SkinID, Customer.Current.LocaleSetting);
            Int32  NotificationType = Int32.Parse(CommonLogic.QueryStringCanBeDangerousContent("NotificationType"));
            String itemCode         = CommonLogic.QueryStringCanBeDangerousContent("itemCode");
            String ProductURL       = CommonLogic.QueryStringCanBeDangerousContent("ProductURL") + InterpriseHelper.MakeItemLink(itemCode);


            string[][] ruleloaddataset;
            ruleloaddataset = new string[][] { new string[] { "ECOMMERCENOTIFICATION", "READECOMMERCENOTIFICATION", "@ContactCode", Customer.Current.ContactCode,
                                                              "@WebsiteCode", InterpriseHelper.ConfigInstance.WebSiteCode, "@ItemCode", itemCode, "@EmailAddress", Customer.Current.EMail } };

            EcommerceNotificationDatasetGateway ruleDatasetContainer = new EcommerceNotificationDatasetGateway();

            if (Interprise.Facade.Base.SimpleFacade.Instance.CurrentBusinessRule.LoadDataSet(
                    InterpriseHelper.ConfigInstance.OnlineCompanyConnectionString, ruleloaddataset, ruleDatasetContainer))
            {
                EcommerceNotificationDatasetGateway.EcommerceNotificationRow ruleDatasetContainernewRow;

                if (ruleDatasetContainer.EcommerceNotification.Rows.Count == 0)
                {
                    ruleDatasetContainernewRow = ruleDatasetContainer.EcommerceNotification.NewEcommerceNotificationRow();
                }
                else
                {
                    ruleDatasetContainernewRow = ruleDatasetContainer.EcommerceNotification[0];
                }

                Boolean OnPriceDrop = AppLogic.CheckNotification(Customer.Current.ContactCode, Customer.Current.EMail, itemCode, 1);
                Boolean OnItemAvail = AppLogic.CheckNotification(Customer.Current.ContactCode, Customer.Current.EMail, itemCode, 0);

                if (NotificationType == 1)
                {
                    OnPriceDrop = true;
                }
                else
                {
                    OnItemAvail = true;
                }

                ruleDatasetContainernewRow.BeginEdit();
                ruleDatasetContainernewRow.WebSiteCode       = InterpriseHelper.ConfigInstance.WebSiteCode;
                ruleDatasetContainernewRow.ItemCode          = itemCode;
                ruleDatasetContainernewRow.ContactCode       = Customer.Current.ContactCode;
                ruleDatasetContainernewRow.EmailAddress      = Customer.Current.EMail;
                ruleDatasetContainernewRow.NotifyOnPriceDrop = OnPriceDrop;
                ruleDatasetContainernewRow.NotifyOnItemAvail = OnItemAvail;
                ruleDatasetContainernewRow.ProductURL        = ProductURL;

                byte[] salt = InterpriseHelper.GenerateSalt();
                byte[] iv   = InterpriseHelper.GenerateVector();
                string contactCodeCypher  = InterpriseHelper.Encryption(Customer.Current.ContactCode, salt, iv);
                string emailAddressCypher = InterpriseHelper.Encryption(Customer.Current.EMail, salt, iv);

                ruleDatasetContainernewRow.EncryptedContactCode  = contactCodeCypher + "|" + Convert.ToBase64String(salt) + "|" + Convert.ToBase64String(iv);
                ruleDatasetContainernewRow.EncryptedEmailAddress = emailAddressCypher + "|" + Convert.ToBase64String(salt) + "|" + Convert.ToBase64String(iv);


                ruleDatasetContainernewRow.EndEdit();


                if (ruleDatasetContainer.EcommerceNotification.Rows.Count == 0)
                {
                    ruleDatasetContainer.EcommerceNotification.AddEcommerceNotificationRow(ruleDatasetContainernewRow);
                }

                string[][] rulecommandset;
                rulecommandset = new string[][] { new string[] { ruleDatasetContainer.EcommerceNotification.TableName, "CREATEECOMMERCENOTIFICATION",
                                                                 "UPDATEECOMMERCENOTIFICATION", "DELETEECOMMERCENOTIFICATION" } };

                if (Interprise.Facade.Base.SimpleFacade.Instance.CurrentBusinessRule.UpdateDataset(
                        InterpriseHelper.ConfigInstance.OnlineCompanyConnectionString, rulecommandset, ruleDatasetContainer))
                {
                    ltMessage.Text = AppLogic.GetString("savenotification.aspx.cs.2", Customer.Current.SkinID, Customer.Current.LocaleSetting);
                    Response.Write("<script type=text/javascript language=javascript>window.top.close();</script>");
                }
            }
        }