Ejemplo n.º 1
0
        protected void InitInfo()
        {
            string id        = Utils.GetQueryStringValue("jfid");
            int    fangshiId = Utils.GetInt(Utils.GetQueryStringValue("fsid"));
            int    Sum       = Utils.GetInt(Utils.GetQueryStringValue("jfsum"));

            EyouSoft.BLL.YlStructure.BDuiHuan DuiHuan = new EyouSoft.BLL.YlStructure.BDuiHuan();
            var jiinfo = DuiHuan.GetJiFenShangPinInfo(id);

            if (!isLogin)
            {
                Response.Redirect("jifeninfo.aspx?id=" + id);
            }
            if (jiinfo == null)
            {
                Response.Redirect("jifenlist.aspx");
            }
            if (Sum < 1)
            {
                Response.Redirect("jifenlist.aspx");
            }

            if (isLogin && jiinfo != null && Sum >= 1)
            {
                HidKuaiDiJinE.Value = jiinfo.FaPiaoKuaiDiJinE.ToString("F2");

                #region 地址
                int recordCount = 0;
                EyouSoft.BLL.YlStructure.BHuiYuan bll = new EyouSoft.BLL.YlStructure.BHuiYuan();
                EyouSoft.Model.YlStructure.MHuiYuanDiZhiChaXunInfo chaxun = new MHuiYuanDiZhiChaXunInfo()
                {
                    HuiYuanId = m.HuiYuanId
                };
                var list = bll.GetDiZhis(YuMingInfo.CompanyId, 20, 1, ref recordCount, chaxun);
                rptList.DataSource = list;
                rptList.DataBind();
                #endregion

                #region 积分产品详细
                txtjfName.Text = jiinfo.MingCheng;
                txtJinE.Text   = JinEHtml(jiinfo.FangShis, fangshiId, Sum);
                txtSum.Text    = Sum.ToString();
                #endregion
            }
            else
            {
                RCWE("异常请求");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 积分兑换
        /// </summary>
        /// <returns></returns>
        protected string DingDanSava()
        {
            string id        = Utils.GetQueryStringValue("jfid");
            int    Sum       = Utils.GetInt(Utils.GetQueryStringValue("jfsum"));
            int    fangshiId = Utils.GetInt(Utils.GetQueryStringValue("fsid"));
            string dizhi     = Utils.GetFormValue(hidAddressId.UniqueID);
            string str       = "";

            EyouSoft.BLL.YlStructure.BDuiHuan bll = new EyouSoft.BLL.YlStructure.BDuiHuan();
            var DuiHuan = bll.GetJiFenShangPinInfo(id);

            if (DuiHuan == null)
            {
                return(UtilsCommons.AjaxReturnJson("0", "兑换的积分商品不存在"));
            }

            if (DuiHuan.Status == EyouSoft.Model.EnumType.YlStructure.JiFenShangPinStatus.架)
            {
                return(UtilsCommons.AjaxReturnJson("0", "商品已下架,不能兑换"));
            }

            if (!isLogin)
            {
                return(UtilsCommons.AjaxReturnJson("0", "请登录后再兑换"));
            }

            var JfFangShi = DuiHuan.FangShis.Where(n => (int)n.FangShi == fangshiId).ToList();

            #region 赋值
            /// <summary>
            /// 商品编号
            /// </summary>
            string ShangPinId = id;
            /// <summary>
            /// 公司编号
            /// </summary>
            string CompanyId = YuMingInfo.CompanyId;

            /// <summary>
            /// 数量
            /// </summary>
            int ShuLiang = Sum;
            /// <summary>
            /// 兑换方式
            /// </summary>
            EyouSoft.Model.EnumType.YlStructure.JiFenDuiHuanFangShi FangShi = JfFangShi[0].FangShi;

            /// <summary>
            /// 积分
            /// </summary>
            decimal JiFen = JfFangShi[0].JiFen * Sum;
            /// <summary>
            /// 订单状态
            /// </summary>
            EyouSoft.Model.EnumType.YlStructure.JiFenDingDanStatus DingDanStatus = EyouSoft.Model.EnumType.YlStructure.JiFenDingDanStatus.未处理;
            /// <summary>
            /// 付款状态
            /// </summary>
            EyouSoft.Model.EnumType.YlStructure.FuKuanStatus FuKuanStatus = EyouSoft.Model.EnumType.YlStructure.FuKuanStatus.未付款;
            /// <summary>
            /// 下单备注
            /// </summary>
            string XiaDanBeiZhu = "";
            /// <summary>
            /// 预订人姓名
            /// </summary>
            string YuDingRenName = "";
            /// <summary>
            /// 预订人电话
            /// </summary>
            string YuDingRenDianHua = "";
            /// <summary>
            /// 预订人手机
            /// </summary>
            string YuDingRenShouJi = "";
            /// <summary>
            /// 预订人邮箱
            /// </summary>
            string YuDingRenYouXiang = "";
            /// <summary>
            /// 是否需要发票
            /// </summary>
            bool IsXuYaoFaPiao = Utils.GetInt(Utils.GetFormValue(hidIsFapiao.UniqueID)) == 1 ? true : false;
            /// <summary>
            /// 发票抬头
            /// </summary>
            string FaPiaoTaiTou = Utils.GetFormValue("txtFapTitle");
            /// <summary>
            /// 发票明细类型
            /// </summary>
            string FaPiaoLeiXing = "";
            /// <summary>
            /// 发票明细
            /// </summary>
            string FaPiaoMingXi = Utils.GetFormValue("txtFapMingx");
            /// <summary>
            /// 发票配送方式
            /// </summary>
            EyouSoft.Model.EnumType.YlStructure.FaPiaoPeiSongFangShi FaPiaoPeiSongFangShi = EyouSoft.Model.EnumType.YlStructure.FaPiaoPeiSongFangShi.快递;
            /// <summary>
            /// 发票配送地址
            /// </summary>
            string FaPiaoDiZhiId = dizhi;
            /// <summary>
            /// 发票快递费用
            /// </summary>
            decimal FaPiaoKuaiDiJinE = 0;
            if (IsXuYaoFaPiao)
            {
                FaPiaoKuaiDiJinE = DuiHuan.FaPiaoKuaiDiJinE;
            }
            /// <summary>
            /// 下单人编号
            /// </summary>
            string XiaDanRenId = m.HuiYuanId;
            /*******************金额计算***********************************************************/
            /// <summary>
            /// 金额
            /// </summary>
            decimal JinE = JfFangShi[0].JinE * Sum;
            if (IsXuYaoFaPiao)
            {
                JinE = JinE + FaPiaoKuaiDiJinE;
            }

            /******************************************************************************/
            #endregion

            EyouSoft.Model.YlStructure.MWzJiFenDingDanInfo info = new MWzJiFenDingDanInfo()
            {
                ShangPinId           = ShangPinId,
                CompanyId            = CompanyId,
                ShuLiang             = ShuLiang,
                FangShi              = FangShi,
                JinE                 = JinE,
                JiFen                = JiFen,
                DingDanStatus        = DingDanStatus,
                FuKuanStatus         = FuKuanStatus,
                XiaDanBeiZhu         = XiaDanBeiZhu,
                YuDingRenName        = YuDingRenName,
                YuDingRenDianHua     = YuDingRenDianHua,
                YuDingRenShouJi      = YuDingRenShouJi,
                YuDingRenYouXiang    = YuDingRenYouXiang,
                IsXuYaoFaPiao        = IsXuYaoFaPiao,
                FaPiaoTaiTou         = FaPiaoTaiTou,
                FaPiaoLeiXing        = FaPiaoLeiXing,
                FaPiaoMingXi         = FaPiaoMingXi,
                FaPiaoPeiSongFangShi = FaPiaoPeiSongFangShi,
                FaPiaoDiZhiId        = FaPiaoDiZhiId,
                FaPiaoKuaiDiJinE     = FaPiaoKuaiDiJinE,
                XiaDanRenId          = XiaDanRenId
            };

            if (info.JinE <= 0 && info.JiFen <= 0)
            {
                str += "兑换积分产品数量小于1!</br>";
            }
            if (Sum < 1)
            {
                str += "兑换积分产品数量小于1!</br>";
            }
            if (info.IsXuYaoFaPiao && string.IsNullOrEmpty(info.FaPiaoDiZhiId))
            {
                str += "请选择配送地址!</br>";
            }

            if (!string.IsNullOrEmpty(str))
            {
                return(UtilsCommons.AjaxReturnJson("0", str));
            }

            decimal keYongJiFen = 0;
            var     huiYuanInfo = new EyouSoft.BLL.YlStructure.BHuiYuan().GetHuiYuanInfo(m.HuiYuanId);
            if (huiYuanInfo != null)
            {
                keYongJiFen = huiYuanInfo.KeYongJiFen;
            }

            if (keYongJiFen < info.JiFen)
            {
                return(UtilsCommons.AjaxReturnJson("0", "你的可用积分不足!"));
            }

            int bllRetCode = bll.InsertJiFenDingDan(info);

            if (bllRetCode == 1)
            {
                var tj = bll.GetJiFenDingDanInfo(info.DingDanId);
                return(UtilsCommons.AjaxReturnJson("1", "兑换成功", new { DingDanId = info.DingDanId, FangShi = (int)info.FangShi, JinE = info.JinE, FuKuanState = (int)tj.FuKuanStatus }));
            }
            else
            {
                return(UtilsCommons.AjaxReturnJson("0", "兑换失败"));
            }
        }