Esempio n. 1
0
 public SshSettingsPage(CommonLogic commonLogic)
 {
     InitializeComponent();
     Text = "SSH";
     Translate();
     _commonLogic = commonLogic;
 }
        public LocalSettingsSettingsPage(CommonLogic commonLogic, CheckSettingsLogic checkSettingsLogic, GitModule gitModule)
            : this()
        {
            _commonLogic = commonLogic;
            _checkSettingsLogic = checkSettingsLogic;
            _gitModule = gitModule;

            _commonLogic.FillEncodings(Local_FilesEncoding);
        }
        public LocalSettingsSettingsPage(CommonLogic commonLogic, CheckSettingsLogic checkSettingsLogic, GitModule gitModule)
        {
            InitializeComponent();
            Translate();

            _commonLogic = commonLogic;
            _checkSettingsLogic = checkSettingsLogic;
            _gitModule = gitModule;

            Text = "Local Settings";

            _commonLogic.FillEncodings(Local_FilesEncoding);
        }
        public GlobalSettingsSettingsPage(CommonLogic commonLogic, CheckSettingsLogic checkSettingsLogic, GitModule gitModule)
            : this()
        {
            _commonLogic = commonLogic;
            _checkSettingsLogic = checkSettingsLogic;
            _gitModule = gitModule;

            _commonLogic.FillEncodings(Global_FilesEncoding);

            string npp = MergeToolsHelper.FindFileInFolders("notepad++.exe", "Notepad++");
            if (string.IsNullOrEmpty(npp))
                npp = "notepad++";
            else
                npp = "\"" + npp + "\"";

            GlobalEditor.Items.AddRange(new Object[] { "\"" + Settings.GetGitExtensionsFullPath() + "\" fileeditor", "vi", "notepad", npp + " -multiInst -nosession" });
        }
    public static string getPointName(string strV)
    {
        CommonLogic com = new CommonLogic();

        return(com.getNameByID(TEnvPDrinkSrcVVo.T_ENV_P_DRINK_SRC_V_TABLE, "VERTICAL_NAME", "ID", strV));
    }
Esempio n. 6
0
        public override string VoidOrder(int OrderNumber)
        {
            var result = AppLogic.ro_OK;

            DB.ExecuteSQL("update orders set VoidTXCommand=NULL, VoidTXResult=NULL where OrderNumber=" + OrderNumber.ToString());
            var useLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions");
            var TransID             = string.Empty;
            var CustomerID          = 0;

            using (var con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (var rs = DB.GetRS("select AuthorizationPNREF,CustomerID from Orders  with (NOLOCK)  where OrderNumber=" + OrderNumber.ToString(), con))
                {
                    if (rs.Read())
                    {
                        TransID    = DB.RSField(rs, "AuthorizationPNREF");
                        CustomerID = DB.RSFieldInt(rs, "CustomerID");
                    }
                }
            }

            var X_Login = AppLogic.AppConfig("eProcessingNetwork_X_LOGIN");

            if (X_Login.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                var reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_Login = reg.Read("eProcessingNetwork_X_LOGIN");
                reg     = null;
            }

            String X_TranKey = AppLogic.AppConfig("eProcessingNetwork_X_TRAN_KEY");

            if (X_TranKey.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_TranKey = reg.Read("eProcessingNetwork_X_TRAN_KEY");
                reg       = null;
            }


            ASCIIEncoding encoding           = new ASCIIEncoding();
            StringBuilder transactionCommand = new StringBuilder(4096);

            transactionCommand.Append("x_type=VOID");
            transactionCommand.Append("&x_login="******"&x_tran_key=" + X_TranKey);
            transactionCommand.Append("&x_version=" + AppLogic.AppConfig("eProcessingNetwork_X_VERSION"));
            transactionCommand.Append("&x_test_request=" + CommonLogic.IIF(useLiveTransactions, "FALSE", "TRUE"));
            transactionCommand.Append("&x_method=" + AppLogic.AppConfig("eProcessingNetwork_X_METHOD"));
            transactionCommand.Append("&x_delim_Data=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_DATA"));
            transactionCommand.Append("&x_delim_Char=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR"));
            transactionCommand.Append("&x_encap_char=" + AppLogic.AppConfig("eProcessingNetwork_X_ENCAP_CHAR"));
            transactionCommand.Append("&x_relay_response=" + AppLogic.AppConfig("eProcessingNetwork_X_RELAY_RESPONSE"));
            transactionCommand.Append("&x_customer_ip=" + CommonLogic.CustomerIpAddress());
            transactionCommand.Append("&x_trans_id=" + TransID);

            DB.ExecuteSQL("update orders set VoidTXCommand=" + DB.SQuote(transactionCommand.ToString().Replace(X_TranKey, "*".PadLeft(X_TranKey.Length))) + " where OrderNumber=" + OrderNumber.ToString());

            if (TransID.Length == 0 || TransID == "0")
            {
                result = "Invalid or Empty Transaction ID";
            }
            else
            {
                try
                {
                    byte[] data = encoding.GetBytes(transactionCommand.ToString());

                    // Prepare web request...
                    String         AuthServer = CommonLogic.IIF(useLiveTransactions, AppLogic.AppConfig("eProcessingNetwork_LIVE_SERVER"), AppLogic.AppConfig("eProcessingNetwork_TEST_SERVER"));
                    HttpWebRequest myRequest  = (HttpWebRequest)WebRequest.Create(AuthServer);
                    myRequest.Method        = "POST";
                    myRequest.ContentType   = "application/x-www-form-urlencoded";
                    myRequest.ContentLength = data.Length;
                    Stream newStream = myRequest.GetRequestStream();
                    // Send the data.
                    newStream.Write(data, 0, data.Length);
                    newStream.Close();
                    // get the response
                    WebResponse myResponse;
                    String      rawResponseString = String.Empty;
                    try
                    {
                        myResponse = myRequest.GetResponse();
                        using (StreamReader sr = new StreamReader(myResponse.GetResponseStream()))
                        {
                            rawResponseString = sr.ReadToEnd();
                            // Close and clean up the StreamReader
                            sr.Close();
                        }
                        myResponse.Close();
                    }
                    catch
                    {
                        rawResponseString = "0|||Error Calling eProcessing Network Payment Gateway||||||||";
                    }

                    // rawResponseString now has gateway response
                    String[] statusArray = rawResponseString.Split(AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR").ToCharArray());
                    // this seems to be a new item where auth.net is returing quotes around each parameter, so strip them out:
                    for (int i = statusArray.GetLowerBound(0); i <= statusArray.GetUpperBound(0); i++)
                    {
                        statusArray[i] = statusArray[i].Trim('\"');
                    }

                    String sql       = String.Empty;
                    String replyCode = statusArray[0].Replace(":", "");

                    DB.ExecuteSQL("update orders set VoidTXResult=" + DB.SQuote(rawResponseString) + " where OrderNumber=" + OrderNumber.ToString());
                    if (replyCode == "1")
                    {
                        result = AppLogic.ro_OK;
                    }
                    else
                    {
                        result = statusArray[3];
                    }
                }
                catch
                {
                    result = "NO RESPONSE FROM GATEWAY!";
                }
            }
            return(result);
        }
Esempio n. 7
0
        // if RefundAmount == 0.0M, then then ENTIRE order amount will be refunded!
        public override String RefundOrder(int OriginalOrderNumber, int NewOrderNumber, decimal RefundAmount, String RefundReason, Address UseBillingAddress)
        {
            var result = AppLogic.ro_OK;

            DB.ExecuteSQL("update orders set RefundTXCommand=NULL, RefundTXResult=NULL where OrderNumber=" + OriginalOrderNumber.ToString());
            var useLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions");
            var TransID             = string.Empty;
            var Last4            = string.Empty;
            var CustomerID       = 0;
            var OrderTotal       = Decimal.Zero;
            var BillingLastName  = string.Empty;
            var BillingFirstName = string.Empty;
            var BillingCompany   = string.Empty;
            var BillingAddress1  = string.Empty;
            var BillingAddress2  = string.Empty;
            var BillingSuite     = string.Empty;
            var BillingCity      = string.Empty;
            var BillingState     = string.Empty;
            var BillingZip       = string.Empty;
            var BillingCountry   = string.Empty;
            var BillingPhone     = string.Empty;
            var BillingEMail     = string.Empty;

            using (var con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (var rs = DB.GetRS("select * from orders   with (NOLOCK)  where OrderNumber=" + OriginalOrderNumber.ToString(), con))
                {
                    if (rs.Read())
                    {
                        TransID          = DB.RSField(rs, "AuthorizationPNREF");
                        Last4            = DB.RSField(rs, "Last4");
                        OrderTotal       = DB.RSFieldDecimal(rs, "OrderTotal");
                        CustomerID       = DB.RSFieldInt(rs, "CustomerID");
                        BillingLastName  = DB.RSField(rs, "BillingLastName");
                        BillingFirstName = DB.RSField(rs, "BillingFirstName");
                        BillingCompany   = DB.RSField(rs, "BillingCompany");
                        BillingAddress1  = DB.RSField(rs, "BillingAddress1");
                        BillingAddress2  = DB.RSField(rs, "BillingAddress2");
                        BillingSuite     = DB.RSField(rs, "BillingSuite");
                        BillingCity      = DB.RSField(rs, "BillingCity");
                        BillingState     = DB.RSField(rs, "BillingState");
                        BillingZip       = DB.RSField(rs, "BillingZip");
                        BillingCountry   = DB.RSField(rs, "BillingCountry");
                        BillingPhone     = DB.RSField(rs, "BillingPhone");
                        BillingEMail     = DB.RSField(rs, "EMail");
                    }
                }
            }

            String X_Login = AppLogic.AppConfig("eProcessingNetwork_X_LOGIN");

            if (X_Login.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_Login = reg.Read("eProcessingNetwork_X_LOGIN");
                reg     = null;
            }

            String X_TranKey = AppLogic.AppConfig("eProcessingNetwork_X_TRAN_KEY");

            if (X_TranKey.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_TranKey = reg.Read("eProcessingNetwork_X_TRAN_KEY");
                reg       = null;
            }

            ASCIIEncoding encoding           = new ASCIIEncoding();
            StringBuilder transactionCommand = new StringBuilder(4096);

            transactionCommand.Append("x_type=CREDIT");
            transactionCommand.Append("&x_login="******"&x_tran_key=" + X_TranKey);
            transactionCommand.Append("&x_version=" + AppLogic.AppConfig("eProcessingNetwork_X_VERSION"));
            transactionCommand.Append("&x_test_request=" + CommonLogic.IIF(useLiveTransactions, "FALSE", "TRUE"));
            transactionCommand.Append("&x_method=" + AppLogic.AppConfig("eProcessingNetwork_X_METHOD"));
            transactionCommand.Append("&x_delim_Data=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_DATA"));
            transactionCommand.Append("&x_delim_Char=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR"));
            transactionCommand.Append("&x_encap_char=" + AppLogic.AppConfig("eProcessingNetwork_X_ENCAP_CHAR"));
            transactionCommand.Append("&x_relay_response=" + AppLogic.AppConfig("eProcessingNetwork_X_RELAY_RESPONSE"));
            transactionCommand.Append("&x_trans_id=" + TransID);
            if (RefundAmount == System.Decimal.Zero)
            {
                transactionCommand.Append("&x_amount=" + Localization.CurrencyStringForGatewayWithoutExchangeRate(OrderTotal));
            }
            else
            {
                transactionCommand.Append("&x_amount=" + Localization.CurrencyStringForGatewayWithoutExchangeRate(RefundAmount));
            }
            transactionCommand.Append("&x_cust_id=" + CustomerID.ToString());
            transactionCommand.Append("&x_invoice_num=" + OriginalOrderNumber.ToString());
            transactionCommand.Append("&x_email=" + Security.UrlEncode(BillingEMail));
            transactionCommand.Append("&x_email_customer=false");
            transactionCommand.Append("&x_customer_ip=" + CommonLogic.CustomerIpAddress());
            transactionCommand.Append("&x_card_num=" + Last4);

            transactionCommand.Append("&x_description=" + Security.UrlEncode(RefundReason));
            transactionCommand.Append("&x_first_name=" + Security.UrlEncode(BillingFirstName));
            transactionCommand.Append("&x_last_name=" + Security.UrlEncode(BillingLastName));
            transactionCommand.Append("&x_company=" + Security.UrlEncode(BillingCompany));
            transactionCommand.Append("&x_address=" + Security.UrlEncode(BillingAddress1));
            transactionCommand.Append("&x_city=" + Security.UrlEncode(BillingCity));
            transactionCommand.Append("&x_state=" + Security.UrlEncode(BillingState));
            transactionCommand.Append("&x_zip=" + Security.UrlEncode(BillingZip));
            transactionCommand.Append("&x_country=" + Security.UrlEncode(BillingCountry));

            DB.ExecuteSQL("update orders set RefundTXCommand=" + DB.SQuote(transactionCommand.ToString().Replace(X_TranKey, "*".PadLeft(X_TranKey.Length))) + " where OrderNumber=" + OriginalOrderNumber.ToString());

            if (TransID.Length == 0 || TransID == "0")
            {
                result = "Invalid or Empty Transaction ID";
            }
            else if (Last4.Length == 0)
            {
                result = "Credit Card Number (Last4) Not Found or Empty";
            }
            else
            {
                try
                {
                    byte[] data = encoding.GetBytes(transactionCommand.ToString());

                    // Prepare web request...
                    String         AuthServer = CommonLogic.IIF(useLiveTransactions, AppLogic.AppConfig("eProcessingNetwork_LIVE_SERVER"), AppLogic.AppConfig("eProcessingNetwork_TEST_SERVER"));
                    HttpWebRequest myRequest  = (HttpWebRequest)WebRequest.Create(AuthServer);
                    myRequest.Method        = "POST";
                    myRequest.ContentType   = "application/x-www-form-urlencoded";
                    myRequest.ContentLength = data.Length;
                    Stream newStream = myRequest.GetRequestStream();
                    // Send the data.
                    newStream.Write(data, 0, data.Length);
                    newStream.Close();
                    // get the response
                    WebResponse myResponse;
                    String      rawResponseString = String.Empty;
                    try
                    {
                        myResponse = myRequest.GetResponse();
                        using (StreamReader sr = new StreamReader(myResponse.GetResponseStream()))
                        {
                            rawResponseString = sr.ReadToEnd();
                            // Close and clean up the StreamReader
                            sr.Close();
                        }
                        myResponse.Close();
                    }
                    catch
                    {
                        rawResponseString = "0|||Error Calling eProcessing Network Payment Gateway||||||||";
                    }

                    // rawResponseString now has gateway response
                    String[] statusArray = rawResponseString.Split(AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR").ToCharArray());
                    // this seems to be a new item where auth.net is returing quotes around each parameter, so strip them out:
                    for (int i = statusArray.GetLowerBound(0); i <= statusArray.GetUpperBound(0); i++)
                    {
                        statusArray[i] = statusArray[i].Trim('\"');
                    }

                    String sql       = String.Empty;
                    String replyCode = statusArray[0].Replace(":", "");

                    DB.ExecuteSQL("update orders set RefundTXResult=" + DB.SQuote(rawResponseString) + " where OrderNumber=" + OriginalOrderNumber.ToString());
                    if (replyCode == "1")
                    {
                        result = AppLogic.ro_OK;
                    }
                    else
                    {
                        result = statusArray[3];
                    }
                }
                catch
                {
                    result = "NO RESPONSE FROM GATEWAY!";
                }
            }
            return(result);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            StringBuilder writer = new StringBuilder();

            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            Customer ThisCustomer = Context.GetCustomer();

            writer.Append("<div align=\"left\">");

            if (!ThisCustomer.IsAdminUser)            // safety check
            {
                writer.Append("<b><font color=red>PERMISSION DENIED</b></font>");
            }
            else
            {
                int   ONX         = CommonLogic.QueryStringUSInt("OrderNumber");
                Order ord         = new Order(ONX, ThisCustomer.LocaleSetting);
                bool  isForceVoid = CommonLogic.QueryStringBool("ForceVoid");

                if (isForceVoid)
                {
                    writer.Append("<b>FORCE VOID ORDER: " + ONX.ToString() + "</b><br/><br/>");
                    if (CommonLogic.FormCanBeDangerousContent("IsSubmit") == "true")
                    {
                        String Status = Gateway.OrderManagement_DoVoid(ord, true);
                        writer.Append("Force Voided Status: " + Status);
                        if (Status == AppLogic.ro_OK)
                        {
                            writer.Append("<script type=\"text/javascript\">\n");
                            writer.Append("opener.window.location = opener.window.location.href;");
                            writer.Append("</script>\n");
                        }
                        writer.Append("<p align=\"center\"><a href=\"javascript:self.close();\">Close</a></p>");
                    }
                    else
                    {
                        writer.Append("<form method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("voidorder.aspx") + "?ordernumber=" + ONX.ToString() + "&ForceVoid=1" + "&confirm=yes\" id=\"RefundOrderForm\" name=\"RefundOrderForm\">");
                        writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">");
                        writer.Append("<p align=\"center\">Are you sure you want to force void this order?<br/><br/></p>");
                        writer.AppendFormat("<p align=\"center\">{0}<br/><br/></p>", AppLogic.GetString("admin.orderframe.ForceVoidWarning"));
                        writer.Append("<p align=\"center\"><input type=\"submit\" class=\"btn btn-primary btn-sm\" name=\"submit\" value=\"&nbsp;&nbsp;Yes&nbsp;&nbsp;\">");
                        writer.Append("<img src=\"" + AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/spacer.gif") + "\" width=\"100\" height=\"1\">");
                        writer.Append("<input type=\"button\" class=\"btn btn-default btn-sm\" name=\"cancel\" value=\"&nbsp;&nbsp;No&nbsp;&nbsp;\" onClick=\"javascript:self.close();\">");
                        writer.Append("</p>");
                        writer.Append("</form>");
                    }
                }
                else
                {
                    writer.Append("<b>VOID ORDER: " + ONX.ToString() + "</b><br/><br/>");
                    if (CommonLogic.FormCanBeDangerousContent("IsSubmit") == "true")
                    {
                        String Status = Gateway.OrderManagement_DoVoid(ord);
                        writer.Append("Void Status: " + Status);
                        if (Status == AppLogic.ro_OK)
                        {
                            writer.Append("<script type=\"text/javascript\">\n");
                            writer.Append("opener.window.location = opener.window.location.href;");
                            writer.Append("</script>\n");
                        }
                        writer.Append("<p align=\"center\"><a href=\"javascript:self.close();\">Close</a></p>");
                    }
                    else
                    {
                        writer.Append("<form method=\"POST\" action=\"" + AppLogic.AdminLinkUrl("voidorder.aspx") + "?ordernumber=" + ONX.ToString() + "&confirm=yes\" id=\"RefundOrderForm\" name=\"RefundOrderForm\">");
                        writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">");
                        writer.Append("<p align=\"center\">Are you sure you want to void this order?<br/><br/></p>");
                        writer.Append("<p align=\"center\"><input type=\"submit\" class=\"btn btn-primary btn-sm\" name=\"submit\" value=\"&nbsp;&nbsp;Yes&nbsp;&nbsp;\">");
                        writer.Append("<img src=\"" + AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/spacer.gif") + "\" width=\"100\" height=\"1\">");
                        writer.Append("<input type=\"button\" class=\"btn btn-default btn-sm\" name=\"cancel\" value=\"&nbsp;&nbsp;No&nbsp;&nbsp;\" onClick=\"javascript:self.close();\">");
                        writer.Append("</p>");
                        writer.Append("</form>");
                    }
                }
            }
            writer.Append("</div>");
            ltContent.Text = writer.ToString();
        }
Esempio n. 9
0
 protected void btnSubmit1_Click(object sender, EventArgs e)
 {
     if (ddOnSale.SelectedValue != "0")
     {
         DB.ExecuteSQL("Update product set SalesPromptID=" + ddOnSale.SelectedValue + " where 1=1 " + CommonLogic.IIF(ddOnSaleCat.SelectedValue != "0", " and productid in (select distinct productid from productcategory   with (NOLOCK)  where categoryid=" + ddOnSaleCat.SelectedValue + ")", "") + CommonLogic.IIF(ddOnSaleDep.SelectedValue != "0", " and productid in (select distinct productid from productsection   with (NOLOCK)  where SectionID=" + ddOnSaleDep.SelectedValue + ")", "") + CommonLogic.IIF(ddOnSaleManu.SelectedValue != "0", " and productid in (select distinct productid from productmanufacturer   with (NOLOCK)  where manufacturerid=" + ddOnSaleManu.SelectedValue + ")", ""));
         AlertMessage.PushAlertMessage("On Sale Prompt updated", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
     }
 }
Esempio n. 10
0
        public FormSettings(GitUICommands aCommands, SettingsPageReference initalPage = null)
            : base(aCommands)
        {
            InitializeComponent();
            Translate();

            settingsTreeView.SuspendLayout();

            //if form is created for translation purpose
            if (aCommands == null)
            {
                return;
            }

            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsGroup(), null);
            SettingsPageReference gitExtPageRef = GitExtensionsSettingsGroup.GetPageReference();

            _commonLogic = new CommonLogic(Module);

            _checkSettingsLogic = new CheckSettingsLogic(_commonLogic, Module);

            var checklistSettingsPage = new ChecklistSettingsPage(_commonLogic, _checkSettingsLogic, Module, this);

            settingsTreeView.AddSettingsPage(checklistSettingsPage, gitExtPageRef, true); // as root

            settingsTreeView.AddSettingsPage(new GitSettingsPage(_checkSettingsLogic, this), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new AppearanceSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new ColorsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new StartPageSettingsPage(), gitExtPageRef);

            var globalSettingsSettingsPage = new GlobalSettingsSettingsPage(_commonLogic, _checkSettingsLogic, Module);

            settingsTreeView.AddSettingsPage(globalSettingsSettingsPage, gitExtPageRef);

            var localSettingsSettingsPage = new LocalSettingsSettingsPage(_commonLogic, _checkSettingsLogic, Module);

            settingsTreeView.AddSettingsPage(localSettingsSettingsPage, gitExtPageRef);

            var _sshSettingsPage = new SshSettingsPage(_commonLogic);

            settingsTreeView.AddSettingsPage(_sshSettingsPage, gitExtPageRef);
            checklistSettingsPage.SshSettingsPage = _sshSettingsPage;

            settingsTreeView.AddSettingsPage(new ScriptsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new HotkeysSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new ShellExtensionSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new AdvancedSettingsPage(), gitExtPageRef);
            SettingsPageReference advancedPageRef = AdvancedSettingsPage.GetPageReference();

            settingsTreeView.AddSettingsPage(new ConfirmationsSettingsPage(), advancedPageRef);

            settingsTreeView.AddSettingsPage(new PluginsSettingsGroup(), null);
            SettingsPageReference pluginsPageRef = PluginsSettingsGroup.GetPageReference();

            settingsTreeView.AddSettingsPage(new PluginRootIntroductionPage(), pluginsPageRef, true); // as root
            foreach (var gitPlugin in LoadedPlugins.Plugins)
            {
                var settingsPage = PluginSettingsPage.CreateSettingsPageFromPlugin(gitPlugin);
                settingsTreeView.AddSettingsPage(settingsPage, pluginsPageRef);
            }

            settingsTreeView.GotoPage(initalPage);
            settingsTreeView.ResumeLayout();
        }
        private void DoSubmit()
        {
            Page.Validate();
            if (Page.IsValid)
            {
                string FromAddress = txtFromAddress.Text;
                string ToAddress   = txtToAddress.Text;
                string BotAddress  = AppLogic.AppConfig("ReceiptEMailFrom");
                string Subject     = AppLogic.AppConfig("StoreName") + " - " + SE.MungeName(ProductName);
                var    Body        = new StringBuilder(4096);

                var runtimeParams = new List <XmlPackageParam>();
                runtimeParams.Add(new XmlPackageParam("Subject", Subject));
                runtimeParams.Add(new XmlPackageParam("ItemCode", ItemCode));
                runtimeParams.Add(new XmlPackageParam("UserCode", InterpriseHelper.ConfigInstance.UserCode));

                Body.Append(
                    AppLogic.RunXmlPackage(
                        "notification.emailproduct.xml.config",
                        null,
                        ThisCustomer,
                        SkinID,
                        string.Empty,
                        runtimeParams,
                        false,
                        false
                        )
                    );

                try
                {
                    if (AppLogic.AppConfig("MailMe_Server").Trim() != string.Empty)
                    {
                        AppLogic.SendMail(Subject, Body.ToString(), true, BotAddress, BotAddress, ToAddress, ToAddress, "", AppLogic.AppConfig("MailMe_Server"));
                        emailproduct_aspx_8.Text = AppLogic.GetString("emailproduct.aspx.8", SkinID, ThisCustomer.LocaleSetting);
                        pnlSuccess.Visible       = true;
                        pnlRequireReg.Visible    = false;
                        pnlEmailToFriend.Visible = false;
                    }
                    else
                    {
                        emailproduct_aspx_8.Text = AppLogic.GetString("emailproduct.aspx.24", SkinID, ThisCustomer.LocaleSetting);
                        pnlSuccess.Visible       = true;
                        pnlRequireReg.Visible    = false;
                        pnlEmailToFriend.Visible = false;
                    }
                    //mobile added design
                    divEmailBody.Visible = false;
                }
                catch (Exception ex)
                {
                    emailproduct_aspx_8.Text = string.Format(AppLogic.GetString("emailproduct.aspx.9", SkinID, ThisCustomer.LocaleSetting), CommonLogic.GetExceptionDetail(ex, "<br>"));
                    pnlSuccess.Visible       = true;
                    pnlRequireReg.Visible    = false;
                    pnlEmailToFriend.Visible = false;
                }
                ReturnToProduct.Text        = AppLogic.GetString("emailproduct.aspx.10", SkinID, ThisCustomer.LocaleSetting);
                ReturnToProduct.NavigateUrl = SE.MakeProductLink(productID.ToString(), SEName);
            }
            else
            {
                InitializePageContent();
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            ThisCustomer.RequireCustomerRecord();

            int PackID     = CommonLogic.QueryStringUSInt("PackID");
            int ProductID  = CommonLogic.QueryStringUSInt("ProductID");
            int VariantID  = CommonLogic.QueryStringUSInt("VariantID");
            int CategoryID = CommonLogic.QueryStringUSInt("CategoryID");
            int SectionID  = CommonLogic.QueryStringUSInt("SectionID");
            int Quantity   = CommonLogic.QueryStringUSInt("Quantity");

            if (Quantity == 0)
            {
                Quantity = 1;
            }

            //If editing a pack is from the shopping cart
            bool FromCart  = (CommonLogic.QueryStringUSInt("CartRecID") > 0);
            int  CartRecID = CommonLogic.QueryStringUSInt("CartRecID");

            String ChosenColor            = String.Empty;
            String ChosenColorSKUModifier = String.Empty;
            String ChosenSize             = String.Empty;
            String ChosenSizeSKUModifier  = String.Empty;

            if (CommonLogic.QueryStringCanBeDangerousContent("Color").Length != 0)
            {
                String[] ColorSel = CommonLogic.QueryStringCanBeDangerousContent("Color").Split(',');
                try
                {
                    ChosenColor = ColorSel[0];
                }
                catch { }
                try
                {
                    ChosenColorSKUModifier = ColorSel[1];
                }
                catch { }
            }
            if (ChosenColor.Length != 0)
            {
                ThisCustomer.ThisCustomerSession["ChosenColor"] = ChosenColor;
            }


            if (CommonLogic.QueryStringCanBeDangerousContent("Size").Length != 0)
            {
                String[] SizeSel = CommonLogic.QueryStringCanBeDangerousContent("Size").Split(',');
                try
                {
                    ChosenSize = SizeSel[0];
                }
                catch { }
                try
                {
                    ChosenSizeSKUModifier = SizeSel[1];
                }
                catch { }
            }
            if (ChosenSize.Length != 0)
            {
                ThisCustomer.ThisCustomerSession["ChosenSize"] = ChosenSize;
            }

            if (Quantity > 0)
            {
                // add to custom cart:
                if (FromCart)
                {
                    CustomCart.AddItem(PackID, ProductID, VariantID, Quantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier, CartRecID, ThisCustomer, CartTypeEnum.ShoppingCart);
                }
                else
                {
                    CustomCart cart = new CustomCart(ThisCustomer, PackID, 1, CartTypeEnum.ShoppingCart);
                    cart.AddItem(ProductID, VariantID, Quantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier);
                }
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("UpdateCartPack") == "")
            {
                String url = SE.MakeProductAndEntityLink(CommonLogic.QueryStringCanBeDangerousContent("entityname"), PackID, CommonLogic.QueryStringUSInt("entityid"), "");
                Response.Redirect(url + CommonLogic.IIF(FromCart, "?cartrecid=" + CartRecID.ToString(), ""));
            }
            else
            {
                Response.Redirect("shoppingcart.aspx");
            }
        }
    public static string getSectionName(string strV)
    {
        CommonLogic com = new CommonLogic();

        return(com.getNameByID(TEnvPDrinkSrcVo.T_ENV_P_DRINK_SRC_TABLE, "SECTION_NAME", "ID", strV));
    }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");


            QuantityDiscountID   = CommonLogic.QueryStringUSInt("QuantityDiscountID");
            QuantityDiscountName = QuantityDiscount.GetQuantityDiscountName(QuantityDiscountID, LocaleSetting);
            if (CommonLogic.FormBool("IsSubmitByCount"))
            {
                // check for new row addition:
                int    Low0     = CommonLogic.FormUSInt("Low_0");
                int    High0    = CommonLogic.FormUSInt("High_0");
                String NewGUID  = DB.GetNewGUID();
                int    NewRowID = 0;

                if (Low0 != 0 || High0 != 0)
                {
                    // add the new row if necessary:
                    Decimal Discount = CommonLogic.FormUSDecimal("Rate_0_" + QuantityDiscountID.ToString());
                    DB.ExecuteSQL("insert into QuantityDiscountTable(QuantityDiscountTableGUID,QuantityDiscountID,LowQuantity,HighQuantity,DiscountPercent) values(" + DB.SQuote(NewGUID) + "," + QuantityDiscountID.ToString() + "," + Localization.IntStringForDB(Low0) + "," + Localization.IntStringForDB(High0) + "," + Localization.DecimalStringForDB(Discount) + ")");
                }

                using (SqlConnection dbconn = DB.dbConn())
                {
                    dbconn.Open();
                    using (IDataReader rs = DB.GetRS("Select QuantityDiscountTableID from QuantityDiscountTable   with (NOLOCK)  where QuantityDiscountTableGUID=" + DB.SQuote(NewGUID), dbconn))
                    {
                        rs.Read();
                        NewRowID = DB.RSFieldInt(rs, "QuantityDiscountTableID");
                    }
                }

                // update existing rows:
                for (int i = 0; i <= Request.Form.Count - 1; i++)
                {
                    String FieldName = Request.Form.Keys[i];
                    if (FieldName.IndexOf("_0_") == -1 && FieldName != "Low_0" && FieldName != "High_0" && FieldName.IndexOf("_vldt") == -1 && (FieldName.IndexOf("Rate_") != -1 || FieldName.IndexOf("Low_") != -1 || FieldName.IndexOf("High_") != -1))
                    {
                        Decimal FieldVal = CommonLogic.FormUSDecimal(FieldName);
                        // this field should be processed
                        String[] Parsed = FieldName.Split('_');
                        if (FieldName.IndexOf("Rate_") != -1)
                        {
                            // update discount:
                            DB.ExecuteSQL("Update QuantityDiscountTable set DiscountPercent=" + Localization.DecimalStringForDB(FieldVal) + " where QuantityDiscountTableID=" + Parsed[1]);
                        }
                        if (FieldName.IndexOf("Low_") != -1)
                        {
                            // update low value:
                            DB.ExecuteSQL("Update QuantityDiscountTable set LowQuantity=" + FieldVal.ToString() + " where QuantityDiscountTableID=" + DB.SQuote(Parsed[1]));
                        }
                        if (FieldName.IndexOf("High_") != -1)
                        {
                            // update high value:
                            DB.ExecuteSQL("Update QuantityDiscountTable set HighQuantity=" + FieldVal.ToString() + " where QuantityDiscountTableID=" + DB.SQuote(Parsed[1]));
                        }
                    }
                }
                DB.ExecuteSQL("Update QuantityDiscountTable set HighQuantity=999999 where HighQuantity=0 and LowQuantity<>0");
            }

            if (CommonLogic.QueryStringCanBeDangerousContent("deleteByCountid").Length != 0)
            {
                DB.ExecuteSQL("delete from QuantityDiscountTable where QuantityDiscountTableID=" + CommonLogic.QueryStringCanBeDangerousContent("deleteByCountid"));
            }
            SectionTitle = "<a href=\"" + AppLogic.AdminLinkUrl("quantitydiscounts.aspx") + "\">" + AppLogic.GetString("admin.editquantitydiscounttable.QuantityDiscounts", SkinID, LocaleSetting) + "</a> - " + String.Format(AppLogic.GetString("admin.editquantitydiscounttable.ManageQuantityDiscountTable", SkinID, LocaleSetting), QuantityDiscountName);
            Render();
        }
Esempio n. 15
0
        protected void UpdateTopic()
        {
            Topic         originalTopic   = new Topic(EditingTopicId);
            StringBuilder sql             = new StringBuilder(2500);
            int           StoreID         = 0;
            bool          bTopicNameExist = IsTopicNameExist(out StoreID);
            int           ExistingTopicId = Topic.GetTopicID(TopicName, LocaleSetting, originalTopic.StoreID);

            if (TopicName != originalTopic.TopicName && ExistingTopicId != originalTopic.TopicID && ExistingTopicId > 0)
            {
                resetError("The topic name entered already exists. Please choose a unique topic name.", true);
                return;
            }
            sql.Append("update Topic set ");
            sql.Append("Published=" + (CommonLogic.IIF(chkPublished.Checked, 1, 0)).ToString() + ",");
            sql.Append("Name=" + DB.SQuote(AppLogic.FormLocaleXml("Name", TopicName, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ",");
            sql.Append("SkinID=" + Localization.ParseUSInt(txtSkin.Text) + ",");
            sql.Append("DisplayOrder=" + Localization.ParseUSInt(txtDspOrdr.Text) + ",");
            sql.Append("ContentsBGColor=" + DB.SQuote(txtContentsBG.Text) + ",");
            sql.Append("PageBGColor=" + DB.SQuote(txtPageBG.Text) + ",");
            sql.Append("GraphicsColor=" + DB.SQuote(txtSkinColor.Text) + ",");
            sql.Append("Title=" + DB.SQuote(AppLogic.FormLocaleXml("Title", ltTitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ",");
            sql.Append("IsFrequent=" + (CommonLogic.IIF(chkIsFrequent.Checked, 1, 0)).ToString() + ",");

            String desc = String.Empty;

            if (bUseHtmlEditor)
            {
                desc = AppLogic.FormLocaleXml("Description", radDescription.Content, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId));
            }
            else
            {
                desc = AppLogic.FormLocaleXmlEditor("Description", "Description", LocaleSetting, "topic", Convert.ToInt32(EditingTopicId));
            }
            if (desc.Length != 0)
            {
                sql.Append("Description=" + DB.SQuote(desc) + ",");
            }
            else
            {
                sql.Append("Description=NULL,");
            }
            if (txtPassword.Text.Trim().Length != 0)
            {
                sql.Append("Password="******",");
            }
            else
            {
                sql.Append("Password=NULL,");
            }
            sql.Append("RequiresSubscription=" + rbSubscription.SelectedValue.ToString() + ",");
            sql.Append("HTMLOk=" + rbHTML.SelectedValue.ToString() + ",");
            sql.Append("RequiresDisclaimer=" + rbDisclaimer.SelectedValue.ToString() + ",");
            sql.Append("ShowInSiteMap=" + rbPublish.SelectedValue.ToString() + ",");
            if (AppLogic.FormLocaleXml("SEKeywords", ltSEKeywords.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0)
            {
                sql.Append("SEKeywords=" + DB.SQuote(AppLogic.FormLocaleXml("SEKeywords", ltSEKeywords.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ",");
            }
            else
            {
                sql.Append("SEKeywords=NULL,");
            }
            if (AppLogic.FormLocaleXml("SEDescription", ltSEDescription.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0)
            {
                sql.Append("SEDescription=" + DB.SQuote(AppLogic.FormLocaleXml("SEDescription", ltSEDescription.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))) + ",");
            }
            else
            {
                sql.Append("SEDescription=NULL,");
            }
            if (AppLogic.FormLocaleXml("SETitle", ltSETitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId)).Length != 0)
            {
                sql.Append("SETitle=" + DB.SQuote(AppLogic.FormLocaleXml("SETitle", ltSETitle.Text, LocaleSetting, "topic", Convert.ToInt32(EditingTopicId))));
            }
            else
            {
                sql.Append("SETitle=NULL");
            }
            sql.Append(" where TopicID=" + EditingTopicId.ToString());

            DB.ExecuteSQL(sql.ToString());
            resetError("Topic updated.", false);

            int EditedTopic = EditingTopicId;

            UnloadTopic();
            if (TopicSaved != null)
            {
                TopicSaved(this, new TopicEditEventArgs(EditedTopic, originalTopic.TopicName != TopicName));
            }
        }
Esempio n. 16
0
        protected void SaveNewTopic()
        {
            int           CurrentStore = ssOne.SelectedStoreID;
            StringBuilder sql          = new StringBuilder(2500);
            String        NewGUID      = DB.GetNewGUID();

            sql.Append("insert into Topic(TopicGUID,Name,SkinID,DisplayOrder,ContentsBGColor,PageBGColor,GraphicsColor,Published,Title,IsFrequent,Description,Password,RequiresSubscription,HTMLOk,RequiresDisclaimer,ShowInSiteMap,SEKeywords,SEDescription,SETitle,StoreID) values(");
            sql.Append(DB.SQuote(NewGUID) + ",");
            sql.Append(DB.SQuote(AppLogic.FormLocaleXml(TopicName, LocaleSetting)) + ",");
            sql.Append(Localization.ParseUSInt(txtSkin.Text) + ",");
            sql.Append(Localization.ParseUSInt(txtDspOrdr.Text) + ",");
            sql.Append(DB.SQuote(txtContentsBG.Text) + ",");
            sql.Append(DB.SQuote(txtPageBG.Text) + ",");
            sql.Append(DB.SQuote(txtSkinColor.Text) + ",");
            sql.Append(DB.SQuote(CommonLogic.IIF(chkPublished.Checked, 1, 0).ToString()) + ",");
            sql.Append(DB.SQuote(AppLogic.FormLocaleXml(ltTitle.Text, LocaleSetting)) + ",");
            sql.Append(DB.SQuote(CommonLogic.IIF(chkIsFrequent.Checked, 1, 0).ToString()) + ",");
            String desc = String.Empty;

            if (bUseHtmlEditor)
            {
                desc = AppLogic.FormLocaleXml(radDescription.Content, LocaleSetting);
            }
            else
            {
                desc = AppLogic.FormLocaleXml(CommonLogic.FormCanBeDangerousContent("Description"), LocaleSetting);
            }
            if (desc.Length != 0)
            {
                sql.Append(DB.SQuote(desc) + ",");
            }
            else
            {
                sql.Append("NULL,");
            }
            if (txtPassword.Text.Trim().Length != 0)
            {
                sql.Append(DB.SQuote(txtPassword.Text) + ",");
            }
            else
            {
                sql.Append("NULL,");
            }
            sql.Append(rbSubscription.SelectedValue.ToString() + ",");
            sql.Append(rbHTML.SelectedValue.ToString() + ",");
            sql.Append(rbDisclaimer.SelectedValue.ToString() + ",");
            sql.Append(rbPublish.SelectedValue.ToString() + ",");
            if (AppLogic.FormLocaleXml(ltSEKeywords.Text, LocaleSetting).Length != 0)
            {
                sql.Append(DB.SQuote(AppLogic.FormLocaleXml(ltSEKeywords.Text, LocaleSetting)) + ",");
            }
            else
            {
                sql.Append("NULL,");
            }
            if (AppLogic.FormLocaleXml(ltSEDescription.Text, LocaleSetting).Length != 0)
            {
                sql.Append(DB.SQuote(AppLogic.FormLocaleXml(ltSEDescription.Text, LocaleSetting)) + ",");
            }
            else
            {
                sql.Append("NULL,");
            }
            if (AppLogic.FormLocaleXml(ltSETitle.Text, LocaleSetting).Length != 0)
            {
                sql.Append(DB.SQuote(AppLogic.FormLocaleXml(ltSETitle.Text, LocaleSetting)) + ",");
            }
            else
            {
                sql.Append("NULL" + ",");
            }

            if (CurrentStore == 0 || Store.StoreCount == 1)
            {
                sql.Append("0");
            }
            else
            {
                sql.Append(CurrentStore.ToString());
            }

            sql.Append(")");
            try
            {
                DB.ExecuteSQL(sql.ToString());
                resetError("Topic added.", false);
            }
            catch (Exception ex)
            {
                resetError(ex.Message, true);
                return;
            }
            using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (IDataReader rs = DB.GetRS(string.Format("select TopicID from Topic with (NOLOCK) where deleted=0 and TopicGUID={0}", DB.SQuote(NewGUID)), con))
                {
                    rs.Read();
                    UnloadTopic();
                    if (TopicAdded != null)
                    {
                        TopicAdded(this, new TopicEditEventArgs(DB.RSFieldInt(rs, "TopicID"), false));
                    }
                }
            }
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileHelper.RedirectPageWhenMobileIsDisabled("~/emailproduct.aspx", ThisCustomer);

            ProductID = CommonLogic.QueryStringUSInt("ProductID");

            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            // DOS attack prevention:
            if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority))
            {
                Response.Redirect(SE.MakeDriverLink("EmailError"));
            }
            if (ProductID == 0)
            {
                Response.Redirect("~/default.aspx");
            }
            if (AppLogic.ProductHasBeenDeleted(ProductID))
            {
                Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
            }



            EntityHelper CategoryHelper = AppLogic.LookupHelper("Category", AppLogic.StoreID());

            baseSkinID = (Page as SkinBase).SkinID;

            using (SqlConnection conn = DB.dbConn())
            {
                conn.Open();
                using (IDataReader rs = DB.GetRS("select p.*, pv.name variantname from product p  with (NOLOCK)  join productvariant pv  with (NOLOCK)  on p.ProductID = pv.ProductID and pv.isdefault = 1 where p.ProductID=" + ProductID.ToString(), conn))
                {
                    if (!rs.Read())
                    {
                        Response.Redirect("default.aspx");
                    }
                    SEName      = DB.RSField(rs, "SEName");
                    ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);
                    VariantName = DB.RSFieldByLocale(rs, "VariantName", ThisCustomer.LocaleSetting);

                    RequiresReg        = DB.RSFieldBool(rs, "RequiresRegistration");
                    ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting);
                    if (AppLogic.ReplaceImageURLFromAssetMgr)
                    {
                        ProductDescription = ProductDescription.Replace("../images", "images");
                    }
                    String FileDescription = new ProductDescriptionFile(ProductID, ThisCustomer.LocaleSetting, baseSkinID).Contents;
                    if (FileDescription.Length != 0)
                    {
                        ProductDescription += "<div align=\"left\">" + FileDescription + "</div>";
                    }
                }
            }

            String SourceEntityInstanceName = String.Empty;

            SourceEntity             = Profile.LastViewedEntityName;
            SourceEntityInstanceName = Profile.LastViewedEntityInstanceName;
            SourceEntityID           = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0"));;

            // validate that source entity id is actually valid for this product:
            if (SourceEntityID != 0)
            {
                String sqlx = "select count(*) as N from dbo.productentity  with (NOLOCK)  where ProductID=" + ProductID.ToString() + " and EntityID=" + SourceEntityID.ToString() + " and EntityType = " + DB.SQuote(SourceEntity);
                if (DB.GetSqlN(sqlx) == 0)
                {
                    SourceEntityID = 0;
                }
            }

            // we had no entity context coming in, try to find a category context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    CategoryID   = SourceEntityID;
                    CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = CategoryID.ToString();
                    Profile.LastViewedEntityInstanceName = CategoryName;
                    SourceEntity             = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = CategoryName;
                }
            }

            // we had no entity context coming in, try to find a section context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    SectionID   = SourceEntityID;
                    SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = SectionID.ToString();
                    Profile.LastViewedEntityInstanceName = SectionName;
                    SourceEntity             = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = SectionName;
                }
            }

            // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible:
            if (SourceEntityID == 0)
            {
                SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName);
                if (SourceEntityID > 0)
                {
                    ManufacturerID                       = SourceEntityID;
                    ManufacturerName                     = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting);
                    Profile.LastViewedEntityName         = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    Profile.LastViewedEntityInstanceID   = ManufacturerID.ToString();
                    Profile.LastViewedEntityInstanceName = ManufacturerName;
                    SourceEntity             = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName;
                    SourceEntityInstanceName = ManufacturerName;
                }
            }

            // build up breadcrumb if we need:
            (Page as SkinBase).SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer);

            reqToAddress.ErrorMessage     = AppLogic.GetString("emailproduct.aspx.13", baseSkinID, ThisCustomer.LocaleSetting);
            regexToAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.14", baseSkinID, ThisCustomer.LocaleSetting);
            reqFromAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.16", baseSkinID, ThisCustomer.LocaleSetting);
            regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", baseSkinID, ThisCustomer.LocaleSetting);

            if (!this.IsPostBack)
            {
                InitializePageContent();
            }
        }
Esempio n. 18
0
        private void InitializePageContent()
        {
            pnlRequireReg.Visible         = (RequiresReg && !ThisCustomer.IsRegistered);
            this.pnlEmailToFriend.Visible = !(RequiresReg && !ThisCustomer.IsRegistered);

            emailproduct_aspx_1.Text = "<br/><br/><br/><br/><b>" + AppLogic.GetString("emailproduct.aspx.1", baseSkinID, 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", baseSkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("emailproduct.aspx.3", baseSkinID, ThisCustomer.LocaleSetting);

            String ProdPic             = String.Empty;
            bool   m_WatermarksEnabled = AppLogic.AppConfigBool("Watermark.Enabled");

            if (m_WatermarksEnabled)
            {
                ProdPic = String.Format("watermark.axd?productid={0}&size=medium", ProductID.ToString());
            }
            else
            {
                ProdPic = AppLogic.LookupImage("Product", ProductID, "medium", baseSkinID, ThisCustomer.LocaleSetting);
            }
            imgProduct.ImageUrl        = ProdPic;
            ProductNavLink.NavigateUrl = SE.MakeProductAndEntityLink(this.SourceEntity, ProductID, SourceEntityID, SEName);
            ProductNavLink.Text        = AppLogic.GetString("emailproduct.aspx.24", baseSkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_4.Text   = AppLogic.GetString("emailproduct.aspx.4", baseSkinID, ThisCustomer.LocaleSetting) + " " + ProductName + CommonLogic.IIF(VariantName.Length > 0, " - " + VariantName, "");
            emailproduct_aspx_11.Text  = AppLogic.GetString("emailproduct.aspx.11", baseSkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_22.Text  = AppLogic.GetString("emailproduct.aspx.22", baseSkinID, ThisCustomer.LocaleSetting);
            emailproduct_aspx_15.Text  = AppLogic.GetString("emailproduct.aspx.15", baseSkinID, ThisCustomer.LocaleSetting);
            //emailproduct_aspx_18.Text = AppLogic.GetString("emailproduct.aspx.18", baseSkinID, ThisCustomer.LocaleSetting);
            //emailproduct_aspx_19.Text = AppLogic.GetString("emailproduct.aspx.19", baseSkinID, ThisCustomer.LocaleSetting);
            btnSubmit.Text = AppLogic.GetString("emailproduct.aspx.20", baseSkinID, ThisCustomer.LocaleSetting);
        }
        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 (var con = DB.NewSqlConnection())
            {
                con.Open();
                using (var 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 (var con = DB.NewSqlConnection())
            {
                con.Open();
                using (var 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);
            btnSubmit.Text             = AppLogic.GetString("emailproduct.aspx.20", SkinID, ThisCustomer.LocaleSetting);
        }
Esempio n. 20
0
        private static void RunApplication()
        {
            string[] args = Environment.GetCommandLineArgs();

            // This form created to obtain UI synchronization context only
            using (new Form())
            {
                // Store the shared JoinableTaskContext
                ThreadHelper.JoinableTaskContext = new JoinableTaskContext();
            }

            AppSettings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                WebBrowserEmulationMode.SetBrowserFeatureControl();
                FormFixHome.CheckHomePath();
            }

            if (string.IsNullOrEmpty(AppSettings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                // Ensure we can find the git command to execute,
                // unless we are being instructed to uninstall,
                // or AppSettings.CheckSettings is set to false.
                if (!(args.Length >= 2 && args[1] == "uninstall") &&
                    (AppSettings.CheckSettings ||
                     string.IsNullOrEmpty(AppSettings.GitCommandValue) ||
                     !File.Exists(AppSettings.GitCommandValue)))
                {
                    var uiCommands         = new GitUICommands("");
                    var commonLogic        = new CommonLogic(uiCommands.Module);
                    var checkSettingsLogic = new CheckSettingsLogic(commonLogic);
                    var fakePageHost       = new SettingsPageHostMock(checkSettingsLogic);
                    using (var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(fakePageHost))
                    {
                        if (!checklistSettingsPage.CheckSettings())
                        {
                            if (!checkSettingsLogic.AutoSolveAllSettings())
                            {
                                uiCommands.StartSettingsDialog();
                            }
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            var commands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                commands.StartBrowseDialog(startWithDashboard: !AppSettings.StartWithRecentWorkingDir);
            }
            else
            {
                // if we are here args.Length > 1
                commands.RunCommand(args);
            }

            AppSettings.SaveSettings();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            productID = CommonLogic.QueryStringUSInt("productId");
            ItemCode  = InterpriseHelper.GetInventoryItemCode(productID);
            var CategoryHelper     = AppLogic.LookupHelper(base.EntityHelpers, "Category");
            var SectionHelper      = AppLogic.LookupHelper(base.EntityHelpers, "Department");
            var ManufacturerHelper = AppLogic.LookupHelper(base.EntityHelpers, "Manufacturer");

            CategoryID     = CommonLogic.QueryStringCanBeDangerousContent("CategoryID");
            DepartmentID   = CommonLogic.QueryStringCanBeDangerousContent("DepartmentID");
            ManufacturerID = CommonLogic.QueryStringCanBeDangerousContent("ManufacturerID");

            string SourceEntity   = "Category";
            string SourceEntityID = string.Empty;

            if (AppLogic.AppConfigBool("GoNonSecureAgain"))
            {
                SkinBase.GoNonSecureAgain();
            }
            // DOS attack prevention:
            if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority))
            {
                Response.Redirect(SE.MakeDriverLink("EmailError"));
            }
            if (ItemCode == string.Empty)
            {
                Response.Redirect("default.aspx");
            }
            if (AppLogic.ProductHasBeenDeleted(productID))
            {
                Response.Redirect(SE.MakeDriverLink("ProductNotFound"));
            }


            using (var con = DB.NewSqlConnection())
            {
                con.Open();
                using (var rs = DB.GetRSFormat(con, "SELECT * FROM EcommerceViewProduct with (NOLOCK) " +
                                               " WHERE Counter=" + productID +
                                               " AND ShortString=" + DB.SQuote(ThisCustomer.LocaleSetting) +
                                               " AND WebSiteCode=" + DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode)))
                {
                    if (!rs.Read())
                    {
                        Response.Redirect("default.aspx");
                    }

                    SEName = SE.MungeName(DB.RSField(rs, "SEName"));
                    if (DB.RSField(rs, "ItemDescription").ToString() != string.Empty)
                    {
                        ProductName = DB.RSField(rs, "ItemDescription");
                    }
                    else
                    {
                        ProductName = DB.RSField(rs, "ItemName");
                    }

                    RequiresReg        = DB.RSFieldBool(rs, "RequiresRegistration");
                    ProductDescription = DB.RSField(rs, "ItemDescription");
                    if (AppLogic.ReplaceImageURLFromAssetMgr)
                    {
                        ProductDescription = ProductDescription.Replace("../images", "images");
                    }
                    string FileDescription = new ProductDescriptionFile(ItemCode, ThisCustomer.LocaleSetting, SkinID).Contents;
                    if (FileDescription.Length != 0)
                    {
                        ProductDescription += "<div align=\"left\">" + FileDescription + "</div>";
                    }
                }
            }

            if (Convert.ToInt32(CategoryID) == 0)
            {
                // no category passed in, pick first one that this product is mapped to:
                string tmpS = CategoryHelper.GetObjectEntities(ItemCode, false);
                if (tmpS.Length != 0)
                {
                    string[] catIDs = tmpS.Split(',');
                    CategoryID = Convert.ToString(Localization.ParseUSInt(catIDs[0]));
                }
            }

            string CategoryName     = CommonLogic.IIF(CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) != string.Empty, CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting), CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting));
            string SectionName      = CommonLogic.IIF(SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) != string.Empty, SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting), SectionHelper.GetEntityName(DepartmentID, ThisCustomer.LocaleSetting));
            string ManufacturerName = CommonLogic.IIF(ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) != string.Empty, ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting), ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting));

            SourceEntity = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityName", true);
            string SourceEntityInstanceName = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceName", true);

            SourceEntityID = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceID", true);

            // validate that source entity id is actually valid for this product:
            if (SourceEntityID.Length != 0)
            {
                var alE = EntityHelper.GetProductEntityList(ItemCode, SourceEntity);
                if (alE.IndexOf(Localization.ParseNativeInt(SourceEntityID)) == -1)
                {
                    SourceEntityID = string.Empty;
                }
            }

            if (SourceEntityID.Length != 0)
            {
                PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, false);
            }
            else
            {
                PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, true);
            }

            SectionTitle += "<span class=\"SectionTitleText\">";
            SectionTitle += ProductName;
            SectionTitle += "</span>";

            reqToAddress.ErrorMessage     = AppLogic.GetString("emailproduct.aspx.13", SkinID, ThisCustomer.LocaleSetting);
            regexToAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.14", SkinID, ThisCustomer.LocaleSetting);
            reqFromAddress.ErrorMessage   = AppLogic.GetString("emailproduct.aspx.16", SkinID, ThisCustomer.LocaleSetting);
            regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", SkinID, ThisCustomer.LocaleSetting);

            if (!this.IsPostBack)
            {
                InitializePageContent();
            }
        }
Esempio n. 22
0
        protected void gMain_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gMain.Rows[e.RowIndex];

            if (row != null)
            {
                string orig              = ViewState["OriginalZip"].ToString();
                string zip               = (((TextBox)row.FindControl("txtZip")).Text.Trim()).ToString();
                string countryid         = ((DropDownList)row.FindControl("ddlCountry")).SelectedValue.Trim();
                string OriginalCountryID = AppLogic.GetCountryID(ViewState["OriginalCountryID"].ToString()).ToString();

                StringBuilder sql = new StringBuilder(1024);

                //make sure no duplicates
                if (!orig.Equals(zip))
                {
                    int count = DB.GetSqlN(String.Format("SELECT count(*) AS N FROM ZipTaxRate WHERE ZipCode = {0} and CountryId = {1}", DB.SQuote(zip), CommonLogic.IIF(someCountryRequirePostalCode > 0, Convert.ToInt32(countryid), -1)));
                    if (count > 0)
                    {
                        resetError("Duplicate Zip Code exists", true);
                        return;
                    }
                }

                try
                {
                    resetError("Item updated", false);
                    gMain.EditIndex        = -1;
                    ViewState["SQLString"] = selectSQL;

                    for (int i = 0; i <= Request.Form.Count - 1; i++)
                    {
                        //TR_CLASSID_ZipCode
                        if (Request.Form.Keys[i].IndexOf("TR_") != -1)
                        {
                            String[] keys    = Request.Form.Keys[i].Split('_');
                            string   ZipCode = keys[2];
                            int      ClassID = Localization.ParseUSInt(keys[1]);
                            decimal  taxrate = Decimal.Zero;
                            if (ZipCode == orig && e.RowIndex == Convert.ToInt32(keys[3]))
                            {
                                try
                                {
                                    taxrate = Localization.ParseNativeDecimal(Request.Form[Request.Form.Keys[i]]);
                                }
                                catch { }

                                ZipTaxRate ztr3 = AppLogic.ZipTaxRatesTable[zip, ClassID, Convert.ToInt32(countryid)];
                                try
                                {
                                    if (ztr3 != null)
                                    {
                                        if (Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID))
                                        {
                                            resetError("Zip Code, Tax Class ID and Country ID already exists.", false);
                                        }
                                        else
                                        {
                                            ztr3.Update(taxrate, Convert.ToInt32(countryid));
                                        }
                                    }
                                    else
                                    {
                                        bool validZipFormat = true;
                                        if ((Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID)) || (orig != zip))
                                        {
                                            if (Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID))
                                            {
                                                validZipFormat = AppLogic.ValidatePostalCode(zip, Convert.ToInt32(countryid));
                                            }
                                            if (validZipFormat)
                                            {
                                                ZipTaxRates ztr2 = new ZipTaxRates();
                                                foreach (ZipTaxRate ztr in ztr2.All)
                                                {
                                                    if (ztr.ZipCode == orig && ztr.TaxClassID == ClassID && ztr.CountryID == Convert.ToInt32(OriginalCountryID))
                                                    {
                                                        ztr.Update(taxrate, zip, Convert.ToInt32(countryid), Convert.ToInt32(OriginalCountryID));
                                                        AppLogic.ZipTaxRatesTable.AddNewRate(ztr.ZipTaxID, zip, ClassID, taxrate, Convert.ToInt32(countryid));
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                resetError(AppLogic.GetCountryPostalErrorMessage(Convert.ToInt32(countryid), cust.SkinID, cust.LocaleSetting), true);
                                            }
                                        }
                                        else
                                        {
                                            AppLogic.ZipTaxRatesTable.Add(ZipCode, ClassID, taxrate, Convert.ToInt32(countryid));
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    string err = ex.Message;
                                }
                            }
                        }
                    }
                    buildGridData();
                }
                catch (Exception ex)
                {
                    throw new Exception("Couldn't update database: " + sql.ToString() + ex.ToString());
                }
            }
        }
Esempio n. 23
0
 private void BrowseCommitTemplate_Click(object sender, EventArgs e)
 {
     CommitTemplatePath.Text = CommonLogic.SelectFile(".", "*.txt (*.txt)|*.txt", CommitTemplatePath.Text);
 }
Esempio n. 24
0
 private void OtherSshBrowse_Click(object sender, EventArgs e)
 {
     OtherSsh.Text = CommonLogic.SelectFile(".", "Executable file (*.exe)|*.exe", OtherSsh.Text);
 }
Esempio n. 25
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string filepath      = CommonLogic.SafeMapPath("../images") + "\\";
            string filename      = "priceexport_" + Localization.ToNativeDateTimeString(System.DateTime.Now).Replace(" ", "").Replace("/", "").Replace(":", "").Replace(".", "");
            string fileextension = String.Empty;

            string xml        = AppLogic.ExportProductList(Localization.ParseNativeInt(ddCategory.SelectedValue), Localization.ParseNativeInt(ddSection.SelectedValue), Localization.ParseNativeInt(ddManufacturer.SelectedValue), Localization.ParseNativeInt(ddDistributor.SelectedValue), Localization.ParseNativeInt(ddGenre.SelectedValue), Localization.ParseNativeInt(ddVector.SelectedValue));
            string exporttype = rblExport.SelectedValue;

            //remove old export files
            string[] oldfiles = Directory.GetFiles(filepath, "priceexport_*." + exporttype);
            foreach (string oldfile in oldfiles)
            {
                try
                {
                    File.Delete(oldfile);
                }
                catch { }
            }

            XmlDocument xdoc = new XmlDocument();

            xdoc.LoadXml(xml);

            string FullFilePath      = filepath + filename;
            XslCompiledTransform xsl = new XslCompiledTransform();

            Customer         c    = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;
            XsltArgumentList args = new XsltArgumentList();

            args.AddParam("locale", "", c.LocaleSetting);

            if (exporttype == "xls")
            {
                FullFilePath += ".xls";
                fileextension = ".xls";
                xsl.Load(CommonLogic.SafeMapPath("XmlPackages/ProductPricingExportExcel.xslt"));
                StringWriter xsw = new StringWriter();
                xsl.Transform(xdoc, args, xsw);
                xdoc.LoadXml(xsw.ToString());
                XmlToExcel.ConvertToExcel(xdoc, FullFilePath);
            }
            else
            {
                if (exporttype == "xml")
                {
                    FullFilePath += ".xml";
                    fileextension = ".xml";
                    xsl.Load(CommonLogic.SafeMapPath("XmlPackages/ProductPricingExport.xslt"));
                }
                else
                {
                    FullFilePath += ".csv";
                    fileextension = ".csv";
                    xsl.Load(CommonLogic.SafeMapPath("XmlPackages/ProductPricingExportCSV.xslt"));
                }

                StreamWriter sw = new StreamWriter(FullFilePath);
                xsl.Transform(xdoc, args, sw);
                sw.Close();
            }

            Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=ProductPricing" + fileextension);
            Response.BufferOutput = false;
            if (exporttype == "xml")
            {
                //Send the XML
                Response.ContentType = "text/xml";
                Response.Write(XmlCommon.PrettyPrintXml(CommonLogic.ReadFile(FullFilePath, false)));
                Response.Flush();
                Response.End();
            }
            else if (exporttype == "xls")
            {
                Response.ContentType = "application/vnd.ms-excel";
                Response.Charset     = "";
                Response.TransmitFile(FullFilePath);
                Response.Flush();
                Response.End();
            }
            else
            {
                // Send the CSV
                Response.BufferOutput = false;
                Response.ContentType  = "application/x-unknown";
                Response.TransmitFile(FullFilePath);
                Response.Flush();
                Response.End();
            }
        }
Esempio n. 26
0
 private void PuttyBrowse_Click(object sender, EventArgs e)
 {
     PlinkPath.Text = CommonLogic.SelectFile(".",
                                             "Plink.exe (plink.exe)|plink.exe|TortoisePlink.exe (tortoiseplink.exe)|tortoiseplink.exe",
                                             PlinkPath.Text);
 }
Esempio n. 27
0
        public override String CaptureOrder(Order o)
        {
            String result = AppLogic.ro_OK;

            o.CaptureTXCommand = "";
            o.CaptureTXResult  = "";
            bool    useLiveTransactions = AppLogic.AppConfigBool("UseLiveTransactions");
            String  TransID             = o.AuthorizationPNREF;
            Decimal OrderTotal          = o.OrderBalance;

            ASCIIEncoding encoding           = new ASCIIEncoding();
            StringBuilder transactionCommand = new StringBuilder(4096);

            transactionCommand.Append("x_type=PRIOR_AUTH_CAPTURE");

            String X_Login = AppLogic.AppConfig("eProcessingNetwork_X_LOGIN");

            if (X_Login.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_Login = reg.Read("eProcessingNetwork_X_LOGIN");
                reg     = null;
            }

            String X_TranKey = AppLogic.AppConfig("eProcessingNetwork_X_TRAN_KEY");

            if (X_TranKey.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_TranKey = reg.Read("eProcessingNetwork_X_TRAN_KEY");
                reg       = null;
            }

            transactionCommand.Append("&x_login="******"&x_tran_key=" + X_TranKey);
            transactionCommand.Append("&x_version=" + AppLogic.AppConfig("eProcessingNetwork_X_VERSION"));
            transactionCommand.Append("&x_test_request=" + CommonLogic.IIF(useLiveTransactions, "FALSE", "TRUE"));
            transactionCommand.Append("&x_method=" + AppLogic.AppConfig("eProcessingNetwork_X_METHOD"));
            transactionCommand.Append("&x_delim_Data=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_DATA"));
            transactionCommand.Append("&x_delim_Char=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR"));
            transactionCommand.Append("&x_encap_char=" + AppLogic.AppConfig("eProcessingNetwork_X_ENCAP_CHAR"));
            transactionCommand.Append("&x_relay_response=" + AppLogic.AppConfig("eProcessingNetwork_X_RELAY_RESPONSE"));
            transactionCommand.Append("&x_customer_ip=" + CommonLogic.CustomerIpAddress());
            transactionCommand.Append("&x_trans_id=" + TransID);
            if (OrderTotal != System.Decimal.Zero)
            {
                // amount could have changed by admin user, so capture the current Order Total from the db:
                transactionCommand.Append("&x_amount=" + Localization.CurrencyStringForGatewayWithoutExchangeRate(OrderTotal));
            }
            o.CaptureTXCommand = transactionCommand.ToString().Replace(X_TranKey, "*".PadLeft(X_TranKey.Length));

            try
            {
                byte[] data = encoding.GetBytes(transactionCommand.ToString());

                // Prepare web request...
                String         AuthServer = CommonLogic.IIF(useLiveTransactions, AppLogic.AppConfig("eProcessingNetwork_LIVE_SERVER"), AppLogic.AppConfig("eProcessingNetwork_TEST_SERVER"));
                HttpWebRequest myRequest  = (HttpWebRequest)WebRequest.Create(AuthServer);
                myRequest.Method        = "POST";
                myRequest.ContentType   = "application/x-www-form-urlencoded";
                myRequest.ContentLength = data.Length;
                Stream newStream = myRequest.GetRequestStream();
                // Send the data.
                newStream.Write(data, 0, data.Length);
                newStream.Close();
                // get the response
                WebResponse myResponse;
                String      rawResponseString = String.Empty;
                try
                {
                    myResponse = myRequest.GetResponse();
                    using (StreamReader sr = new StreamReader(myResponse.GetResponseStream()))
                    {
                        rawResponseString = sr.ReadToEnd();
                        // Close and clean up the StreamReader
                        sr.Close();
                    }
                    myResponse.Close();
                }
                catch
                {
                    rawResponseString = "0|||Error Calling eProcessingNetwork Payment Gateway||||||||";
                }

                // rawResponseString now has gateway response
                String[] statusArray = rawResponseString.Split(AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR").ToCharArray());
                // this seems to be a new item where auth.net is returing quotes around each parameter, so strip them out:
                for (int i = statusArray.GetLowerBound(0); i <= statusArray.GetUpperBound(0); i++)
                {
                    statusArray[i] = statusArray[i].Trim('\"');
                }

                String sql       = String.Empty;
                String replyCode = statusArray[0];

                o.CaptureTXResult = rawResponseString;

                if (replyCode == "1")
                {
                    result = AppLogic.ro_OK;
                }
                else
                {
                    result = statusArray[3];
                }
            }
            catch
            {
                result = "NO RESPONSE FROM GATEWAY!";
            }
            return(result);
        }
Esempio n. 28
0
 private void PuttygenBrowse_Click(object sender, EventArgs e)
 {
     PuttygenPath.Text = CommonLogic.SelectFile(".", "puttygen.exe (puttygen.exe)|puttygen.exe", PuttygenPath.Text);
 }
Esempio n. 29
0
        public override String ProcessCard(int OrderNumber, int CustomerID, Decimal OrderTotal, bool useLiveTransactions, TransactionModeEnum TransactionMode, Address UseBillingAddress, String CardExtraCode, Address UseShippingAddress, String CAVV, String ECI, String XID, out String AVSResult, out String AuthorizationResult, out String AuthorizationCode, out String AuthorizationTransID, out String TransactionCommandOut, out String TransactionResponse)
        {
            String result = AppLogic.ro_OK;

            AuthorizationCode     = String.Empty;
            AuthorizationResult   = String.Empty;
            AuthorizationTransID  = String.Empty;
            AVSResult             = String.Empty;
            TransactionCommandOut = String.Empty;
            TransactionResponse   = String.Empty;

            String X_Login = AppLogic.AppConfig("eProcessingNetwork_X_LOGIN");

            if (X_Login.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_Login = reg.Read("eProcessingNetwork_X_LOGIN");
                reg     = null;
            }

            String X_TranKey = AppLogic.AppConfig("eProcessingNetwork_X_TRAN_KEY");

            if (X_TranKey.Trim().Equals("REGISTRY", StringComparison.InvariantCultureIgnoreCase))
            {
                WindowsRegistry reg = new WindowsRegistry(AppLogic.AppConfig("EncryptKey.RegistryLocation"));
                X_TranKey = reg.Read("eProcessingNetwork_X_TRAN_KEY");
                reg       = null;
            }

            ASCIIEncoding encoding           = new ASCIIEncoding();
            StringBuilder transactionCommand = new StringBuilder(4096);

            transactionCommand.Append("x_type=" + CommonLogic.IIF(TransactionMode == TransactionModeEnum.auth, "AUTH_ONLY", "AUTH_CAPTURE"));

            transactionCommand.Append("&x_login="******"&x_tran_key=" + X_TranKey);
            transactionCommand.Append("&x_version=" + AppLogic.AppConfig("eProcessingNetwork_X_VERSION"));
            transactionCommand.Append("&x_test_request=" + CommonLogic.IIF(useLiveTransactions, "FALSE", "TRUE"));
            transactionCommand.Append("&x_merchant_email=" + Security.UrlEncode(AppLogic.AppConfig("eProcessingNetwork_X_Email")));
            transactionCommand.Append("&x_description=" + Security.UrlEncode(AppLogic.AppConfig("StoreName") + " Order " + OrderNumber.ToString()));

            transactionCommand.Append("&x_method=" + AppLogic.AppConfig("eProcessingNetwork_X_METHOD"));

            transactionCommand.Append("&x_delim_Data=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_DATA"));
            transactionCommand.Append("&x_delim_Char=" + AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR"));
            transactionCommand.Append("&x_encap_char=" + AppLogic.AppConfig("eProcessingNetwork_X_ENCAP_CHAR"));
            transactionCommand.Append("&x_relay_response=" + AppLogic.AppConfig("eProcessingNetwork_X_RELAY_RESPONSE"));

            transactionCommand.Append("&x_email_customer=" + AppLogic.AppConfig("eProcessingNetwork_X_Email_CUSTOMER"));
            transactionCommand.Append("&x_recurring_billing=" + AppLogic.AppConfig("eProcessingNetwork_X_RECURRING_BILLING"));

            transactionCommand.Append("&x_amount=" + Localization.CurrencyStringForGatewayWithoutExchangeRate(OrderTotal));
            transactionCommand.Append("&x_card_num=" + UseBillingAddress.CardNumber);
            if (CardExtraCode.Length != 0)
            {
                transactionCommand.Append("&x_card_code=" + CardExtraCode.Trim());
            }

            transactionCommand.Append("&x_exp_date=" + UseBillingAddress.CardExpirationMonth.PadLeft(2, '0') + "/" + UseBillingAddress.CardExpirationYear);
            transactionCommand.Append("&x_phone=" + Security.UrlEncode(UseBillingAddress.Phone));
            transactionCommand.Append("&x_fax=");
            transactionCommand.Append("&x_customer_tax_id=");
            transactionCommand.Append("&x_cust_id=" + CustomerID.ToString());
            transactionCommand.Append("&x_invoice_num=" + OrderNumber.ToString());
            transactionCommand.Append("&x_email=" + Security.UrlEncode(UseBillingAddress.EMail));
            transactionCommand.Append("&x_customer_ip=" + CommonLogic.CustomerIpAddress());

            transactionCommand.Append("&x_first_name=" + Security.UrlEncode(UseBillingAddress.FirstName));
            transactionCommand.Append("&x_last_name=" + Security.UrlEncode(UseBillingAddress.LastName));
            transactionCommand.Append("&x_company=" + Security.UrlEncode(UseBillingAddress.Company));
            transactionCommand.Append("&x_address=" + Security.UrlEncode(UseBillingAddress.Address1));
            transactionCommand.Append("&x_city=" + Security.UrlEncode(UseBillingAddress.City));
            transactionCommand.Append("&x_state=" + Security.UrlEncode(UseBillingAddress.State));
            transactionCommand.Append("&x_zip=" + Security.UrlEncode(UseBillingAddress.Zip));
            transactionCommand.Append("&x_country=" + Security.UrlEncode(UseBillingAddress.Country));

            if (UseShippingAddress != null)
            {
                transactionCommand.Append("&x_ship_to_first_name=" + Security.UrlEncode(UseShippingAddress.FirstName));
                transactionCommand.Append("&x_ship_to_last_name=" + Security.UrlEncode(UseShippingAddress.LastName));
                transactionCommand.Append("&x_ship_to_company=" + Security.UrlEncode(UseShippingAddress.Company));
                transactionCommand.Append("&x_ship_to_address=" + Security.UrlEncode(UseShippingAddress.Address1));
                transactionCommand.Append("&x_ship_to_city=" + Security.UrlEncode(UseShippingAddress.City));
                transactionCommand.Append("&x_ship_to_state=" + Security.UrlEncode(UseShippingAddress.State));
                transactionCommand.Append("&x_ship_to_zip=" + Security.UrlEncode(UseShippingAddress.Zip));
                transactionCommand.Append("&x_ship_to_country=" + Security.UrlEncode(UseShippingAddress.Country));
            }

            transactionCommand.Append("&x_customer_ip=" + CommonLogic.CustomerIpAddress());

            if (ECI.Length != 0)
            {
                transactionCommand.Append("&x_authentication_indicator=" + ECI);
                transactionCommand.Append("&x_cardholder_authentication_value=" + CAVV);
            }

            byte[] data = encoding.GetBytes(transactionCommand.ToString());

            // Prepare web request...
            try
            {
                String AuthServer        = CommonLogic.IIF(useLiveTransactions, AppLogic.AppConfig("eProcessingNetwork_LIVE_SERVER"), AppLogic.AppConfig("eProcessingNetwork_TEST_SERVER"));
                String rawResponseString = String.Empty;

                int  MaxTries       = AppLogic.AppConfigUSInt("GatewayRetries") + 1;
                int  CurrentTry     = 0;
                bool CallSuccessful = false;
                do
                {
                    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(AuthServer);
                    myRequest.Method        = "POST";
                    myRequest.ContentType   = "application/x-www-form-urlencoded";
                    myRequest.ContentLength = data.Length;
                    Stream newStream = myRequest.GetRequestStream();
                    // Send the data.
                    newStream.Write(data, 0, data.Length);
                    newStream.Close();
                    // get the response
                    WebResponse myResponse;

                    CurrentTry++;
                    try
                    {
                        myResponse = myRequest.GetResponse();
                        using (StreamReader sr = new StreamReader(myResponse.GetResponseStream()))
                        {
                            rawResponseString = sr.ReadToEnd();
                            sr.Close();
                        }
                        myResponse.Close();
                        CallSuccessful = true;
                    }
                    catch
                    {
                        CallSuccessful    = false;
                        rawResponseString = "0|||Error Calling eProcessing Network Payment Gateway||||||||";
                    }
                }while (!CallSuccessful && CurrentTry < MaxTries);


                // rawResponseString now has gateway response
                TransactionResponse = rawResponseString;
                String[] statusArray = rawResponseString.Split(AppLogic.AppConfig("eProcessingNetwork_X_DELIM_CHAR").ToCharArray());
                // this seems to be a new item where auth.net is returing quotes around each parameter, so strip them out:
                for (int i = statusArray.GetLowerBound(0); i <= statusArray.GetUpperBound(0); i++)
                {
                    statusArray[i] = statusArray[i].Trim('\"');
                }

                String sql          = String.Empty;
                String replyCode    = statusArray[0].Replace(":", "");
                String responseCode = statusArray[2];
                String approvalCode = statusArray[4];
                String authResponse = statusArray[3];
                String TransID      = statusArray[6];

                AuthorizationCode     = statusArray[4];
                AuthorizationResult   = rawResponseString;
                AuthorizationTransID  = statusArray[6];
                AVSResult             = statusArray[5];
                TransactionCommandOut = transactionCommand.ToString().Replace(X_TranKey, "*".PadLeft(X_TranKey.Length));

                if (replyCode == "1")
                {
                    result = AppLogic.ro_OK;
                }
                else
                {
                    result = authResponse;
                    if (result.Length == 0)
                    {
                        result = "Unspecified Error";
                    }
                    else
                    {
                        result = result.Replace("account", "card");
                        result = result.Replace("Account", "Card");
                        result = result.Replace("ACCOUNT", "CARD");
                    }
                }
            }
            catch
            {
                result = "Error calling eProcessing Network gateway. Please retry your order in a few minutes or select another checkout payment option.";
            }
            return(result);
        }
Esempio n. 30
0
 private void PageantBrowse_Click(object sender, EventArgs e)
 {
     PageantPath.Text = CommonLogic.SelectFile(".", "pageant.exe (pageant.exe)|pageant.exe", PageantPath.Text);
 }
        public ChecklistSettingsPage(CommonLogic commonLogic,
            CheckSettingsLogic checkSettingsLogic,
            GitModule gitModule,
            ISettingsPageHost settingsPageHost)
        {
            InitializeComponent();
            Translate();

            _commonLogic = commonLogic;
            _checkSettingsLogic = checkSettingsLogic;
            _gitModule = gitModule;
            _settingsPageHost = settingsPageHost;

            Text = "Checklist";
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");


            SalesPromptID = 0;

            if (CommonLogic.QueryStringCanBeDangerousContent("SalesPromptID").Length != 0 && CommonLogic.QueryStringCanBeDangerousContent("SalesPromptID") != "0")
            {
                Editing       = true;
                SalesPromptID = Localization.ParseUSInt(CommonLogic.QueryStringCanBeDangerousContent("SalesPromptID"));
            }
            else
            {
                Editing = false;
            }

            if (CommonLogic.FormBool("IsSubmit"))
            {
                StringBuilder sql = new StringBuilder(2500);
                if (!Editing)
                {
                    // ok to add them:
                    String NewGUID = DB.GetNewGUID();
                    sql.Append("insert into salesprompt(SalesPromptGUID,Name) values(");
                    sql.Append(DB.SQuote(NewGUID) + ",");
                    sql.Append(DB.SQuote(AppLogic.FormLocaleXml("Name")));
                    sql.Append(")");
                    DB.ExecuteSQL(sql.ToString());

                    using (SqlConnection dbconn = DB.dbConn())
                    {
                        dbconn.Open();
                        using (IDataReader rs = DB.GetRS("select SalesPromptID from salesprompt   with (NOLOCK)  where deleted=0 and SalesPromptGUID=" + DB.SQuote(NewGUID), dbconn))
                        {
                            rs.Read();
                            SalesPromptID = DB.RSFieldInt(rs, "SalesPromptID");
                            Editing       = true;
                        }
                    }
                    DataUpdated = true;
                }
                else
                {
                    // ok to update:
                    sql.Append("update salesprompt set ");
                    sql.Append("Name=" + DB.SQuote(AppLogic.FormLocaleXml("Name")));
                    sql.Append(" where SalesPromptID=" + SalesPromptID.ToString());
                    DB.ExecuteSQL(sql.ToString());
                    DataUpdated = true;
                    Editing     = true;
                }
            }
            SectionTitle = "<a href=\"" + AppLogic.AdminLinkUrl("salesprompts.aspx") + "\">" + AppLogic.GetString("admin.menu.SalesPrompts", SkinID, LocaleSetting) + "</a> - " + AppLogic.GetString("admin.editsalesprompt.ManageSalesPrompts", SkinID, LocaleSetting);
            Render();
        }
        private void Render()
        {
            StringBuilder writer = new StringBuilder();

            using (SqlConnection dbconn = DB.dbConn())
            {
                dbconn.Open();
                using (IDataReader rs = DB.GetRS("select * from salesprompt   with (NOLOCK)  where SalesPromptID=" + SalesPromptID.ToString(), dbconn))
                {
                    if (rs.Read())
                    {
                        Editing = true;
                    }

                    if (ErrorMsg.Length != 0)
                    {
                        writer.Append("<p><b><font color=red>" + ErrorMsg + "</font></b></p>\n");
                    }

                    if (DataUpdated)
                    {
                        writer.Append("<p align=\"left\"><b><font color=blue>" + AppLogic.GetString("admin.editCreditCard.Updated", SkinID, LocaleSetting) + "</font></b></p>\n");
                    }



                    if (ErrorMsg.Length == 0)
                    {
                        if (Editing)
                        {
                            writer.Append("<b>" + String.Format(AppLogic.GetString("admin.editsalesprompt.EditingSalesPrompt", SkinID, LocaleSetting), DB.RSFieldByLocale(rs, "Name", LocaleSetting), DB.RSFieldInt(rs, "SalesPromptID").ToString()) + "<br/><br/></b>\n");
                        }
                        else
                        {
                            writer.Append("<div style=\"height:17;padding-top:3px;\" class=\"tablenormal\">" + AppLogic.GetString("admin.editsalesprompt.AddNewSalesPrompt", SkinID, LocaleSetting) + ":</div><br/></b>\n");
                        }

                        writer.Append("<script type=\"text/javascript\">\n");
                        writer.Append("function Form_Validator(theForm)\n");
                        writer.Append("{\n");
                        writer.Append("submitonce(theForm);\n");
                        writer.Append("return (true);\n");
                        writer.Append("}\n");
                        writer.Append("</script>\n");

                        if (AppLogic.NumLocaleSettingsInstalled() > 1)
                        {
                            writer.Append(CommonLogic.ReadFile("jscripts/tabs.js", true));
                        }

                        writer.Append("<p>" + AppLogic.GetString("admin.editsalesprompt.SalesPromptInfo", SkinID, LocaleSetting) + "</p>\n");
                        writer.Append("<form enctype=\"multipart/form-data\" action=\"" + AppLogic.AdminLinkUrl("editSalesPrompt.aspx") + "?SalesPromptID=" + SalesPromptID.ToString() + "&edit=" + Editing.ToString() + "\" method=\"post\" id=\"Form1\" name=\"Form1\" onsubmit=\"return (validateForm(this) && Form_Validator(this))\" onReset=\"return confirm('" + AppLogic.GetString("admin.common.ResetAllFieldsPrompt", SkinID, LocaleSetting) + "');\">\n");
                        writer.Append("<input type=\"hidden\" name=\"IsSubmit\" value=\"true\">\n");
                        writer.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">\n");
                        writer.Append("              <tr valign=\"middle\">\n");
                        writer.Append("                <td width=\"100%\" colspan=\"2\" align=\"left\">\n");
                        writer.Append("                </td>\n");
                        writer.Append("              </tr>\n");
                        writer.Append("              <tr valign=\"middle\">\n");
                        writer.Append("                <td width=\"25%\" align=\"right\" valign=\"middle\">*" + AppLogic.GetString("admin.editsalesprompt.SalesPromptName", SkinID, LocaleSetting) + ":&nbsp;&nbsp;</td>\n");
                        writer.Append("                <td align=\"left\" valign=\"top\">\n");
                        writer.Append(AppLogic.GetLocaleEntryFields(DB.RSField(rs, "Name"), "Name", false, true, true, String.Format(AppLogic.GetString("admin.common.EnterNameParam", SkinID, LocaleSetting), AppLogic.GetString("AppConfig.CategoryPromptSingular", SkinID, LocaleSetting).ToLowerInvariant()), 100, 30, 0, 0, false));

                        writer.Append("                	</td>\n");
                        writer.Append("              </tr>\n");

                        writer.Append("<tr>\n");
                        writer.Append("<td></td><td align=\"left\" valign=\"top\"><br/>\n");
                        if (Editing)
                        {
                            writer.Append("<input type=\"submit\" value=\"" + AppLogic.GetString("admin.common.Update", SkinID, LocaleSetting) + "\" name=\"submit\">\n");
                            writer.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"reset\" class=\"CPButton\" value=\"" + AppLogic.GetString("admin.common.Reset", SkinID, LocaleSetting) + "\" name=\"reset\">\n");
                        }
                        else
                        {
                            writer.Append("<input type=\"submit\" value=\"" + AppLogic.GetString("admin.common.AddNew", SkinID, LocaleSetting) + "\" name=\"submit\">\n");
                        }
                        writer.Append("        </td>\n");
                        writer.Append("      </tr>\n");
                        writer.Append("  </table>\n");
                        writer.Append("</form>\n");
                    }
                }
            }
            ltContent.Text = writer.ToString();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;

            MobileHelper.RedirectPageWhenMobileIsDisabled("~/googletopics.aspx", ThisCustomer);

            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            int    SkinID   = 1; // not sure what to do about this...google can't invoke different skins easily
            String StoreLoc = AppLogic.GetStoreHTTPLocation(false);

            Response.Write("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:mobile=\"http://www.google.com/schemas/sitemap-mobile/1.0\">\n");

            if (AppLogic.AppConfigBool("SiteMap.ShowTopics"))
            {
                // DB Topics:
                using (SqlConnection conn = DB.dbConn())
                {
                    conn.Open();
                    using (IDataReader rs = DB.GetRS(string.Format("select Name from Topic with (NOLOCK) where {0} Deleted=0 and (SkinID IS NULL or SkinID=0 or SkinID={1}) Order By DisplayOrder, Name ASC", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()), conn))
                    {
                        while (rs.Read())
                        {
                            Response.Write("<url>");
                            Response.Write("<loc>" + XmlCommon.XmlEncode(StoreLoc + SE.MakeDriverLink(DB.RSFieldByLocale(rs, "Name", Localization.GetDefaultLocale()))) + "</loc> ");
                            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> ");
                            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> ");
                            Response.Write("<mobile:mobile/></url>\n");
                        }
                    }
                }

                // File Topics:
                // create an array to hold the list of files
                ArrayList fArray = new ArrayList();

                // get information about our initial directory
                String SFP = CommonLogic.SafeMapPath(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "~/App_Templates/Skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", "");

                DirectoryInfo dirInfo = new DirectoryInfo(SFP);

                // retrieve array of files & subdirectories
                FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos();

                for (int i = 0; i < myDir.Length; i++)
                {
                    // check the file attributes

                    // if a subdirectory, add it to the sArray
                    // otherwise, add it to the fArray
                    if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0))
                    {
                    }
                    else
                    {
                        bool skipit = false;
                        if (!myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) || (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) || (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1))
                        {
                            skipit = true;
                        }
                        if (!skipit)
                        {
                            fArray.Add(Path.GetFileName(myDir[i].FullName));
                        }
                    }
                }

                if (fArray.Count != 0)
                {
                    // sort the files alphabetically
                    fArray.Sort(0, fArray.Count, null);
                    for (int i = 0; i < fArray.Count; i++)
                    {
                        Response.Write("<url>");
                        Response.Write("<loc>" + StoreLoc + SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", "")) + "</loc> ");
                        Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.TopicChangeFreq") + "</changefreq> ");
                        Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.TopicPriority") + "</priority> ");
                        Response.Write("</url>");
                    }
                }
            }

            Response.Write("</urlset>");
        }
 public ChecklistSettingsPage(CommonLogic commonLogic,
     CheckSettingsLogic checkSettingsLogic,
     GitModule gitModule,
     ISettingsPageHost settingsPageHost)
     : this()
 {
     _commonLogic = commonLogic;
     _checkSettingsLogic = checkSettingsLogic;
     _gitModule = gitModule;
     _settingsPageHost = settingsPageHost;
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = -1;
            Response.AddHeader("pragma", "no-cache");
            ErrorMessage err;

            if (AppLogic.AppConfigBool("RequireOver13Checked") && !ThisCustomer.IsOver13)
            {
                err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("checkout.over13required", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)));
                Response.Redirect("shoppingcart.aspx?errormsg=" + err.MessageId);
            }

            RequireSecurePage();

            // -----------------------------------------------------------------------------------------------
            // NOTE ON PAGE LOAD LOGIC:
            // We are checking here for required elements to allowing the customer to stay on this page.
            // Many of these checks may be redundant, and they DO add a bit of overhead in terms of db calls, but ANYTHING really
            // could have changed since the customer was on the last page. Remember, the web is completely stateless. Assume this
            // page was executed by ANYONE at ANYTIME (even someone trying to break the cart).
            // It could have been yesterday, or 1 second ago, and other customers could have purchased limitied inventory products,
            // coupons may no longer be valid, etc, etc, etc...
            // -----------------------------------------------------------------------------------------------
            ThisCustomer.RequireCustomerRecord();

            if (!ThisCustomer.IsRegistered)
            {
                bool boolAllowAnon = (AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") && !cart.HasRecurringComponents());
                if (!boolAllowAnon && ThisCustomer.PrimaryBillingAddressID > 0)
                {
                    Address BillingAddress = new Address();
                    BillingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing);
                    if (BillingAddress.PaymentMethodLastUsed == AppLogic.ro_PMPayPalExpress || BillingAddress.PaymentMethodLastUsed == AppLogic.ro_PMPayPalExpressMark)
                    {
                        boolAllowAnon = AppLogic.AppConfigBool("PayPal.Express.AllowAnonCheckout");
                    }
                }

                if (!boolAllowAnon)
                {
                    Response.Redirect("createaccount.aspx?checkout=true");
                }
            }
            if (ThisCustomer.PrimaryBillingAddressID == 0 || ThisCustomer.PrimaryShippingAddressID == 0)
            {
                err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("checkoutpayment.aspx.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)));
                Response.Redirect("shoppingcart.aspx?resetlinkback=1&errormsg=" + err.MessageId);
            }

            SectionTitle = AppLogic.GetString("checkoutshippingmult2.aspx.1", SkinID, ThisCustomer.LocaleSetting);
            cart         = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false);

            cart.ValidProceedCheckout(); // will not come back from this if any issue. they are sent back to the cart page!

            if (cart.IsAllDownloadComponents() || !Shipping.MultiShipEnabled() || cart.TotalQuantity() > AppLogic.MultiShipMaxNumItemsAllowed() || !cart.CartAllowsShippingMethodSelection)
            {
                // not allowed here:
                err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("checkoutshippingmult2.aspx.12", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)));
                Response.Redirect("shoppingcart.aspx?resetlinkback=1&errormsg=" + err.MessageId);
            }

            CartItem FirstCartItem            = (CartItem)cart.CartItems[0];
            Address  FirstItemShippingAddress = new Address();

            FirstItemShippingAddress.LoadByCustomer(ThisCustomer.CustomerID, FirstCartItem.ShippingAddressID, AddressTypes.Shipping);
            if (FirstItemShippingAddress.AddressID == 0)
            {
                // not allowed here anymore!
                err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("checkoutshippingmult2.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)));
                Response.Redirect("shoppingcart.aspx?errormsg=" + err.MessageId);
            }


            if (!IsPostBack && CommonLogic.FormCanBeDangerousContent("update") == "" && CommonLogic.FormCanBeDangerousContent("continue") == "")
            {
                UpdatepageContent();
            }

            if (CommonLogic.FormCanBeDangerousContent("update") != "" || CommonLogic.FormCanBeDangerousContent("continue") != "")
            {
                ProcessCart();
            }
            JSPopupRoutines.Text = AppLogic.GetJSPopupRoutines();
        }