Пример #1
0
 /// <summary>
 /// Get all the countires from country.xml or country_storealias.xml
 /// If not found a fallback list will be used
 /// </summary>
 /// <returns></returns>
 public static List <Country> GetAllCountries()
 {
     return(StoreHelper.GetAllCountries(StoreHelper.CurrentStoreAlias));
 }
Пример #2
0
 private void btnEditVote_Click(object sender, EventArgs e)
 {
     if (StoreHelper.GetVoteCounts(this.voteId) > 0)
     {
         this.ShowMsg("投票已经开始,不能再对投票选项进行任何操作", false);
     }
     else
     {
         VoteInfo voteById = StoreHelper.GetVoteById(this.voteId);
         if (this.calendarStartDate.SelectedDate.Value.CompareTo(this.calendarEndDate.SelectedDate.Value) >= 0)
         {
             this.ShowMsg("开始时间不能晚于结束时间!", false);
         }
         else
         {
             string uploadedImageUrl = this.uploader1.UploadedImageUrl;
             if (string.IsNullOrEmpty(uploadedImageUrl))
             {
                 this.ShowMsg("请上传封面图片", false);
             }
             else
             {
                 voteById.ImageUrl = uploadedImageUrl;
                 voteById.VoteName = Globals.HtmlEncode(this.txtAddVoteName.Text.Trim());
                 int result = 1;
                 if (int.TryParse(this.txtMaxCheck.Text.Trim(), out result))
                 {
                     voteById.MaxCheck = result;
                 }
                 voteById.StartDate = this.calendarStartDate.SelectedDate.Value;
                 voteById.EndDate   = this.calendarEndDate.SelectedDate.Value;
                 IList <VoteItemInfo> list = null;
                 if (!string.IsNullOrEmpty(this.txtValues.Text.Trim()))
                 {
                     list = new List <VoteItemInfo>();
                     string[] strArray = this.txtValues.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' });
                     for (int i = 0; i < strArray.Length; i++)
                     {
                         VoteItemInfo item = new VoteItemInfo();
                         if (strArray[i].Length > 60)
                         {
                             this.ShowMsg("投票选项长度限制在60个字符以内", false);
                             return;
                         }
                         item.VoteItemName = Globals.HtmlEncode(strArray[i]);
                         list.Add(item);
                     }
                 }
                 else
                 {
                     this.ShowMsg("投票选项不能为空", false);
                     return;
                 }
                 voteById.VoteItems = list;
                 if (this.ValidationVote(voteById))
                 {
                     if (StoreHelper.UpdateVote(voteById))
                     {
                         if (base.Request.QueryString["reurl"] != null)
                         {
                             this.ReUrl = base.Request.QueryString["reurl"].ToString();
                         }
                         this.ShowMsgAndReUrl("修改投票成功", true, this.ReUrl);
                     }
                     else
                     {
                         this.ShowMsg("修改投票失败", false);
                     }
                 }
             }
         }
     }
 }
        void btnMakePayment_Click(object sender, EventArgs e)
        {
            PayPalExpressGateway gateway
                = new PayPalExpressGateway(
                      commerceConfig.PayPalAPIUsername,
                      commerceConfig.PayPalAPIPassword,
                      commerceConfig.PayPalAPISignature,
                      commerceConfig.PayPalStandardEmailAddress);

            gateway.UseTestMode   = commerceConfig.PaymentGatewayUseTestMode;
            gateway.PayPalToken   = checkoutDetailsLog.Token;
            gateway.PayPalPayerId = checkoutDetailsLog.PayerId;

            gateway.MerchantCartId = cart.CartGuid.ToString();
            gateway.ChargeTotal    = cart.OrderTotal;
            gateway.ReturnUrl      = SiteRoot + "/Services/PayPalReturnHandler.ashx";
            gateway.CancelUrl      = SiteUtils.GetCurrentPageUrl();
            gateway.CurrencyCode   = siteSettings.GetCurrency().Code;

            // **** here's where the payment is requested ******
            bool executed = gateway.CallDoExpressCheckoutPayment();

            PayPalLog payPalLog = new PayPalLog();

            payPalLog.RequestType      = "DoExpressCheckoutPayment";
            payPalLog.ProviderName     = WebStorePayPalReturnHandler.ProviderName;
            payPalLog.SerializedObject = checkoutDetailsLog.SerializedObject;
            payPalLog.ReturnUrl        = checkoutDetailsLog.ReturnUrl;
            payPalLog.RawResponse      = gateway.RawResponse;

            payPalLog.TransactionId = gateway.TransactionId;
            payPalLog.PaymentType   = gateway.PayPalPaymentType;
            payPalLog.PaymentStatus = gateway.PayPalPaymentStatus;
            payPalLog.PendingReason = gateway.PayPalPendingReason;
            payPalLog.ReasonCode    = gateway.ReasonCode;
            payPalLog.PayPalAmt     = gateway.ChargeTotal;
            payPalLog.FeeAmt        = gateway.PayPalFeeAmount;
            payPalLog.SettleAmt     = gateway.PayPalSettlementAmount;
            payPalLog.TaxAmt        = gateway.PayPalTaxTotal;

            payPalLog.Token        = gateway.PayPalToken;
            payPalLog.PayerId      = gateway.PayPalPayerId;
            payPalLog.RequestType  = "DoExpressCheckoutPayment";
            payPalLog.SiteGuid     = store.SiteGuid;
            payPalLog.StoreGuid    = store.Guid;
            payPalLog.CartGuid     = cart.CartGuid;
            payPalLog.UserGuid     = cart.UserGuid;
            payPalLog.CartTotal    = cart.OrderTotal;
            payPalLog.CurrencyCode = gateway.CurrencyCode;

            if (gateway.PayPalExchangeRate.Length > 0)
            {
                payPalLog.ExchangeRate = decimal.Parse(gateway.PayPalExchangeRate);
            }


            payPalLog.Save();

            if (!executed)
            {
                lblMessage.Text = WebStoreResources.TransactionNotInitiatedMessage;

                if (gateway.LastExecutionException != null)
                {
                    log.Error("ExpressCheckout gateway error", gateway.LastExecutionException);

                    if (commerceConfig.PaymentGatewayUseTestMode)
                    {
                        lblMessage.Text = gateway.LastExecutionException.ToString();
                    }
                }
                else
                {
                    if (commerceConfig.PaymentGatewayUseTestMode)
                    {
                        lblMessage.Text = gateway.RawResponse;
                    }
                }

                return;
            }

            string redirectUrl = string.Empty;

            if (gateway.TransactionId.Length == 0)
            {
                // TODO: redirect where?
                redirectUrl = SiteRoot + "/WebStore/PayPalGatewayError.aspx?plog=" + payPalLog.RowGuid.ToString();
                Response.Redirect(redirectUrl);
            }


            Guid orderStatusGuid;

            if (payPalLog.PaymentStatus == "Completed")
            {
                orderStatusGuid = OrderStatus.OrderStatusFulfillableGuid;
            }
            else
            {
                orderStatusGuid = OrderStatus.OrderStatusReceivedGuid;
            }


            Order order = Order.CreateOrder(
                store,
                cart,
                payPalLog.RawResponse,
                payPalLog.TransactionId,
                string.Empty,
                siteSettings.GetCurrency().Code,
                "PayPal",
                orderStatusGuid);

            StoreHelper.ClearCartCookie(cart.StoreGuid);


            // send confirmation email
            // paypal sends an order confirmation so no need

            // redirect to order details
            redirectUrl = SiteRoot +
                          "/WebStore/OrderDetail.aspx?pageid="
                          + PageId.ToString(CultureInfo.InvariantCulture)
                          + "&mid=" + store.ModuleId.ToString(CultureInfo.InvariantCulture)
                          + "&orderid=" + order.OrderGuid.ToString();

            Response.Redirect(redirectUrl);
        }
Пример #4
0
 /// <summary>
 /// 提供模板, 数据文件, 编码格式, 提取数据的正则表达式生成脚本.
 /// </summary>
 /// <param name="template">模板文本.</param>
 /// <param name="dataRegex">提取数据的正则表达式.</param>
 /// <param name="dataFilePath">数据文件路径.</param>
 /// <param name="dataFileEncoding">数据文件编码.</param>
 /// <returns>脚本.</returns>
 public static string Build(string template, Regex dataRegex, string dataFilePath, Encoding dataFileEncoding)
 {
     return(Build(template, StoreHelper.Read(dataFilePath, dataFileEncoding), dataRegex));
 }
Пример #5
0
 private void BindFriendlyLinks()
 {
     System.Collections.Generic.IList <FriendlyLinksInfo> friendlyLinks = StoreHelper.GetFriendlyLinks();
     this.grdGroupList.DataSource = friendlyLinks;
     this.grdGroupList.DataBind();
 }
Пример #6
0
 public static string GetMultiStoreItemExamine(string propertyAlias, SearchResult examineNode, string storeAlias = null, string currencyCode = null)
 {
     if (examineNode != null)
     {
         propertyAlias = StoreHelper.MakeRTEItemPropertyAliasIfApplicable(propertyAlias);
         return(StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(propertyAlias, StoreHelper.GetLocalizationOrCurrent(storeAlias, currencyCode), new DictionaryPropertyProvider(examineNode)));
     }
     return(string.Empty);
 }
Пример #7
0
 /// <summary>
 /// 提供模板, 数据文件, 编码格式, 提取数据的正则表达式生成脚本并输出到文件.
 /// </summary>
 /// <param name="template">模板文本.</param>
 /// <param name="dataRegex">提取数据的正则表达式.</param>
 /// <param name="dataFilePath">数据文件路径.</param>
 /// <param name="dataFileEncoding">数据文件编码.</param>
 /// <param name="outputFilePath">输出文件路径.</param>
 /// <param name="outputFileEncoding">输出文件编码.</param>
 public static void BuildToFile(string template, Regex dataRegex, string dataFilePath, Encoding dataFileEncoding, string outputFilePath, Encoding outputFileEncoding)
 {
     BuildToFile(template, StoreHelper.Read(dataFilePath, dataFileEncoding), dataRegex, outputFilePath, outputFileEncoding);
 }
Пример #8
0
 /// <summary>
 /// </summary>
 /// <returns>
 /// The current store
 /// </returns>
 public static Store GetCurrentStore()
 {
     return(StoreHelper.GetCurrentStore());
 }
Пример #9
0
        protected void Restore()
        {
            TplCfgInfo tplCfgById = VShopHelper.GetImgCfgById(this.id);

            this.txtBannerDesc.Text    = tplCfgById.ShortDesc;
            this.ddlType.SelectedValue = tplCfgById.LocationType.ToString();
            this.littlepic.Src         = tplCfgById.ImageUrl;
            this.fmSrc.Value           = tplCfgById.ImageUrl;
            switch (tplCfgById.LocationType)
            {
            //case LocationType.Topic:
            //{
            //    this.ddlSubType.Attributes.CssStyle.Remove("display");
            //    System.Collections.Generic.IList<TopicInfo> topics = VShopHelper.Gettopics();
            //    if (topics != null && topics.Count > 0)
            //    {
            //        this.ddlSubType.DataSource = topics;
            //        this.ddlSubType.DataTextField = "title";
            //        this.ddlSubType.DataValueField = "TopicId";
            //        this.ddlSubType.DataBind();
            //        this.ddlSubType.SelectedValue = tplCfgById.Url;
            //    }
            //    break;
            //}
            case LocationType.Vote:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                System.Collections.Generic.IList <VoteInfo> voteList = StoreHelper.GetVoteList();
                if (voteList != null && voteList.Count > 0)
                {
                    this.ddlSubType.DataSource     = voteList;
                    this.ddlSubType.DataTextField  = "VoteName";
                    this.ddlSubType.DataValueField = "VoteId";
                    this.ddlSubType.DataBind();
                    this.ddlSubType.SelectedValue = tplCfgById.Url;
                }
                break;
            }

            case LocationType.Activity:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.BindEnum <LotteryActivityType>("");
                this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0];
                this.ddlThridType.Attributes.CssStyle.Remove("display");
                LotteryActivityType type = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[0]);
                if (type != LotteryActivityType.SignUp)
                {
                    this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(type);
                }
                else
                {
                    this.ddlThridType.DataSource =
                        from item in VShopHelper.GetAllActivity()
                        select new
                    {
                        ActivityId   = item.ActivityId,
                        ActivityName = item.Name
                    };
                }
                this.ddlThridType.DataTextField  = "ActivityName";
                this.ddlThridType.DataValueField = "Activityid";
                this.ddlThridType.DataBind();
                this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[]
                    {
                        ','
                    })[1];
                break;
            }

            case LocationType.Link:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                break;

            case LocationType.Phone:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                break;

            case LocationType.Address:
                this.Tburl.Attributes.CssStyle.Remove("display");
                this.navigateDesc.Attributes.CssStyle.Remove("display");
                this.Tburl.Text = tplCfgById.Url;
                break;
            }
        }
Пример #10
0
 public static List <Category> GetCategoriesRecursive(int categoryId, string storeAlias = null)
 {
     return(StoreHelper.GetCategoriesRecursive(categoryId, storeAlias));
 }
Пример #11
0
 /// <summary>
 /// Returns all the categories in this category, including any sublevel
 /// </summary>
 /// <param name="categoryId">The category unique identifier.</param>
 /// <param name="storeAlias">The store alias.</param>
 /// <returns>
 /// All subcategories, independent of level of the given categoryId
 /// </returns>
 public static IEnumerable <ICategory> CategoriesRecursive(int categoryId, string storeAlias = null)
 {
     return(StoreHelper.GetCategoriesRecursive(categoryId, storeAlias));
 }
Пример #12
0
 /// <summary>
 /// Get a list of all stores
 /// </summary>
 /// <returns></returns>
 public static List <Store> GetAllStores()
 {
     return(StoreHelper.GetAllStores().ToList());
 }
Пример #13
0
 /// <summary>
 /// Returns all the products with prices for the given store or current store
 /// </summary>
 /// <param name="storeAlias">The store alias.</param>
 /// <param name="currencyCode">The currency code.</param>
 /// <returns></returns>
 public static IEnumerable <IProduct> AllProducts(string storeAlias = null, string currencyCode = null)
 {
     return(IO.Container.Resolve <IProductService>().GetAll(StoreHelper.GetLocalizationOrCurrent(storeAlias, currencyCode)));
 }
Пример #14
0
        /// <summary>
        /// Returns the full country name from the given countrycode
        /// </summary>
        /// <param name="countryCode">The country code.</param>
        /// <returns></returns>
        public static string CountryNameFromCode(string countryCode)
        {
            var country = StoreHelper.GetAllCountries().FirstOrDefault(x => x.Code == countryCode);

            return(country != null ? country.Name : string.Empty);
        }
Пример #15
0
        protected void Restore()
        {
            TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id);

            this.txtNavigateDesc.Text  = tplCfgById.ShortDesc;
            this.ddlType.SelectedValue = tplCfgById.LocationType.ToString();
            if (!tplCfgById.ImageUrl.ToLower().Contains("storage/master/navigate"))
            {
                this.iconpath = tplCfgById.ImageUrl;
            }
            this.littlepic.Src = tplCfgById.ImageUrl;
            this.fmSrc.Value   = tplCfgById.ImageUrl;
            switch (tplCfgById.LocationType)
            {
            case LocationType.Vote:
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.DataSource     = StoreHelper.GetVoteList();
                this.ddlSubType.DataTextField  = "VoteName";
                this.ddlSubType.DataValueField = "VoteId";
                this.ddlSubType.DataBind();
                this.ddlSubType.SelectedValue = tplCfgById.Url;
                return;

            case LocationType.Activity:
            {
                this.ddlSubType.Attributes.CssStyle.Remove("display");
                this.ddlSubType.BindEnum <LotteryActivityType>("");
                this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[0];
                this.ddlThridType.Attributes.CssStyle.Remove("display");
                LotteryActivityType type = (LotteryActivityType)Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[] { ',' })[0]);
                if (type != LotteryActivityType.SignUp)
                {
                    this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(type);
                    break;
                }
                this.ddlThridType.DataSource = from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name };
                break;
            }

            case LocationType.Home:
            case LocationType.Category:
            case LocationType.ShoppingCart:
            case LocationType.OrderCenter:
            case (LocationType.OrderCenter | LocationType.Vote):
                return;

            case LocationType.Link:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case LocationType.Phone:
                this.Tburl.Text = tplCfgById.Url;
                this.Tburl.Attributes.CssStyle.Remove("display");
                return;

            case LocationType.Address:
                this.Tburl.Attributes.CssStyle.Remove("display");
                this.navigateDesc.Attributes.CssStyle.Remove("display");
                this.Tburl.Text = tplCfgById.Url;
                return;

            default:
                return;
            }
            this.ddlThridType.DataTextField  = "ActivityName";
            this.ddlThridType.DataValueField = "Activityid";
            this.ddlThridType.DataBind();
            this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[1];
        }
Пример #16
0
 private void BindData()
 {
     this.grdHotKeywords.DataSource = StoreHelper.GetHotKeywords(ClientType.PC);
     this.grdHotKeywords.DataBind();
 }
Пример #17
0
        public void ProcessRequest(HttpContext context)
        {
            string str  = context.Request.Form["actionName"];
            string s    = string.Empty;
            string str4 = str;

            if (str4 != null)
            {
                if (!(str4 == "Topic"))
                {
                    if (str4 == "Vote")
                    {
                        s = JsonConvert.SerializeObject(StoreHelper.GetVoteList());
                    }
                    else if (str4 == "Category")
                    {
                        s = JsonConvert.SerializeObject(from item in CatalogHelper.GetMainCategories() select new { CateId = item.CategoryId, CateName = item.Name });
                    }
                    else if (str4 == "Activity")
                    {
                        Array           values = Enum.GetValues(typeof(LotteryActivityType));
                        List <EnumJson> list3  = new List <EnumJson>();
                        foreach (Enum enum2 in values)
                        {
                            EnumJson json = new EnumJson {
                                Name  = enum2.ToShowText(),
                                Value = enum2.ToString()
                            };
                            list3.Add(json);
                        }
                        s = JsonConvert.SerializeObject(list3);
                    }
                    else if (str4 == "ActivityList")
                    {
                        string str3 = context.Request.Form["acttype"];
                        LotteryActivityType type = (LotteryActivityType)Enum.Parse(typeof(LotteryActivityType), str3);
                        if (type == LotteryActivityType.SignUp)
                        {
                            s = JsonConvert.SerializeObject(from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name });
                        }
                        else
                        {
                            s = JsonConvert.SerializeObject(VShopHelper.GetLotteryActivityByType(type));
                        }
                    }
                    else if (str4 == "AccountTime")
                    {
                        s = s + "{";
                        BalanceDrawRequestQuery entity = new BalanceDrawRequestQuery {
                            RequestTime      = "",
                            CheckTime        = "",
                            StoreName        = "",
                            PageIndex        = 1,
                            PageSize         = 1,
                            SortOrder        = SortAction.Desc,
                            SortBy           = "RequestTime",
                            RequestEndTime   = "",
                            RequestStartTime = "",
                            IsCheck          = "1",
                            UserId           = context.Request.Form["UserID"]
                        };
                        Globals.EntityCoding(entity, true);
                        DataTable data = (DataTable)DistributorsBrower.GetBalanceDrawRequest(entity).Data;
                        if (data.Rows.Count > 0)
                        {
                            if (data.Rows[0]["MerchantCode"].ToString().Trim() != context.Request.Form["merchantcode"].Trim())
                            {
                                s = s + "\"Time\":\"" + data.Rows[0]["RequestTime"].ToString() + "\"";
                            }
                            else
                            {
                                s = s + "\"Time\":\"\"";
                            }
                        }
                        else
                        {
                            s = s + "\"Time\":\"\"";
                        }
                        s = s + "}";
                    }
                }
                else
                {
                    s = JsonConvert.SerializeObject(VShopHelper.Gettopics());
                }
            }
            context.Response.Write(s);
        }
Пример #18
0
        private void btnEditHotkeyword_Click(object sender, System.EventArgs e)
        {
            int hid = System.Convert.ToInt32(this.txtHid.Value);

            if (string.IsNullOrEmpty(this.txtEditHotKeyword.Text.Trim()) || this.txtEditHotKeyword.Text.Trim().Length > 60)
            {
                this.ShowMsg("热门关键字不能为空,长度限制在60个字符以内", false);
                return;
            }
            //if (!this.dropEditCategory.SelectedValue.HasValue)
            //{
            //    this.ShowMsg("请选择商品主分类", false);
            //    return;
            //}
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9_一-龥-]+$");
            if (!regex.IsMatch(this.txtEditHotKeyword.Text.Trim()))
            {
                this.ShowMsg("热门关键字只能输入汉字,数字,英文,下划线,减号,不能以下划线、减号开头或结尾", false);
                return;
            }
            //if (string.Compare(this.txtEditHotKeyword.Text.Trim(), this.hiHotKeyword.Value) != 0 && this.IsSame(this.txtEditHotKeyword.Text.Trim(), System.Convert.ToInt32(this.dropEditCategory.SelectedValue.Value)))
            //{
            //    this.ShowMsg("存在相同的的关键字,编辑失败", false);
            //    return;
            //}
            //if (((string.Compare(this.dropEditCategory.SelectedValue.Value.ToString(), this.hicategory.Value) == 0 & string.Compare(this.txtEditHotKeyword.Text, this.hiHotKeyword.Value) != 0) && this.IsSame(this.txtEditHotKeyword.Text.Trim(), System.Convert.ToInt32(this.dropEditCategory.SelectedValue.Value))) || (string.Compare(this.txtEditHotKeyword.Text.Trim(), this.hiHotKeyword.Value) == 0 && string.Compare(this.dropEditCategory.SelectedValue.Value.ToString(), this.hicategory.Value) != 0 && this.IsSame(this.txtEditHotKeyword.Text.Trim(), System.Convert.ToInt32(this.dropEditCategory.SelectedValue.Value))))
            //{
            //    this.ShowMsg("同一分类型不允许存在相同的关键字,编辑失败", false);
            //    return;
            //}

            if (this.dropEditCategory.SelectedValue.HasValue)
            {
                if (string.Compare(this.txtEditHotKeyword.Text.Trim(), this.hiHotKeyword.Value) == 0 && string.Compare(this.dropEditCategory.SelectedValue.Value.ToString(), this.hicategory.Value) == 0)
                {
                    return;
                }
                if (this.IsSame(this.txtEditHotKeyword.Text.Trim(), System.Convert.ToInt32(this.dropEditCategory.SelectedValue.Value)))
                {
                    this.ShowMsg("同一分类型不允许存在相同的关键字,编辑失败", false);
                    return;
                }
                StoreHelper.UpdateHotWords(hid, this.dropEditCategory.SelectedValue.Value, this.txtEditHotKeyword.Text.Trim(), HiContext.Current.User.UserId);
                this.ShowMsg("编辑热门关键字成功!", true);
                this.hicategory.Value   = "";
                this.hiHotKeyword.Value = "";
                this.BindData();
            }
            else
            {
                if (string.Compare(this.txtEditHotKeyword.Text.Trim(), this.hiHotKeyword.Value) == 0 && string.Compare("", this.hicategory.Value) == 0)
                {
                    return;
                }

                if (this.IsSame(this.txtEditHotKeyword.Text.Trim(), null))
                {
                    this.ShowMsg("同一分类型不允许存在相同的关键字,编辑失败", false);
                    return;
                }

                StoreHelper.UpdateHotWords(hid, null, this.txtEditHotKeyword.Text.Trim(), HiContext.Current.User.UserId);
                this.ShowMsg("编辑热门关键字成功!", true);
                this.hicategory.Value   = "";
                this.hiHotKeyword.Value = "";
                this.BindData();
            }
        }
Пример #19
0
        private void btnSaveInfo_Click(object sender, System.EventArgs e)
        {
            if (storeId <= 0 || string.IsNullOrEmpty(orderId))
            {
                this.CloseWindow();
            }
            bool flag = false;

            foreach (RepeaterItem rs in SelectedDeliveryUsers.Items)
            {
                System.Web.UI.HtmlControls.HtmlInputCheckBox chb = ((System.Web.UI.HtmlControls.HtmlInputCheckBox)rs.FindControl("chkboxDeliveryUserId"));
                if (chb.Checked)
                {
                    string            deliveryUserId = chb.Value;
                    DeliveryOrderInfo info           = new DeliveryOrderInfo {
                        OrderId        = this.orderId,
                        DeliveryUserId = deliveryUserId.ToInt(),
                        AddTime        = DateTime.Now,
                        State          = 1,
                        StoreId        = this.storeId,
                    };
                    if (StoreHelper.SetDeliveryUser(info))
                    {
                        flag = true;
                        break;
                    }
                }
            }

            if (flag)
            {
                this.ShowMsg("配送员分配成功!", true);
                this.CloseWindow();
            }

            /*
             * System.Data.DataTable dt = new System.Data.DataTable();
             * dt.Columns.Add("ProductId");
             * dt.Columns.Add("ProductName");
             * dt.Columns.Add("ProductCode");
             * dt.Columns.Add("MarketPrice");
             * if (this.grdSelectedProducts.Rows.Count > 0)
             * {
             *  decimal result = 0m;
             *  foreach (System.Web.UI.WebControls.GridViewRow row in this.grdSelectedProducts.Rows)
             *  {
             *      int num = (int)this.grdSelectedProducts.DataKeys[row.RowIndex].Value;
             *      System.Web.UI.WebControls.TextBox box = row.FindControl("txtProductName") as System.Web.UI.WebControls.TextBox;
             *      System.Web.UI.WebControls.TextBox box2 = row.FindControl("txtProductCode") as System.Web.UI.WebControls.TextBox;
             *      System.Web.UI.WebControls.TextBox box3 = row.FindControl("txtMarketPrice") as System.Web.UI.WebControls.TextBox;
             *      if (!string.IsNullOrEmpty(box3.Text.Trim()) && !decimal.TryParse(box3.Text.Trim(), out result))
             *      {
             *          break;
             *      }
             *      if (string.IsNullOrEmpty(box3.Text.Trim()))
             *      {
             *          result = 0m;
             *      }
             *      System.Data.DataRow row2 = dt.NewRow();
             *      row2["ProductId"] = num;
             *      row2["ProductName"] = Globals.HtmlEncode(box.Text.Trim());
             *      row2["ProductCode"] = Globals.HtmlEncode(box2.Text.Trim());
             *      if (result >= 0m)
             *      {
             *          row2["MarketPrice"] = result;
             *      }
             *      dt.Rows.Add(row2);
             *  }
             *  if (ProductHelper.UpdateProductBaseInfo(dt))
             *  {
             *      this.CloseWindow();
             *  }
             *  else
             *  {
             *      this.ShowMsg("批量修改商品信息失败", false);
             *  }
             *  this.BindProduct();
             * }
             */
        }
Пример #20
0
 public override void DidEnterBackground(UIApplication application)
 {
     Analytics.SharedTracker.Dispatch();
     StoreHelper.Save();
 }
Пример #21
0
 /// <summary>
 /// 提供模板, 数据, 编码格式, 提取数据的正则表达式生成脚本并输出到文件.
 /// </summary>
 /// <param name="template">模板文本.</param>
 /// <param name="data">数据文本.</param>
 /// <param name="dataRegex">提取数据的正则表达式.</param>
 /// <param name="outputFilePath">输出文件路径.</param>
 /// <param name="outputFileEncoding">输出文件编码.</param>
 public static void BuildToFile(string template, string data, Regex dataRegex, string outputFilePath, Encoding outputFileEncoding)
 {
     StoreHelper.Write(outputFilePath, Build(template, data, dataRegex), outputFileEncoding);
 }
Пример #22
0
 public override void WillTerminate(UIApplication application)
 {
     StoreHelper.Save();
     Analytics.SharedTracker.StopTracker();
 }
Пример #23
0
 private void BindBackupData()
 {
     this.grdBackupFiles.DataSource = StoreHelper.GetBackupFiles();
     this.grdBackupFiles.DataBind();
 }
Пример #24
0
    /// <summary>
    /// Creates the child controls tree.
    /// </summary>
    private void CreateChildControlsTree()
    {
        if (!String.IsNullOrEmpty(Code))
        {
            System.Web.UI.Control ctrl = null;

            string id = "Template" + this.ID;
            ctrl = ProductInfoHolder.FindControl(id);
            if (ctrl == null)
            {
                CatalogEntryDto dto         = CatalogContext.Current.GetCatalogEntryDto(Code);
                string          templateUrl = GetTemplateUrl(dto.CatalogEntry[0].TemplateName);

                if (String.IsNullOrEmpty(templateUrl))
                {
                    throw new System.NullReferenceException(String.Format("CatalogEntry \"{0}\" does not have display template specified.", Code));
                }

                try
                {
                    ctrl = this.LoadControl(templateUrl.ToString());

                    if (ctrl is IContextUserControl)
                    {
                        IDictionary dic = new ListDictionary();
                        dic.Add("Code", Code);
                        dic.Add("NodeCode", NodeCode);
                        dic.Add("CatalogName", CatalogName);
                        ((IContextUserControl)ctrl).LoadContext(dic);
                    }
                }
                catch (HttpException ex)
                {
                    if (ex.GetHttpCode() == 404)
                    {
                        throw new System.IO.FileNotFoundException("Template not found", ex);
                    }
                    else
                    {
                        throw;
                    }
                }

                this.ProductInfoHolder.Controls.Add(ctrl);

                Session["LastCatalogPageUrl"] = CMSContext.Current.CurrentUrl;

                StoreHelper.AddBrowseHistory("Entries", Code);

                //Profile.LastCatalogPageUrl = CMSContext.Current.CurrentUrl;

                /*
                 * // Record history
                 * StringCollection historyDic = (StringCollection)Profile["EntryHistory"];
                 *
                 * // Check if the code already exists
                 * if (historyDic.Contains(Code))
                 * {
                 *  historyDic.RemoveAt(historyDic.IndexOf(Code));
                 * }
                 *
                 * // Only keep history of last 5 items visited
                 * if (historyDic.Count >= 5)
                 *  historyDic.RemoveAt(0);
                 *
                 * historyDic.Add(Code);
                 *
                 * // set value
                 * Profile["EntryHistory"] = historyDic;
                 * */
            }
        }
    }
Пример #25
0
        public override void LoadDataFromPropertiesDictionary(PaymentProvider entity, IPropertyProvider fields, ILocalization localization)
        {
            var store = _storeService.GetByAlias(localization.StoreAlias);

            entity.Localization = localization;

            entity.Title       = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.title, localization, fields) ?? string.Empty;
            entity.Description = IO.Container.Resolve <ICMSApplication>().ParseInternalLinks(StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.description, localization, fields)) ?? string.Empty;

            var testMode = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.testMode, localization, fields);

            if (testMode == "default" || testMode == string.Empty)
            {
                entity.TestMode = store.EnableTestmode;
            }
            else
            {
                entity.TestMode = testMode == "enable" || testMode == "1" || testMode == "true";
            }

            entity.ImageId = StoreHelper.GetMultiStoreIntValue(_aliasses.image, localization, fields);

            var values = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.zone, localization, fields);

            if (values.Any())
            {
                entity.Zones =
                    DomainHelper.ParseIntegersFromUwebshopProperty(values)
                    .Select(x => _zoneService.GetByIdOrFallbackZone(x, localization))
                    .ToList();
            }
            else
            {
                entity.Zones = _zoneService.GetFallBackZone(localization);
            }

            entity.Disabled = StoreHelper.GetMultiStoreDisableExamine(localization, fields);

            var paymentProviderAmountType = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.type, localization, fields);
            PaymentProviderType type;

            entity.Type = Enum.TryParse(paymentProviderAmountType, out type) ? type : PaymentProviderType.Unknown;

            var dllName = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary("dllName", localization, fields);

            if (!string.IsNullOrEmpty(dllName))
            {
                entity.DLLName = !dllName.EndsWith(".dll") ? string.Format("{0}.dll", dllName) : dllName;
            }

            entity.ControlNodeId = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary("controlNode", localization, fields);
            entity.SuccesNodeId  = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.successNode, localization, fields);
            entity.ErrorNodeId   = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.errorNode, localization, fields);
            entity.CancelNodeId  = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.cancelNode, localization, fields);
        }
Пример #26
0
 private void BindVote()
 {
     this.dlstVote.DataSource = StoreHelper.GetVotes();
     this.dlstVote.DataBind();
 }
Пример #27
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["voteId"], out this.voteId))
            {
                base.GotoResourceNotFound("");
            }
            //设置微信流量其中标头
            VoteInfo voteById = StoreHelper.GetVoteById(this.voteId);

            if (voteById != null && voteById.VoteId > 0)
            {
                PageTitle.AddSiteNameTitle(voteById.VoteName + "结果");
            }

            this.litVoteResult = (Literal)this.FindControl("litVoteResult");
            System.Text.StringBuilder builder = new System.Text.StringBuilder();

            //加载配置模块
            string selectSql = string.Format("Select * From Yihui_Votes_Model Where VoteId={0} order by ModelSN;", voteId);

            selectSql += string.Format("Select * From YiHui_HomePage_Model where PageID in (select VMID from Yihui_Votes_Model where VoteId = {0});", voteId);
            selectSql += string.Format("Select * From YIHui_Votes_Model_Detail where VMID in (select VMID from Yihui_Votes_Model where VoteId = {0}) order by VMID,Scode;", voteId);
            selectSql += string.Format("Select * From YiHui_Votes_Model_Result where VoteId = {0}", voteId);
            DataSet ds = DataBaseHelper.GetDataSet(selectSql);

            DataTable dtvm        = ds.Tables[0];
            DataTable dthpm_Model = ds.Tables[1];
            DataTable dtvm_detail = ds.Tables[2];
            DataTable dtvm_Result = ds.Tables[3];

            int i = 0;

            foreach (DataRow dr in dtvm.Rows)
            {
                if (dr["ModelCode"].ToString() == "XuanXiang")
                {
                    i++;
                    DataRow[] drs = dthpm_Model.Select(string.Format("PageID = '{0}'", dr["VMID"].ToString()), "", DataViewRowState.CurrentRows);
                    if (drs.Length > 0)
                    {
                        string[] strValues = drs[0]["PMContents"].ToString().Split('♦');
                        if (strValues.Length == 3)
                        {
                            builder.AppendFormat("<div id='vote-result{0}' i='{0}' class='vote-result'>", i);
                            builder.Append("<div class='vote-result-con'>");
                            builder.AppendFormat("<div class='vote-result-con-title'><h3>{0}</h3><h4>{1}</h4></div>", strValues[0], strValues[1]);
                            builder.Append("<ul>");
                            DataRow[] drsdetail = dtvm_detail.Select(string.Format("VMID = '{0}'", dr["VMID"].ToString()), "Scode", DataViewRowState.CurrentRows);
                            foreach (DataRow drxm in drsdetail)
                            {
                                DataRow[] drSumResult = dtvm_Result.Select(string.Format("PMID = '{0}'", drs[0]["PMID"].ToString()), "", DataViewRowState.CurrentRows);//当前投票项参与总人数
                                DataRow[] drResult    = dtvm_Result.Select(string.Format("PMID = '{0}' and Result like '%{1},%'", drs[0]["PMID"].ToString(), drxm["Value"].ToString()), "", DataViewRowState.CurrentRows);
                                string    strBl       = "0%";
                                if (drSumResult.Length > 0)
                                {
                                    double dbBl = Convert.ToDouble(drResult.Length) / Convert.ToDouble(drSumResult.Length);
                                    strBl = string.Format("{0:0.00%}", dbBl);
                                }
                                builder.AppendFormat("<li n='{0}'>{1}<div class='progress'><p style='width:{4}'></p><span style='left:{4}'>{4}</span></div></li>", drxm["Scode"].ToString(), drxm["Name"].ToString(), drResult.Length, drSumResult.Length, strBl);
                            }
                            builder.Append("</ul>");
                            builder.Append("</div>");
                            builder.Append("</div>");
                        }
                    }
                }
            }
            this.litVoteResult.Text = builder.ToString();
        }
Пример #28
0
 protected void btnCreateValue_Click(object sender, EventArgs e)
 {
     AttributeValueInfo attributeValue = new AttributeValueInfo();
     IList<AttributeValueInfo> list = new List<AttributeValueInfo>();
     int num = int.Parse(this.currentAttributeId.Value);
     attributeValue.AttributeId = num;
     if (!(this.Page.Request.QueryString["action"].ToString().Trim() == "add"))
     {
         this.valueId = int.Parse(this.Page.Request.QueryString["valueId"]);
         attributeValue = ProductTypeHelper.GetAttributeValueInfo(this.valueId);
         if (ProductTypeHelper.GetAttribute(attributeValue.AttributeId).UseAttributeImage)
         {
             if (!string.IsNullOrEmpty(this.txtValueDec.Text))
             {
                 attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
             }
         }
         else if (!string.IsNullOrEmpty(this.txtValueStr.Text))
         {
             attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueStr.Text);
         }
         if (this.fileUpload.HasFile)
         {
             try
             {
                 StoreHelper.DeleteImage(attributeValue.ImageUrl);
                 attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
             }
             catch
             {
             }
         }
         if (ProductTypeHelper.UpdateSku(attributeValue))
         {
             this.CloseWindow();
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(this.txtValueStr.Text.Trim()))
         {
             string[] strArray = this.txtValueStr.Text.Trim().Split(new char[] { ',' });
             for (int i = 0; i < strArray.Length; i++)
             {
                 if (strArray[i].Trim().Length > 100)
                 {
                     break;
                 }
                 AttributeValueInfo item = new AttributeValueInfo();
                 if (strArray[i].Trim().Length > 15)
                 {
                     this.ShowMsg("属性值限制在15个字符以内", false);
                     return;
                 }
                 item.ValueStr = Globals.HtmlEncode(strArray[i].Trim());
                 item.AttributeId = num;
                 list.Add(item);
             }
             foreach (AttributeValueInfo info3 in list)
             {
                 ProductTypeHelper.AddAttributeValue(info3);
             }
             this.CloseWindow();
         }
         if (this.fileUpload.HasFile)
         {
             try
             {
                 attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                 attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
             }
             catch
             {
             }
             if (ProductTypeHelper.AddAttributeValue(attributeValue) > 0)
             {
                 this.CloseWindow();
             }
         }
         else
         {
             this.ShowMsg("属性值限制在15个字符以内", false);
         }
     }
 }
        private void LoadSettings()
        {
            PageId   = WebUtils.ParseInt32FromQueryString("pageid", -1);
            ModuleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            payPalGetExpressCheckoutLogGuid = WebUtils.ParseGuidFromQueryString("plog", payPalGetExpressCheckoutLogGuid);

            if (payPalGetExpressCheckoutLogGuid == Guid.Empty)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }

            checkoutDetailsLog = new PayPalLog(payPalGetExpressCheckoutLogGuid);

            if (checkoutDetailsLog.RowGuid == Guid.Empty)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }

            cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), checkoutDetailsLog.SerializedObject);

            if (cart == null)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }
            cart.DeSerializeCartOffers();

            cart.RefreshTotals();


            if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0))
            {
                StoreHelper.EnsureValidDiscounts(store, cart);
            }


            siteUser = SiteUtils.GetCurrentSiteUser();
            //if (siteUser == null)
            //{
            //    Response.Redirect(SiteUtils.GetCurrentPageUrl());
            //}

            if ((siteUser != null) && (cart.UserGuid == Guid.Empty))
            {
                // user wasn't logged in when express checkout was called
                cart.UserGuid = siteUser.UserGuid;
                cart.Save();
                //if (checkoutDetailsLog.UserGuid == Guid.Empty)
                //{
                //    // we need to make sure we have the user in the log and serialized cart
                //    checkoutDetailsLog.UserGuid = siteUser.UserGuid;
                //    cart.SerializeCartOffers();
                //    checkoutDetailsLog.SerializedObject = SerializationHelper.SerializeToSoap(cart);
                //    checkoutDetailsLog.Save();

                //}
            }

            if ((siteUser != null) && (cart.UserGuid != siteUser.UserGuid))
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }



            if (ModuleId == -1)
            {
                ModuleId = StoreHelper.FindStoreModuleId(CurrentPage);
            }


            store = StoreHelper.GetStore();


            commerceConfig  = SiteUtils.GetCommerceConfig();
            currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

            if (siteUser != null)
            {
                pnlRequireLogin.Visible = false;
            }
            else
            {
                btnMakePayment.Visible = false;
            }

            AddClassToBody("webstore webstoreexpresscheckout");
        }
        void rptOffers_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "addToCart":
            default:

                //Page.Validate("Product");


                Cart cart = StoreHelper.GetCart();
                if (cart == null)
                {
                    return;
                }

                string strGuid = e.CommandArgument.ToString();
                if (strGuid.Length != 36)
                {
                    return;
                }

                Guid  offerGuid = new Guid(strGuid);
                Offer offer     = new Offer(offerGuid);

                int     quantity = 1;
                TextBox txtQty   = e.Item.FindControl("txtQuantity") as TextBox;
                //RangeValidator rangeValidator = e.Item.FindControl("rvQuantity") as RangeValidator;

                if (txtQty != null)
                {
                    try
                    {
                        int.TryParse(txtQty.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, out quantity);
                    }
                    catch (ArgumentException) { }
                }
                if (quantity < 0)
                {
                    quantity = 1;
                }

                //if (Convert.ToInt32(rangeValidator.MaximumValue) < quantity)
                //{
                //	rangeValidator.Visible = true;
                //	return;
                //}

                if (cart.AddOfferToCart(offer, quantity))
                {
                    // redirect to cart page
                    WebUtils.SetupRedirect(this, SiteRoot +
                                           "/WebStore/Cart.aspx?pageid="
                                           + pageId.ToString()
                                           + "&mid=" + moduleId.ToString()
                                           + "&cart=" + cart.CartGuid.ToString());

                    return;
                }

                WebUtils.SetupRedirect(this, Request.RawUrl);

                break;
            }
        }