Beispiel #1
0
        /// <summary>
        /// 设置积分兑换订单状态,返回1成功,其它失败
        /// </summary>
        /// <param name="dingDanId">订单编号</param>
        /// <param name="operatorId">操作员编号</param>
        /// <param name="status">订单状态</param>
        /// <returns></returns>
        public int SheZhiJiFenDingDanStatus(string dingDanId, string operatorId, EyouSoft.Model.EnumType.YlStructure.JiFenDingDanStatus status)
        {
            DbCommand cmd = _db.GetStoredProcCommand("proc_YL_JiFenDingDan_SheZhiDingDanStatus");

            _db.AddInParameter(cmd, "@DingDanId", DbType.AnsiStringFixedLength, dingDanId);
            _db.AddInParameter(cmd, "@OperatorId", DbType.AnsiStringFixedLength, operatorId);
            _db.AddInParameter(cmd, "@DingDanStatus", DbType.Byte, status);
            _db.AddInParameter(cmd, "@IssueTime", DbType.DateTime, DateTime.Now);
            _db.AddOutParameter(cmd, "@RetCode", DbType.Int32, 4);

            int sqlExceptionCode = 0;

            try
            {
                DbHelper.RunProcedure(cmd, _db);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                sqlExceptionCode = 0 - e.Number;
            }

            if (sqlExceptionCode < 0)
            {
                return(sqlExceptionCode);
            }
            else
            {
                return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode")));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 设置积分兑换订单状态,返回1成功,其它失败
        /// </summary>
        /// <param name="dingDanId">订单编号</param>
        /// <param name="operatorId">操作员编号</param>
        /// <param name="status">订单状态</param>
        /// <returns></returns>
        public int SheZhiJiFenDingDanStatus(string dingDanId, string operatorId, EyouSoft.Model.EnumType.YlStructure.JiFenDingDanStatus status)
        {
            if (string.IsNullOrEmpty(dingDanId) ||
                string.IsNullOrEmpty(operatorId))
            {
                return(0);
            }

            int dalRetCode = dal.SheZhiJiFenDingDanStatus(dingDanId, operatorId, status);

            return(dalRetCode);
        }
Beispiel #3
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", "兑换失败"));
            }
        }