Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.btnAddArticle.Click += new EventHandler(this.btnAddArticle_Click);
            if (!this.Page.IsPostBack)
            {
                this.dropArticleCategory.DataBind();
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["categoryId"]))
                {
                    int result = 0;
                    int.TryParse(this.Page.Request.QueryString["categoryId"], out result);
                    this.dropArticleCategory.SelectedValue = new int?(result);
                }


                DataTable couponList = new DataTable();
                couponList = CouponHelper.GetAllCoupons();
                DDLCoupon.Items.Add("未选择");
                foreach (DataRow row in couponList.Rows)
                {
                    ListItem item = new ListItem();
                    item.Text  = row["name"].ToString();
                    item.Value = row["CouponId"].ToString();
                    DDLCoupon.Items.Add(item);
                }
            }
        }
Example #2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnAddCoupons.Click += new System.EventHandler(this.btnAddCoupons_Click);
     if (!IsPostBack)
     {
         ddlCoupons.DataSource     = CouponHelper.GetAllCoupons();
         ddlCoupons.DataTextField  = "Name";
         ddlCoupons.DataValueField = "CouponId";
         ddlCoupons.DataBind();
         if (Request.QueryString["ID"] != null)
         {
             int ID = Convert.ToInt32(Request.QueryString["ID"]);
             txtID.Value = ID + "";
             Hidistro.Entities.Promotions.CouponsAct ca = CouponHelper.GetCouponsAct(ID);
             txtCouponActName.Text    = ca.ColValue2;
             ddlCoupons.SelectedValue = ca.CouponsID + "";
             upBgImg.UploadedImageUrl = ca.BgImg;
             txtColValue.Text         = ca.ColValue1 + "";
         }
         else
         {
             txtColValue.Text = "0";
         }
     }
 }
Example #3
0
        public void GetYHQ()
        {
            List <CouponInfo>    allCoupons           = CouponHelper.GetAllCoupons();
            StringBuilder        stringBuilder        = new StringBuilder();
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            javaScriptSerializer.Serialize(allCoupons, stringBuilder);
            base.Response.Write(stringBuilder);
            base.Response.End();
        }
        public void GetYHQ(HttpContext context)
        {
            string               text                 = context.Request["StartDate"];
            List <CouponInfo>    allCoupons           = CouponHelper.GetAllCoupons();
            StringBuilder        stringBuilder        = new StringBuilder();
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            javaScriptSerializer.Serialize(allCoupons, stringBuilder);
            context.Response.Write(stringBuilder);
            context.Response.End();
        }
Example #5
0
        /// <summary>
        /// 进入主页获赠优惠券
        /// </summary>
        private void getMyCoupon()
        {
            DataTable  allCoupons = CouponHelper.GetAllCoupons();                           //优惠券列表
            DataTable  allCouponItemsClaimCode = CouponHelper.GetAllCouponItemsClaimCode(); //所有已发送优惠券的claimcode
            MemberInfo currentMember           = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                return;//如果当前没有登录则不执行该方法
            }
            for (int i = 0; i < allCoupons.Rows.Count; i++)
            {
                if (allCoupons.Rows[i]["sendAtHomepage"].ToString() == "1")//如果需要在主页赠送,就开始判断该用户是否已获取过
                {
                    for (int o = 0; o < allCouponItemsClaimCode.Rows.Count; o++)
                    {
                        string currentClaimCode = allCouponItemsClaimCode.Rows[o]["ClaimCode"].ToString();
                        bool   isSend           = currentMember.UserId.ToString() == currentClaimCode.TrimStart('0');
                        if (isSend)
                        {
                            return;//如果发送过,返回
                        }
                        else
                        {
                            continue;//如果没有发送,继续循环查找
                        }
                    }
                    //发送优惠券
                    int            couponId  = Convert.ToInt32(allCoupons.Rows[i]["CouponId"]);
                    string         claimCode = currentMember.UserId.ToString("000000000000000");
                    CouponItemInfo item      = new CouponItemInfo();
                    System.Collections.Generic.IList <CouponItemInfo> listCouponItem = new System.Collections.Generic.List <CouponItemInfo>();
                    item = new CouponItemInfo(couponId, claimCode, new int?(currentMember.UserId), currentMember.UserName, currentMember.Email, System.DateTime.Now);
                    listCouponItem.Add(item);
                    CouponHelper.SendClaimCodes(couponId, listCouponItem);
                    break;
                }
            }
        }
Example #6
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
         DataTable    dtCoupons      = CouponHelper.GetAllCoupons();
         foreach (DataRow row in dtCoupons.Rows)
         {
             ddlCoupons.Items.Add(new ListItem()
             {
                 Text  = row["name"].ToString(),
                 Value = row["CouponId"].ToString()
             });
         }
         if (masterSettings.friendCouponId > 0 && dtCoupons.Rows.Count > 0)
         {
             this.ddlCoupons.SelectedValue = masterSettings.friendCouponId.ToString();
         }
         //Items.FindByValue(masterSettings.friendCouponId.ToString()).Selected=true;
         this.chkOnOff.Checked = masterSettings.friendCouponId > 0;
     }
     this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
 }
Example #7
0
        /// <summary>
        /// 进入主页获赠优惠券
        /// </summary>
        private void getMyCoupon()
        {
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                return;                                                                    //如果当前没有登录则不执行该方法
            }
            DataTable allCoupons = CouponHelper.GetAllCoupons();                           //优惠券列表
            DataTable allCouponItemsClaimCode = CouponHelper.GetAllCouponItemsClaimCode(); //所有已发送优惠券的claimcode

            for (int i = 0; i < allCoupons.Rows.Count; i++)
            {
                if (allCoupons.Rows[i]["sendAtHomepage"].ToString() == "1")    //如果需要在主页赠送,就开始判断该用户是否已获取过
                {
                    bool isSend = true;
                    //发送优惠券
                    int couponId = Convert.ToInt32(allCoupons.Rows[i]["CouponId"]);
                    for (int o = 0; o < allCouponItemsClaimCode.Rows.Count; o++)
                    {
                        string   currentClaimCode  = allCouponItemsClaimCode.Rows[o]["ClaimCode"].ToString();
                        string[] claimCodeUnhandle = currentClaimCode.TrimStart('b').Split('|');
                        if (claimCodeUnhandle.Length == 2)
                        {
                            isSend = (currentMember.UserId.ToString() == claimCodeUnhandle[1] && couponId.ToString() == claimCodeUnhandle[0]);
                            if (isSend)
                            {
                                break;    //如果发送过,跳出循环
                            }
                            else
                            {
                                continue;    //如果没有发送,继续循环查找
                            }
                        }
                        else
                        {
                            isSend = currentMember.UserId.ToString() == currentClaimCode.TrimStart('0');
                            if (isSend)
                            {
                                break;    //如果发送过,跳出循环
                            }
                            else
                            {
                                continue;    //如果没有发送,继续循环查找
                            }
                        }
                    }
                    if (!isSend)
                    {
                        int    number;
                        string claimCode = string.Empty;
                        claimCode += couponId + "|" + currentMember.UserId;
                        claimCode  = claimCode.PadLeft(15, 'b');
                        CouponItemInfo item = new CouponItemInfo();
                        System.Collections.Generic.IList <CouponItemInfo> listCouponItem = new System.Collections.Generic.List <CouponItemInfo>();
                        item = new CouponItemInfo(couponId, claimCode, new int?(currentMember.UserId), currentMember.UserName, currentMember.Email, System.DateTime.Now);
                        listCouponItem.Add(item);
                        CouponHelper.SendClaimCodes(couponId, listCouponItem);
                    }
                }
            }
        }
Example #8
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("申请分销");
            this.Page.Session["stylestatus"] = "2";

            if (MemberProcessor.GetCurrentMember() != null)
            {
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(MemberProcessor.GetCurrentMember().UserId);
                if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                {
                    this.Page.Response.Redirect("DistributorCenter.aspx", true);
                }
            }

            Literal litNext = (Literal)this.FindControl("litNext");

            //增加判断,如果选了快速开店,上架商品页面也必须要跳过.
            if (litNext != null)
            {
                if ((Hidistro.Core.SettingsManager.GetMasterSettings(false).EnableStoreInfoSet))//如果开启了店铺配置(非快速开店)
                {
                    litNext.Text = (Hidistro.Core.SettingsManager.GetMasterSettings(false).EnableStoreProductAuto) ? "" : ",上架商品";
                }
                else//如果没开店铺配置(快速开店)
                {
                    storeName = (HtmlInputHidden)this.FindControl("storeName");
                    if (storeName != null) //附一个默认值
                    {
                        int i = 1;
                        storeName.Value = MemberProcessor.GetCurrentMember().UserName.ToString() + "的小店";
                        while (DistributorsBrower.IsExiteDistributorsByStoreName(storeName.Value) > 0)
                        {
                            i++;
                            storeName.Value += i.ToString();
                        }
                    }
                    litNext.Text = "";
                }
            }

            //页面[马上成为分销商]按钮的传参判断
            if (Page.Request.QueryString["action"] != null)
            {
                switch (Page.Request.QueryString["action"])
                {
                //针对阿黛尔艺丝,成为分销商(vip)后直接获取一个最新的优惠券
                case "VIP":
                    int            couponId;//优惠券id
                    string         claimCode     = string.Empty;
                    MemberInfo     currentMember = MemberProcessor.GetCurrentMember();
                    CouponItemInfo item          = new CouponItemInfo();
                    System.Collections.Generic.IList <CouponItemInfo> listCouponItem = new System.Collections.Generic.List <CouponItemInfo>();
                    //DataTable coupons = CouponHelper.GetAllCouponsID();
                    DataTable allCoupons = CouponHelper.GetAllCoupons();    //优惠券列表
                    for (int i = 0; i < allCoupons.Rows.Count; i++)
                    {
                        if (allCoupons.Rows[i]["sendAtDistributor"].ToString() == "1")    //如果需要在成为分销商时赠送,就开始赠送
                        {
                            couponId  = Convert.ToInt32(allCoupons.Rows[i]["CouponId"]);
                            claimCode = currentMember.UserId.ToString().PadLeft(15, 'a');   //左边填充
                            item      = new CouponItemInfo(couponId, claimCode, new int?(currentMember.UserId), currentMember.UserName, currentMember.Email, System.DateTime.Now);
                            listCouponItem.Add(item);
                            CouponHelper.SendClaimCodes(couponId, listCouponItem);
                            break;
                        }
                    }
                    break;
                }
            }
        }