Beispiel #1
0
        DebugRealTimeShippingViewModel BuildModel(Customer customer)
        {
            var requestInfo  = new StringBuilder();
            var responseInfo = new StringBuilder();

            using (var connection = new SqlConnection(DB.GetDBConn()))
            {
                connection.Open();
                using (var rs = DB.GetRS(
                           "Select RTShipRequest, RTShipResponse from customer  with (NOLOCK)  where CustomerID = @CustomerId",
                           new[] { new SqlParameter("CustomerId", customer.CustomerID) },
                           connection))
                {
                    if (rs.Read())
                    {
                        requestInfo.Append("<DebugRealTimeShippingRequest>");
                        requestInfo.Append(DB.RSField(rs, "RTShipRequest"));
                        requestInfo.Append("</DebugRealTimeShippingRequest>");

                        responseInfo.Append("<DebugRealTimeShippingResponse>");
                        responseInfo.Append(DB.RSField(rs, "RTShipResponse"));
                        responseInfo.Append("</DebugRealTimeShippingResponse>");
                    }
                }
            }

            return(new DebugRealTimeShippingViewModel
            {
                RequestInfo = XmlCommon.PrettyPrintXml(ReplaceAccountInfo(requestInfo.ToString())),
                ResponseInfo = XmlCommon.PrettyPrintXml(ReplaceAccountInfo(responseInfo.ToString()))
            });
        }
Beispiel #2
0
        static public String MobileFormLocaleXml(string sqlName, string formValue, string locale, string currentDBValue)
        {
            if (AppLogic.NumLocaleSettingsInstalled() < 2)
            {
                return(formValue);
            }

            StringBuilder tmpS = new StringBuilder(4096);

            tmpS.Append("<ml>");
            XmlNodeList nl = Localization.LocalesDoc.SelectNodes("//Locales");

            foreach (XmlNode xn in nl)
            {
                String thisLocale  = xn.Attributes["Name"].InnerText;
                string localeEntry = XmlCommon.GetLocaleEntry(currentDBValue, thisLocale, false);
                if (HasLocaleEntry(currentDBValue, thisLocale) || thisLocale.Equals(locale, StringComparison.InvariantCultureIgnoreCase)) // only include already existing locales and the locale currently being set
                {
                    if (thisLocale.Equals(locale, StringComparison.InvariantCultureIgnoreCase))
                    {
                        tmpS.Append("<locale name=\"" + thisLocale + "\">");
                        tmpS.Append(XmlCommon.XmlEncode(formValue));
                        tmpS.Append("</locale>");
                    }
                    else
                    {
                        tmpS.Append("<locale name=\"" + thisLocale + "\">");
                        tmpS.Append(XmlCommon.XmlEncode(localeEntry));
                        tmpS.Append("</locale>");
                    }
                }
            }
            tmpS.Append("</ml>");
            return(tmpS.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// 获得坐席服务一周中那几天
        /// </summary>
        /// <returns>周中的1,2,3,4,5....</returns>
        /// Author:fredjiang
        /// Created:2016-02-23
        public static List <int> GetCustomerServiceWeekDay()
        {
            XmlCommon xc       = new XmlCommon();
            string    nodeName = "root/customerService/serviceTime/weekDay";

            return(xc.GetIntListByNodeName(nodeName));
        }
Beispiel #4
0
        public static Dictionary <string, string> GetReportDesc()
        {
            XmlCommon xc       = new XmlCommon();
            string    nodeName = "root/Report/Item";

            return(xc.GetNodes(nodeName));
        }
Beispiel #5
0
        /// <summary>
        /// 坐席服务一天中的结束时间点
        /// </summary>
        /// <returns>时间:分</returns>
        /// Author:fredjiang
        /// Created:2016-02-23
        public static List <string> GetCustomerServiceEndTime()
        {
            XmlCommon xc       = new XmlCommon();
            string    nodeName = "root/customerService/serviceTime/dayTime/endTime";

            return(xc.GetNodesText(nodeName));
        }
Beispiel #6
0
        /// <summary>
        /// 从配置文件获得粉丝空闲等待时间
        /// </summary>
        /// <returns></returns>
        /// Author:fredjiang
        /// Created:2016-02-23
        public static int GetCustomerServiceWaitingTime()
        {
            XmlCommon xc       = new XmlCommon();
            string    nodeName = "root/customerService/waitingTime";

            return(xc.GetXmlNodeToInt(nodeName));
        }
Beispiel #7
0
        public override void DataBind()
        {
            if (TopicID > 0)
            {
                Topic t = new Topic(TopicID, ThisCustomer.LocaleSetting);

                ltName.Text     = XmlCommon.GetLocaleEntry(t.TopicName, pageLocale, true);
                txtDspOrdr.Text = t.DisplayOrder.ToString();
                ltTitle.Text    = t.SectionTitle;

                //if (bUseHtmlEditor)
                //{
                //radDescription.Content = XmlCommon.GetLocaleEntry(t.Contents, pageLocale, true); //AppLogic.FormLocaleXml(t.Contents, ThisCustomer.LocaleSetting);
                //}
                //else
                //{
                ltDescription.Text  = "<div id=\"idDescription\" style=\"height: 1%;\">";
                ltDescription.Text += "<textarea rows=\"" + AppLogic.AppConfigUSInt("Admin_TextareaHeight") + "\" cols=\"" + AppLogic.AppConfigUSInt("Admin_TextareaWidth") + "\" id=\"Description\" name=\"Description\">";
                ltDescription.Text  = XmlCommon.GetLocaleEntry(t.Contents, pageLocale, true);
                ltDescription.Text += "</textarea>\n";
                ltDescription.Text += "</div>";

                //}

                rbDisclaimer.SelectedValue = CommonLogic.IIF(t.RequiresDisclaimer, "1", "0");
                rbPublish.SelectedValue    = CommonLogic.IIF(t.ShowInSiteMap, "1", "0");
                ltSEKeywords.Text          = t.SEKeywords;
                ltSEDescription.Text       = t.SEDescription;
                ltSETitle.Text             = t.SETitle;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 获得目录查询消息分类1级编号
        /// </summary>
        /// <returns>目录查询分类编号</returns>
        /// Author:fredjiang
        /// Created:2016-02-17
        public static int GetDirectoryQueryClassifyId()
        {
            XmlCommon xc       = new XmlCommon();
            string    nodeName = "root/messageInfo/messageClassifyDirectoryId";

            return(xc.GetXmlNodeToInt(nodeName));
        }
Beispiel #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(EntityName);
            int EntityID = CommonLogic.QueryStringUSInt("EntityID");

            EntityHelper eHlp = AppLogic.LookupHelper(EntityName, AppLogic.StoreID());

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

            Response.Write("<url>");
            Response.Write("<loc>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</loc> ");
            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.EntityPriority") + "</priority> ");
            Response.Write("<mobile:mobile/></url>\n");

            Response.Write(GetMobileEntityGoogleObjectList(EntityDefinitions.LookupSpecs(EntityName), EntityID, Localization.GetDefaultLocale(), 0, 0));

            Response.Write("</urlset>");
        }
Beispiel #10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(EntityName);
            int EntityID = CommonLogic.QueryStringUSInt("EntityID");

            EntityHelper eHlp = AppLogic.LookupHelper(EntityName, 0);

            Response.Write("<urlset xmlns=\"" + AppLogic.AppConfig("GoogleSiteMap.Xmlns") + "\">\n");

            Response.Write("<url>");
            Response.Write("<loc>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</loc> ");
            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.EntityPriority") + "</priority> ");
            Response.Write("</url>\n");

            Response.Write(GoogleSiteMap.GetGoogleEntityProductURLNodes(EntityName, EntityID));

            Response.Write("</urlset>");
        }
Beispiel #11
0
        /// <summary>
        /// Renders the item.
        /// </summary>
        /// <param name="currentNode">The current node.</param>
        /// <param name="writer">The writer.</param>
        /// <param name="IsChild">if set to <c>true</c> [is child].</param>
        private void RenderItem(ProductMappingLinkItem currentNode, HtmlTextWriter writer, bool IsChild)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            if (IsChild)
            {
                int j = 0;
                while (j < i)
                {
                    writer.Write("&nbsp;&nbsp;");
                    j++;
                }
                writer.Write("<span class=\"catMark\">" + this.Bullet + "</span>");
                writer.Write("&nbsp;&nbsp;");
            }
            HyperLink lnk = new HyperLink();

            lnk.Text        = XmlCommon.GetLocaleEntry(currentNode.Name, Customer.Current.LocaleSetting, false);
            lnk.NavigateUrl = currentNode.Url;
            if (currentNode.Selected)
            {
                lnk.Style.Add("font-weight", "bold");
            }
            lnk.RenderControl(writer);

            if (currentNode.ChildItems.Count > 0)
            {
                i++;
                RenderList(currentNode.ChildItems, writer, true, this.EntityType);
                i--;
            }

            writer.RenderEndTag();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            Response.Write("<rss version=\"2.0\" xmlns:ror=\"http://rorweb.com/0.1/\">");
            Response.Write("<channel>");
            Response.Write("<title>Products</title>");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(EntityName);
            int EntityID = CommonLogic.QueryStringUSInt("EntityID");

            EntityHelper eHlp = AppLogic.LookupHelper(EntityName, 0);

            Response.Write("<item>");
            Response.Write("<ror:type>Products</ror:type>");
            Response.Write("<link>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</link> ");
            Response.Write("</item>");

            Response.Write(eHlp.GetEntityRorObjectList(EntityID, Localization.GetDefaultLocale(), 0, 0));

            Response.Write("</channel>");
            Response.Write("</rss>");
        }
Beispiel #13
0
        public static Boolean HasLocaleEntry(String S, String LocaleSetting)
        {
            String WebConfigLocale = Localization.GetDefaultLocale();

            if (LocaleSetting.Equals(Localization.GetDefaultLocale(), StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }
            if (S.Length == 0)
            {
                return(false);
            }
            if (S.StartsWith("&lt;ml&gt;", StringComparison.InvariantCultureIgnoreCase))
            {
                S = XmlCommon.XmlDecode(S);
            }
            if (!S.StartsWith("<ml>", StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            if (S.IndexOf("<locale name=\"" + LocaleSetting + "\">") != -1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #14
0
        public override String RecurringBillingGetStatusFile()
        {
            StringBuilder tmpS = new StringBuilder(4096);

            // just find any AutoBill recurring orders due to day, and return a random status (APPROVED, DECLINED)
            tmpS.Append("<RecurringBillingReport Gateway=\"MANUAL\">");
            tmpS.Append("\n");
            using (SqlConnection conn = DB.dbConn())
            {
                conn.Open();
                using (IDataReader rs = DB.GetRS("select * from ShoppingCart  with (NOLOCK)  where RecurringSubscriptionID<>'' and NextRecurringShipDate<=" + DB.SQuote(Localization.DateStringForDB(System.DateTime.Now)), conn))
                {
                    while (rs.Read())
                    {
                        String ThisStatus = "APPROVED";
                        String Msg        = String.Empty;
                        if (CommonLogic.GetRandomNumber(1, 10) < 3)
                        {
                            // decline some randomly
                            ThisStatus = "DECLINED";
                            Msg        = "Random Decline";
                        }
                        tmpS.Append(String.Format("<TX RecurringSubscriptionID=\"{0}\" Status=\"{1}\" Message=\"{2}\"/>\n", DB.RSField(rs, "RecurringSubscriptionID"), ThisStatus, XmlCommon.XmlEncodeAttribute(Msg)));
                    }
                }
            }
            tmpS.Append("</RecurringBillingReport>");
            return(XmlCommon.PrettyPrintXml(tmpS.ToString()));
        }
        List <Models.SiteMapEntity> AddEntities(XmlNodeList nodes, Customer customer, string entityType)
        {
            var entities = new List <Models.SiteMapEntity>();

            foreach (XmlNode node in nodes)
            {
                var id = Convert.ToInt32(
                    node
                    .SelectSingleNode("EntityID")
                    .InnerText);

                var localizedName = XmlCommon.GetLocaleEntry(
                    node.SelectSingleNode("Name").InnerXml,
                    customer.LocaleSetting,
                    fallBack: true);

                var seName = node.SelectSingleNode("SEName").InnerText;

                var entity = new Models.SiteMapEntity()
                {
                    Name = localizedName,
                    Url  = Url.BuildEntityLink(
                        entityType,
                        id,
                        seName)
                };

                entity.Children = AddEntities(node.SelectNodes("Entity"), customer, entityType);
                entities.Add(entity);
            }

            return(entities);
        }
Beispiel #16
0
    /// <summary>
    /// Check if order is free shipping and customer selects free shipping methods
    /// </summary>
    /// <param name="nav">xml</param>
    private void CheckIfFreeShipping(XPathNavigator nav)
    {
        XmlNode orderInfoNode = GetXmlNode(nav.SelectSingleNode("Order/OrderInfo"));

        bool freeShipping = false;

        if ((CheckIfCouponApplied(orderInfoNode) || CheckIfLevelHasFreeShipping(orderInfoNode)) || (CheckIfAllDownloads(orderInfoNode) || CheckIfAllFreeShipping(orderInfoNode) || CheckIfAllSystemProducts(orderInfoNode)))
        {
            freeShipping = true;
        }

        bool customerChoseFreeShippingMethod = true;

        if (AppLogic.AppConfigBool("FreeShippingAllowsRateSelection"))
        {
            int    shippingMethodId  = XmlCommon.XmlFieldNativeInt(orderInfoNode, "ShippingMethodID");
            string commaSeparatedIds = AppLogic.AppConfig("ShippingMethodIDIfFreeShippingIsOn");

            customerChoseFreeShippingMethod = CommonLogic.IntegerIsInIntegerList(shippingMethodId, commaSeparatedIds);
        }

        freeShipping = freeShipping && customerChoseFreeShippingMethod;

        XmlNode isFreeShippingNode = orderInfoNode.OwnerDocument.CreateNode(XmlNodeType.Element, "IsFreeShipping", string.Empty);

        isFreeShippingNode.InnerText = XmlCommon.XmlEncode(freeShipping.ToString());
        orderInfoNode.InsertAfter(isFreeShippingNode, orderInfoNode.LastChild);
    }
Beispiel #17
0
    /// <summary>
    /// Attaches an element named ShippingNotRequired that serves as a flag whether our order does not require shipping checking all the available factors
    /// </summary>
    /// <param name="nav">The XPathNavigator</param>
    private void CheckIfWeShouldRequireShipping(XPathNavigator nav)
    {
        XmlNode orderInfoNode         = GetXmlNode(nav.SelectSingleNode("Order/OrderInfo"));
        bool    weDontRequireShipping = false;

        if (AppLogic.AppConfigBool("SkipShippingOnCheckout") == true)
        {
            weDontRequireShipping = true;
        }
        else
        {
            bool isMultiShipping        = XmlCommon.XmlFieldBool(orderInfoNode, "multiship");
            bool allAreDownloadProducts = XmlCommon.XmlFieldBool(orderInfoNode, "allDownloads");
            bool allAreSystemProducts   = XmlCommon.XmlFieldBool(orderInfoNode, "allSystemproducts");

            weDontRequireShipping = isMultiShipping == false &&
                                    (allAreDownloadProducts || allAreSystemProducts);

            if (weDontRequireShipping == false)
            {
                // now check if all of the line items is No Shipping Required..
                XPathNodeIterator lineItemsThatAreNotFreeShippingIfAnyNodeIterator = nav.Select("OrderItems/Item[FreeShipping != 2]");
                weDontRequireShipping = !lineItemsThatAreNotFreeShippingIfAnyNodeIterator.MoveNext();
            }
        }

        XmlNode shippingNotRequiredNode = orderInfoNode.OwnerDocument.CreateNode(XmlNodeType.Element, "ShippingNotRequired", string.Empty);

        shippingNotRequiredNode.InnerText = XmlCommon.XmlEncode(weDontRequireShipping.ToString());
        orderInfoNode.InsertAfter(shippingNotRequiredNode, orderInfoNode.LastChild);
    }
Beispiel #18
0
    /// <summary>
    /// Check in orderInfoNode if a coupon is applied
    /// </summary>
    /// <param name="orderInfoNode"></param>
    /// <returns>returns true if there is a couponcode and coupon includes free shipping</returns>
    private bool CheckIfCouponApplied(XmlNode orderInfoNode)
    {
        bool hasCouponApplied           = CommonLogic.IIF(!CommonLogic.IsStringNullOrEmpty(XmlCommon.XmlField(orderInfoNode, "CouponCode")), true, false);
        bool couponIncludesFreeshipping = CommonLogic.IIF(XmlCommon.XmlFieldNativeInt(orderInfoNode, "CouponIncludesFreeShipping") == 1, true, false);

        return(hasCouponApplied && couponIncludesFreeshipping);
    }
Beispiel #19
0
    /// <summary>
    /// Check if customer level includes free shipping
    /// </summary>
    /// <param name="orderInfoNode"></param>
    /// <returns>returns true if customer level includes free shipping</returns>
    private bool CheckIfLevelHasFreeShipping(XmlNode orderInfoNode)
    {
        bool hascustomerLevel     = CommonLogic.IIF(XmlCommon.XmlFieldNativeInt(orderInfoNode, "LevelID") != 0, true, false);
        bool levelHasFreeShipping = CommonLogic.IIF(XmlCommon.XmlFieldNativeInt(orderInfoNode, "LevelHasFreeShipping") == 1, true, false);

        return(hascustomerLevel && levelHasFreeShipping);
    }
        protected bool validateForm()
        {
            bool   valid = true;
            string temp  = "";

            ltValid.Text = "";

            if ((string.IsNullOrEmpty(TopicName) || (AppLogic.FormLocaleXml(TopicName, LocaleSetting).Equals("<ml></ml>"))))
            {
                valid = false;
                temp += AppLogic.GetString("admin.common.FillOutNamePrompt", LocaleSetting);
            }
            else if ((string.IsNullOrEmpty(ltTitle.Text) || (AppLogic.FormLocaleXml(ltTitle.Text, LocaleSetting).Equals("<ml></ml>"))))
            {
                valid = false;
                temp += AppLogic.GetString("admin.common.TopicPageTitlePrompt", LocaleSetting);
            }
            if (!valid)
            {
                TopicName    = XmlCommon.GetLocaleEntry(AppLogic.FormLocaleXml(TopicName, LocaleSetting), LocaleSetting, true);
                ltTitle.Text = XmlCommon.GetLocaleEntry(AppLogic.FormLocaleXml(ltTitle.Text, LocaleSetting), LocaleSetting, true);
                ltValid.Text = string.Format("<script type=\"text/javascript\">alert('{0}');</script>", temp);
            }
            return(valid);
        }
Beispiel #21
0
        /// <summary>
        /// Gets the customer level name, returns string empty if no valid customer level name exists
        /// </summary>
        /// <param name="levelId"></param>
        /// <returns></returns>
        protected string DisplayLevelName(int?levelId)
        {
            string customerLevelName = null;

            if (levelId != null)
            {
                var sql = "SELECT Name FROM CustomerLevel WHERE CustomerLevelID = @CustomerLevelID";

                using (var connection = new SqlConnection(DB.GetDBConn()))
                {
                    connection.Open();

                    using (var command = new SqlCommand(sql, connection))
                    {
                        command.Parameters.Add(new SqlParameter("CustomerLevelID", levelId));

                        var response = command.ExecuteScalar();
                        if (!(response is DBNull) && (response != null))
                        {
                            customerLevelName = (string)response;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(customerLevelName))
            {
                return(XmlCommon.GetLocaleEntry(customerLevelName, ThisCustomer.LocaleSetting, false));
            }
            else
            {
                return(string.Empty);
            }
        }
Beispiel #22
0
        public ActionResult Entity()
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            var entityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(entityName);
            int entityID = CommonLogic.QueryStringUSInt("EntityID");

            var enityHelper = AppLogic.LookupHelper(entityName, 0);

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

            Response.Write("<url>");

            var entityUrl          = Url.BuildEntityLink(entityName, entityID, string.Empty);
            var storeLocation      = new Uri(AppLogic.GetStoreHTTPLocation(false));
            var fullEntityLocation = new Uri(storeLocation, entityUrl);

            Response.Write(string.Format("<loc>{0}</loc>", XmlCommon.XmlEncode(fullEntityLocation.ToString())));
            Response.Write("<changefreq>" + AppLogic.AppConfig("SiteMapFeed.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("SiteMapFeed.EntityPriority") + "</priority> ");
            Response.Write("</url>\n");

            var siteMap = new StandardSiteMap(Url, Settings, SiteMapEntityHelper, NestedSiteMapEntityHelper);

            Response.Write(siteMap.GetEntityProductURLNodes(entityName, entityID));

            Response.Write("</urlset>");
            return(new EmptyResult());
        }
Beispiel #23
0
        public void GetProducts()
        {
            var retCmd = GetProductsCommand();
            var xList  = new List <SiteMapProduct>();

            if (Settings.ProductFiltering)
            {
                retCmd.Parameters["@StoreID"].Value = AppLogic.StoreID();
            }

            Action <System.Data.IDataReader> readEntities = rd =>
            {
                while (rd.Read())
                {
                    var prd = new SiteMapProduct(Url, SiteMapEntityHelper);
                    prd.EntityID = rd.FieldInt("ProductID");
                    prd.Name     = XmlCommon.GetLocaleEntry(rd.Field("Name"), Customer.Current.LocaleSetting, false);
                    prd.SEName   = rd.Field("SEName");
                    xList.Add(prd);
                }
            };

            DB.UseDataReader(retCmd, readEntities);
            Products = xList.ToArray();
        }
Beispiel #24
0
        public NestedSiteMapEntity[] GetEntities(string EntityType)
        {
            var _list = new Dictionary <int, NestedSiteMapEntity>();

            var getCommand = GetEntitySQL(EntityType);
            Action <System.Data.IDataReader> readEntities = rd =>
            {
                while (rd.Read())
                {
                    var entity = new NestedSiteMapEntity(Url, SiteMapEntityHelper, Settings)
                    {
                        EntityID       = rd.FieldInt("ID"),
                        Name           = XmlCommon.GetLocaleEntry(rd.Field("Name"), Customer.Current.LocaleSetting, false),
                        SEName         = rd.Field("SEName"),
                        ParentEntityID = rd.FieldInt("ParentID"),
                        EntityType     = EntityType,
                    };

                    entity.GetProducts();
                    _list.Add(entity.EntityID, entity);
                }
            };

            DB.UseDataReader(getCommand, readEntities);

            return(OrganizeEntities(_list).ToArray());
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            if (EntityName.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1)
            {
                throw new ArgumentException("SECURITY EXCEPTION");
            }
            String EntityID = CommonLogic.QueryStringCanBeDangerousContent("EntityID");

            EntityHelper eHlp = new EntityHelper(EntityDefinitions.LookupSpecs(EntityName));

            Response.Write("<urlset xmlns=\"" + AppLogic.AppConfig("GoogleSiteMap.Xmlns") + "\">");

            Response.Write("<url>");
            Response.Write("<loc>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</loc> ");
            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.EntityPriority") + "</priority> ");
            Response.Write("</url>");

            Response.Write(eHlp.GetEntityGoogleObjectList(EntityID, Localization.WebConfigLocale, String.Empty, String.Empty));

            Response.Write("</urlset>");
        }
Beispiel #26
0
        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 = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;

            writer.Append("<div style=\"margin-left: 10px;\">");
            if (!ThisCustomer.IsAdminUser)
            {
                writer.Append("<b><font color=red>" + AppLogic.GetString("admin.common.PermissionDeniedUC", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</b></font>");
            }
            else
            {
                using (SqlConnection conn = DB.dbConn())
                {
                    conn.Open();
                    using (IDataReader rs = DB.GetRS("Select * from orders   with (NOLOCK)  where ordernumber=" + CommonLogic.QueryStringUSInt("OrderNumber").ToString(), conn))
                    {
                        if (rs.Read())
                        {
                            String r1   = DB.RSField(rs, "RTShipRequest");
                            String r2   = DB.RSField(rs, "RTShipResponse");
                            String rqst = String.Empty;
                            try
                            {
                                rqst = XmlCommon.PrettyPrintXml(r1);
                            }
                            catch
                            {
                                rqst = r1;
                            }
                            String resp = String.Empty;
                            try
                            {
                                resp = XmlCommon.PrettyPrintXml(r2);
                            }
                            catch
                            {
                                resp = r2;
                            }
                            writer.Append("<b>" + AppLogic.GetString("admin.popuprt.RTShippingRequest", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + " </b><br/><br/><textarea rows=\"20\" style=\"width: 90%\">" + Server.HtmlEncode(r1) + "</textarea><br/><br/>");
                            writer.Append("<b>" + AppLogic.GetString("admin.popuprt.RTShippingResponse", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + " </b><br/><br/><textarea rows=\"35\" style=\"width: 90%\">" + Server.HtmlEncode(r2) + "</textarea><br/><br/>");
                        }
                        else
                        {
                            writer.Append("<b><font color=red>" + AppLogic.GetString("admin.common.OrderNotFoundUC", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</b></font>");
                        }
                        rs.Close();
                    }
                }
            }

            writer.Append("</div>");
            ltContent.Text = writer.ToString();
        }
Beispiel #27
0
        private void BindFileGrid()
        {
            var appPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            var htmlExtensions = new[] { ".html", ".htm" };

            // Skin specific first
            var skinFileTopics = SkinProvider
                                 .GetSkins()
                                 .Select(skin => new
            {
                SkinId      = skin.Id,
                TopicPath   = Path.Combine(appPath, string.Format("Skins\\{0}\\Topics", skin.Name)),
                DisplayName = string.IsNullOrEmpty(skin.DisplayName)
                                                        ? skin.Id.ToString()
                                                        : skin.DisplayName
            })
                                 .Where(o => Directory.Exists(o.TopicPath))
                                 .SelectMany(o => Directory
                                             .GetFiles(o.TopicPath)
                                             .Where(path => htmlExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase))
                                             .Select(path => Path.GetFileNameWithoutExtension(path))
                                             .OrderBy(filename => filename)
                                             .Select(filename => new FileBasedTopic
            {
                Name     = filename,
                Location = string.Format("Skin: {0}", o.DisplayName),
                Link     = Url.BuildTopicLink(
                    name: XmlCommon.GetLocaleEntry(filename, ThisCustomer.LocaleSetting, true),
                    additionalRouteValues: new Dictionary <string, object>
                {
                    { "skinId", o.SkinId }
                })
            }));

            // Root folder next
            var rootFileTopics = Enumerable.Empty <FileBasedTopic>();
            var rootPath       = Path.Combine(appPath, string.Format("Topics\\"));

            if (Directory.Exists(rootPath))
            {
                rootFileTopics = Directory
                                 .GetFiles(rootPath)
                                 .Where(path => htmlExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase))
                                 .Select(path => Path.GetFileNameWithoutExtension(path))
                                 .OrderBy(filename => filename)
                                 .Select(filename => new FileBasedTopic
                {
                    Name     = filename,
                    Location = "Root",
                    Link     = Url.BuildTopicLink(XmlCommon.GetLocaleEntry(filename, ThisCustomer.LocaleSetting, true))
                });
            }

            grdFileTopics.DataSource = skinFileTopics
                                       .Concat(rootFileTopics)
                                       .ToArray();
            grdFileTopics.DataBind();
        }
Beispiel #28
0
        public String LocalizeName(String topicName)
        {
            if (ThisCustomer == null)
            {
                ThisCustomer = AppLogic.GetCurrentCustomer();
            }

            return(XmlCommon.GetLocaleEntry(topicName, ThisCustomer.LocaleSetting, true));
        }
Beispiel #29
0
        private string StringResourceMatch(Match match)
        {
            String l = match.Groups[1].Value;
            string s = HttpUtility.HtmlEncode(AppLogic.GetString(l, DEFAULT_SKINID, ThisCustomer.LocaleSetting));

            if (s == null || s.Length == 0 || s == l)
            {
                s = match.Value;
            }
            return(XmlCommon.XmlEncode(s));
        }
Beispiel #30
0
        protected string ML_Localize(string text)
        {
            String locale = "en-us";

            if (ThisCustomer != null && String.IsNullOrEmpty(ThisCustomer.LocaleSetting))
            {
                locale = ThisCustomer.LocaleSetting;
            }

            return(XmlCommon.GetLocaleEntry(text, locale, false));
        }