⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 couponview.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
    using PowerEasy.Common;
    using PowerEasy.CommonModel;
    using PowerEasy.Controls;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.CommonModel;
    using PowerEasy.Model.Shop;
    using PowerEasy.Model.UserManage;
    using PowerEasy.Shop;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using System;
    using System.Text;
    using System.Web.UI.WebControls;

    public class CouponView : AdminPage
    {
        protected Label LblBeginDate;
        protected Label LblCouponCreateType;
        protected Label LblCouponName;
        protected Label LblCouponNumPattern;
        protected Label LblEndDate;
        protected Label LblLimitNum;
        protected Label LblMoney;
        protected Label LblOrderTotalMoney;
        protected Label LblProductLimit;
        protected Label LblState;
        protected Label LblUseEndDate;
        protected Label LblUserGroup;
        protected ExtendedSiteMapPath SmpNavigator;

        private string GetModel(string idList)
        {
            string[] strArray = idList.Split(new char[] { ',' });
            StringBuilder sb = new StringBuilder();
            foreach (string str in strArray)
            {
                ModelInfo modelInfoById = ModelManager.GetModelInfoById(DataConverter.CLng(str));
                StringHelper.AppendString(sb, modelInfoById.ModelName);
            }
            return sb.ToString();
        }

        private string GetProduct(string idList)
        {
            string[] strArray = idList.Split(new char[] { ',' });
            StringBuilder sb = new StringBuilder();
            foreach (string str in strArray)
            {
                ProductInfo productById = Product.GetProductById(DataConverter.CLng(str));
                StringHelper.AppendString(sb, productById.ProductName);
            }
            return sb.ToString();
        }

        private string GetUserGroupName(string idList)
        {
            string[] strArray = idList.Split(new char[] { ',' });
            StringBuilder sb = new StringBuilder();
            foreach (string str in strArray)
            {
                UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(DataConverter.CLng(str));
                StringHelper.AppendString(sb, userGroupById.GroupName);
            }
            return sb.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            int couponId = BasePage.RequestInt32("CouponID");
            if (couponId == 0)
            {
                AdminPage.WriteErrMsg("<li>优惠券ID不能为空</li>");
            }
            if (!this.Page.IsPostBack)
            {
                CouponInfo couponInfoById = PowerEasy.Shop.Coupon.GetCouponInfoById(couponId);
                if (!couponInfoById.IsNull)
                {
                    this.LblCouponName.Text = couponInfoById.CouponName;
                    this.LblCouponNumPattern.Text = couponInfoById.CouponNumPattern;
                    this.LblMoney.Text = couponInfoById.Money.ToString("0.00");
                    this.LblState.Text = (couponInfoById.State == 1) ? "启用" : "禁用";
                    this.LblUserGroup.Text = this.GetUserGroupName(couponInfoById.UserGroup);
                    this.LblBeginDate.Text = couponInfoById.BeginDate.ToString("yyyy-MM-dd");
                    this.LblEndDate.Text = couponInfoById.EndDate.ToString("yyyy-MM-dd");
                    this.LblUseEndDate.Text = couponInfoById.UseEndDate.ToString("yyyy-MM-dd");
                    this.LblLimitNum.Text = couponInfoById.LimitNum.ToString();
                    this.LblOrderTotalMoney.Text = couponInfoById.OrderTotalMoney.ToString("0.00");
                    switch (couponInfoById.CouponCreateType)
                    {
                        case CouponCreateType.AllProduct:
                            this.LblCouponCreateType.Text = "购买任意商品可得到此优惠券";
                            break;

                        case CouponCreateType.NominateModel:
                            this.LblCouponCreateType.Text = "购买“" + this.GetModel(couponInfoById.CouponCreateContent) + "”模型下的商品可得到此优惠券";
                            break;

                        case CouponCreateType.NominateProduct:
                            this.LblCouponCreateType.Text = "购买“" + this.GetProduct(couponInfoById.CouponCreateContent) + "”可得到此优惠券";
                            break;

                        case CouponCreateType.OrderTotalMoney:
                            this.LblCouponCreateType.Text = "订单总金额满足" + couponInfoById.CouponCreateContent + "元可得到此优惠券";
                            break;
                    }
                    switch (couponInfoById.ProductLimitType)
                    {
                        case ProductLimitType.AllProduct:
                            this.LblProductLimit.Text = "所有商品";
                            return;

                        case ProductLimitType.NominateModel:
                            this.LblProductLimit.Text = "“" + this.GetModel(couponInfoById.ProductLimitContent) + "”模型下的商品";
                            return;

                        case ProductLimitType.NominateProduct:
                            this.LblProductLimit.Text = this.GetProduct(couponInfoById.ProductLimitContent);
                            return;

                        default:
                            return;
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -