Esempio n. 1
0
    protected void uxProductFormView_DataBound(object sender, EventArgs e)
    {
        FormView formView = ( FormView )sender;

        // FormView's DataItem property is valid only in DataBound event.
        // Most of the time it is null.
        if (String.IsNullOrEmpty(Name))
        {
            Name             = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "Name"));
            ShortDescription = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "ShortDescription"));
            PopulateTitleAndMeta();
        }
        IList <String> categoryIDs = (IList <String>)DataBinder.Eval(formView.DataItem, "CategoryIDs");

        string categoryID = ConvertUtilities.ToString(categoryIDs[0]);

        foreach (string catID in categoryIDs)
        {
            Category category = DataAccessContext.CategoryRepository.GetOne(StoreContext.Culture, catID);
            if (category.IsCategoryAvailableStore(StoreContext.CurrentStore.StoreID) && (category.IsParentsEnable()))
            {
                categoryID = catID;
                break;
            }
        }

        SetUpBreadcrumb(
            ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "ProductID")),
            ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "Name")),
            ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "ShortDescription")),
            ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "UrlName")),
            categoryID);
    }
Esempio n. 2
0
    protected string GetManufacturerName(object manufacturerID)
    {
        string       manuID       = ConvertUtilities.ToString(manufacturerID);
        Manufacturer manufacturer = DataAccessContext.ManufacturerRepository.GetOne(StoreContext.Culture, manuID);

        return(manufacturer.Name);
    }
    private string GetDiscountTypeBuyXGetYText(Coupon coupon, bool isErrorMessage)
    {
        String message = "";

        if (!isErrorMessage)
        {
            message = "Buy " + coupon.MinimumQuantity.ToString() + " item(s) full price and get ";

            if (coupon.DiscountType == Coupon.DiscountTypeEnum.BuyXDiscountYPrice)
            {
                message += StoreContext.Currency.FormatPrice(coupon.DiscountAmount) + " discount ";
                message += "for " + coupon.PromotionQuantity.ToString() + " item(s). ";
            }
            else //Coupon.DiscountTypeEnum.BuyXDiscountYPercentage
            {
                if (ConvertUtilities.ToInt32(coupon.Percentage) == 100)
                {
                    message += coupon.PromotionQuantity + " item(s) free. ";
                }
                else // coupon.Percentage != 100
                {
                    message += coupon.Percentage.ToString("0.00") + "% discount ";
                    message += "for " + coupon.PromotionQuantity.ToString() + " item(s). ";
                }
            }
        }
        else
        {
            message += "To use this coupon, you need to buy at least ";
            message += ConvertUtilities.ToString(coupon.MinimumQuantity + coupon.PromotionQuantity) + " items per product.";
        }

        return(message);
    }
Esempio n. 4
0
        private string GetArrayItem(string[] array, int index)
        {
            if (array.Length <= index)
            {
                return(String.Empty);
            }

            return(ConvertUtilities.ToString(array[index]));
        }
Esempio n. 5
0
    protected string GetDisplayString(object message, int length)
    {
        string displayMessage = ConvertUtilities.ToString(message);

        if (displayMessage.Length > length)
        {
            return(displayMessage.Substring(0, length) + "  ...");
        }

        return(displayMessage);
    }
Esempio n. 6
0
    protected bool IsTooltipVisible(object message, int length)
    {
        string messageTxt = ConvertUtilities.ToString(message);

        if (messageTxt.Length > length)
        {
            return(true);
        }

        return(false);
    }
 private string GetValue(string value)
 {
     if (uxSearchFilter.FieldName.ToLower() == "reviewrating")
     {
         return(ConvertUtilities.ToString(ConvertUtilities.ToDouble(value) /
                                          ConvertUtilities.ToDouble(DataAccessContext.Configurations.GetValue("StarRatingAmount"))));
     }
     else
     {
         return(value);
     }
 }
Esempio n. 8
0
    protected string CreateShortDescritpion(object shortDesc)
    {
        string shortDescription = ConvertUtilities.ToString(shortDesc);

        if (shortDescription.Length > 120)
        {
            string subDescription = shortDescription.Substring(0, 119);
            return(subDescription);
        }

        return(shortDescription);
    }
Esempio n. 9
0
    protected void uxBlogFormView_DataBound(object sender, EventArgs e)
    {
        FormView formView = (FormView)sender;

        // FormView's DataItem property is valid only in DataBound event.
        // Most of the time it is null.
        if (String.IsNullOrEmpty(BlogTitle))
        {
            BlogTitle   = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "BlogTitle"));
            BlogContent = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "BlogContent"));
        }
    }
Esempio n. 10
0
    public void SetFooter(Object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            TableCellCollection cells = e.Row.Cells;

            cells[0].Text     = "Total Points";
            cells[0].CssClass = "RewardPointGridTotalFooterStyle";

            cells[1].Text     = ConvertUtilities.ToString(TotalPoint());
            cells[1].CssClass = "RewardPointGridPointFooterStyle";
        }
    }
Esempio n. 11
0
    protected void ProductItemCreate(object sender, EventArgs e)
    {
        FormView formView = (FormView)sender;
        Product  product  = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, ProductID, new StoreRetriever().GetCurrentStoreID());

        BaseProductDetails productDetailsControl = new BaseProductDetails();

        productDetailsControl = LoadControl("Components/ProductDetails.ascx") as BaseProductDetails;

        productDetailsControl.CurrentProduct  = product;
        productDetailsControl.DiscountGroupID = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "DiscountGroupID"));
        formView.Controls.Add(productDetailsControl);
    }
Esempio n. 12
0
    protected void SetFooter(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            TableCellCollection cells = e.Row.Cells;
            cells.RemoveAt(0);
            cells[0].ColumnSpan = 2;

            cells[0].Text            = "Total Points";
            cells[0].HorizontalAlign = HorizontalAlign.Center;
            cells[0].Font.Bold       = true;

            cells[1].Text     = ConvertUtilities.ToString(TotalPoint());
            cells[1].CssClass = "OrderListTotalPrice";
        }
    }
Esempio n. 13
0
    protected void ProductItemCreate(object sender, EventArgs e)
    {
        FormView formView = ( FormView )sender;
        Product  product  = DataAccessContext.ProductRepository.GetOne(StoreContext.Culture, ProductID, new StoreRetriever().GetCurrentStoreID());

        BaseProductDetails productDetailsControl = new BaseProductDetails();

        if (!String.IsNullOrEmpty(product.ProductDetailsLayoutPath))
        {
            productDetailsControl = LoadControl(String.Format("{0}{1}", SystemConst.LayoutProductDetailsPath, product.ProductDetailsLayoutPath)) as BaseProductDetails;
        }
        else
        {
            productDetailsControl = LoadControl(String.Format("{0}{1}", SystemConst.LayoutProductDetailsPath, DataAccessContext.Configurations.GetValue("DefaultProductDetailsLayout"))) as BaseProductDetails;
        }

        productDetailsControl.CurrentProduct  = product;
        productDetailsControl.DiscountGroupID = ConvertUtilities.ToString(DataBinder.Eval(formView.DataItem, "DiscountGroupID"));
        formView.Controls.Add(productDetailsControl);
    }
Esempio n. 14
0
    public string GetImageUrl(object promotionGroupID)
    {
        string         imageUrl       = "";
        PromotionGroup promotionGroup = DataAccessContextDeluxe.PromotionGroupRepository.GetOne(
            StoreContext.Culture,
            StoreContext.CurrentStore.StoreID,
            ConvertUtilities.ToString(promotionGroupID),
            BoolFilter.ShowAll);

        if (String.IsNullOrEmpty(promotionGroup.ImageFile) || promotionGroup.ImageFile.Equals("~/"))
        {
            imageUrl = "~/" + DataAccessContext.Configurations.GetValue("DefaultImageUrl");
        }
        else
        {
            imageUrl = "~/" + promotionGroup.ImageFile;
        }

        return(imageUrl);
    }
Esempio n. 15
0
 private string GetEndPrice(decimal currentPrice)
 {
     return(ConvertUtilities.ToString(currentPrice - ConvertUtilities.ToDecimal(0.01)));
 }
Esempio n. 16
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = "SoftFluent.Samples.GEDMembershipProvider";
            }
            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MembershipProviderDescription", "SoftFluent.Samples.GED"));
            }
            base.Initialize(name, config);
            _enablePasswordRetrieval   = ConvertUtilities.ToBoolean(config["enablePasswordRetrieval"], false);
            _enablePasswordReset       = ConvertUtilities.ToBoolean(config["enablePasswordReset"], true);
            _requiresUniqueEmail       = true;       // cannot be changed here
            _requiresQuestionAndAnswer = ConvertUtilities.ToBoolean(config["requiresQuestionAndAnswer"], false);
            _updateLastActivity        = ConvertUtilities.ToBoolean(config["updateLastActivity"], true);


            if (_requiresQuestionAndAnswer)
            {
                throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("UnsupportedRequiresQuestionAndAnswer", "Membership provider only supports requiresQuestionAndAnswer set to false."));
            }


            _maxInvalidPasswordAttempts           = ConvertUtilities.ToInt32(config["maxInvalidPasswordAttempts"], 5);
            _passwordAttemptWindow                = ConvertUtilities.ToInt32(config["passwordAttemptWindow"], 10);
            _minRequiredPasswordLength            = ConvertUtilities.ToInt32(config["minRequiredPasswordLength"], 4);
            _minRequiredNonAlphanumericCharacters = ConvertUtilities.ToInt32(config["minRequiredNonalphanumericCharacters"], 0);
            _passwordStrengthRegularExpression    = ConvertUtilities.ToString(config["passwordStrengthRegularExpression"], "", true);
            if (_minRequiredNonAlphanumericCharacters > _minRequiredPasswordLength)
            {
                throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MinNonAlphanMoreThanMinRequiredPassword", "MinRequiredNonalphanumericCharacters can not be more than MinRequiredPasswordLength."));
            }

            _applicationName = config["applicationName"];
            if (string.IsNullOrEmpty(_applicationName))
            {
                _applicationName = applicationName;
            }

            _passwordFormat = (MembershipPasswordFormat)ConvertUtilities.ToEnum(config["passwordFormat"], MembershipPasswordFormat.Hashed);
            if ((_passwordFormat == MembershipPasswordFormat.Hashed) && (_enablePasswordRetrieval))
            {
                throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("CannotRetrieveHash", "Membership provider can not retrieve hashed passwords."));
            }

            config.Remove("enablePasswordRetrieval");
            config.Remove("enablePasswordReset");
            config.Remove("requiresQuestionAndAnswer");
            config.Remove("applicationName");
            config.Remove("requiresUniqueEmail");
            config.Remove("maxInvalidPasswordAttempts");
            config.Remove("passwordAttemptWindow");
            config.Remove("passwordFormat");
            config.Remove("name");
            config.Remove("minRequiredPasswordLength");
            config.Remove("minRequiredNonalphanumericCharacters");
            config.Remove("passwordStrengthRegularExpression");
            config.Remove("updateLastActivity");
        }
Esempio n. 17
0
    protected bool IsReferenceLinkVisible(object rewardPointID)
    {
        string pointID = ConvertUtilities.ToString(rewardPointID);

        return(!IsPointReferenceLabelVisible(pointID));
    }
Esempio n. 18
0
    protected bool IsShowSeeMore(object shortDesc)
    {
        string shortDescription = ConvertUtilities.ToString(shortDesc);

        return(shortDescription.Length > 119);
    }
Esempio n. 19
0
 protected string GetCountry(object country)
 {
     return(DataAccessContext.CountryRepository.GetOne(ConvertUtilities.ToString(country)).CommonName);
 }
Esempio n. 20
0
 private string GetStartPrice(decimal currentPrice)
 {
     return(ConvertUtilities.ToString(ConvertUtilities.ToDecimal(currentPrice - PriceStep)));
 }