예제 #1
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    public void Bind()
    {
        if (KeyID != 0)
        {
            string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", CompID);
            Hi.Model.BD_Promotion ProModel = ProBll.GetModel(KeyID);

            if (ProModel != null)
            {
                this.lblProTitle.InnerText = ProModel.ProTitle;
                this.lblProType.InnerText  = Common.GetProType(ProModel.ProType.ToString());
                pro = ProModel.ProType.ToString();

                this.lblProIsEnabled.InnerText = Common.GetIsEnabled(ProModel.IsEnabled.ToString());
                this.lblProStartDate.InnerText = ProModel.ProStartTime == DateTime.MinValue ? "" : ProModel.ProStartTime.ToString("yyyy-MM-dd");
                this.lblProEndDate.InnerText   = ProModel.ProEndTime == DateTime.MinValue ? "" : ProModel.ProEndTime.ToString("yyyy-MM-dd");
                this.lblProInfos.InnerText     = ProModel.ProInfos;

                if (ProModel.ProStartTime <= DateTime.Now && ProModel.ProEndTime.AddDays(1) > DateTime.Now)
                {
                    //促销活动中
                    //判断是否禁用
                    if (ProModel.IsEnabled == 0)
                    {
                        //未禁用
                        this.liEdit.Visible = true;  //编辑
                        this.liDel.Visible  = true;  //删除
                        this.liNo.Visible   = false; //禁用
                        this.liOk.Visible   = true;  //启用
                    }
                    else
                    {
                        //已禁用
                        this.liEdit.Visible = false; //编辑
                        this.liDel.Visible  = false; //删除
                        this.liNo.Visible   = true;  //禁用
                        this.liOk.Visible   = false; //启用
                    }
                }
                else if (ProModel.ProStartTime > DateTime.Now)
                {
                    //判断是否禁用
                    if (ProModel.IsEnabled == 0)
                    {
                        //未禁用
                        this.liEdit.Visible = true;  //编辑
                        this.liDel.Visible  = true;  //删除
                        this.liNo.Visible   = false; //禁用
                        this.liOk.Visible   = true;  //启用
                    }
                    else
                    {
                        //已禁用
                        this.liEdit.Visible = false; //编辑
                        this.liDel.Visible  = false; //删除
                        this.liNo.Visible   = true;  //禁用
                        this.liOk.Visible   = false; //启用
                    }
                }
                else
                {
                    this.liEdit.Visible = true;  //编辑
                    this.liDel.Visible  = true;  //删除
                    this.liNo.Visible   = false; //禁用
                    this.liOk.Visible   = false; //启用
                }

                //促销活动商品明细
                List <Hi.Model.BD_PromotionDetail> gl = ProDBll.GetList("", " CompId=" + this.CompID + " and ProID=" + KeyID, "");
                if (gl != null && gl.Count > 0)
                {
                    if (ProModel.ProType == 3)
                    {
                        lblDisCount.InnerText = "订购数量每满(" + (int)ProModel.Discount + "),获赠品(" + gl[0].GoodsPrice.ToString("#,####" + Digits) + ")个";
                    }
                    else if (ProModel.ProType == 4)
                    {
                        lblDisCount.InnerText = "在原订货价基础上再打折(" + (int)ProModel.Discount + ")%";
                    }

                    this.rpDtl.DataSource = gl;
                    this.rpDtl.DataBind();
                }
            }
        }
    }
예제 #2
0
    public void Bind()
    {
        //首次进行页面清除Session
        Session.Remove("GoodsPrice");
        if (KeyID != 0)
        {
            string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", CompID);
            Hi.Model.BD_Promotion ProModel = ProBll.GetModel(KeyID);

            //促销公告
            List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID + "and isnull(IsEnabled,0)=1", "");

            if (ProModel != null)
            {
                this.txtPromotiontitle.Value = ProModel.ProTitle;
                this.txtPromotionDate.Value  = ProModel.ProStartTime == DateTime.MinValue ? "" : ProModel.ProStartTime.ToString("yyyy-MM-dd");
                this.txtPromotionDate1.Value = ProModel.ProEndTime == DateTime.MinValue ? "" : ProModel.ProEndTime.ToString("yyyy-MM-dd");
                this.txtProInfos.Value       = ProModel.ProInfos;

                if (newsl != null && newsl.Count > 0)
                {
                    this.isOkComNews.Checked = true;
                    this.isNoComNews.Checked = false;
                }
                else
                {
                    this.isOkComNews.Checked = false;
                    this.isNoComNews.Checked = true;
                }

                //促销方式
                if (ProModel.ProType == 3)
                {
                    this.promotionType3.Checked = true;
                    this.txtSendFull.Value      = string.Format("{0:N4}", ProModel.Discount.ToString("#,####" + Digits));
                }
                else
                {
                    this.promotionType4.Checked = true;
                    this.txtDiscount.Value      = string.Format("{0:N4}", ProModel.Discount.ToString("#,####" + Digits));
                }
                //促销禁用
                if (ProModel.IsEnabled == 0)
                {
                    this.IsEnabled0.Checked = true;
                }
                else
                {
                    this.IsEnabled1.Checked = true;
                }

                decimal count = 0;
                //促销活动商品明细
                List <Hi.Model.BD_PromotionDetail> gl = ProDBll.GetList("", " CompId=" + this.CompID + " and ProID=" + KeyID, "");
                if (gl != null && gl.Count > 0)
                {
                    List <Hi.Model.BD_GoodsInfo> ll = new List <Hi.Model.BD_GoodsInfo>();

                    Hi.Model.BD_GoodsInfo model = null;
                    foreach (var item in gl)
                    {
                        model              = new Hi.Model.BD_GoodsInfo();
                        model.CompID       = this.CompID;
                        model.IsEnabled    = true;
                        model.CreateUserID = this.UserID;
                        model.CreateDate   = DateTime.Now;
                        model.ts           = DateTime.Now;
                        model.modifyuser   = this.UserID;
                        model.ID           = item.GoodInfoID;
                        model.GoodsID      = item.GoodsID;
                        model.SalePrice    = GoodsPrice(item.GoodInfoID.ToString());
                        model.TinkerPrice  = item.GoodsPrice; //促销价
                        count              = item.GoodsPrice;
                        ll.Add(model);
                    }
                    if (ProModel.ProType == 3)
                    {
                        //满送
                        this.txtSendNum.Value = string.Format("{0:N4}", count.ToString("#,####" + Digits));
                    }
                    Session["GoodsPrice"] = ll;
                    this.rpDtl.DataSource = ll;
                    this.rpDtl.DataBind();
                }
            }
        }
        else
        {
            this.rpDtl.DataSource = "";
            this.rpDtl.DataBind();
        }
    }