コード例 #1
0
        public ActionResult AddToCart()
        {
            PointCommodityAddToCartArgs args = RequestArgs <PointCommodityAddToCartArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.Domain = DomainContext.Domain.Id;
            args.AppId  = DomainContext.AppId;
            args.Member = MemberContext.Member.Id;

            NormalResult <PointCommodityShoppingCartOperateResult> result = _pointCommodityManager.AddToCart(args);

            return(RespondDataResult(result));
        }
コード例 #2
0
        /*
         * 关于订单支付
         * 如果订单只需要消费积分,则在提交订单时,直接扣减积分成单
         * 如果需要现金消费,则先不扣积分,在生成订单后,转到订单详情画面,用户确认支付成功时再作扣减
         * 如果账户余额足够且用户完全使用了账户余额,则扣减余额和积分,成单
         * 如果需要微信支付,则生成微信支付订单,在完成微信支付之后的回调中,再扣减积分、余额,成单
         * 如果微信支付回调时,积分或余额不足,则微信支付的钱转到账户余额
         */

        /// <summary>
        /// 购物车结算,提交订单
        /// CheckoutOrder
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateOrder()
        {
            PointCommodityCheckoutOrderArgs args = RequestArgs <PointCommodityCheckoutOrderArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.DomainId = DomainContext.Domain.Id;
            args.AppId    = DomainContext.AppId;
            args.MemberId = MemberContext.Member.Id;

            NormalResult <PointCommodityCheckoutOrderResult> result = _pointCommodityManager.CheckoutOrder(args);

            return(RespondDataResult(result));
        }
コード例 #3
0
        public ActionResult SetCartItemQuantity()
        {
            PointCommodityAddToCartArgs args = RequestArgs <PointCommodityAddToCartArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.Domain = DomainContext.Domain.Id;
            args.AppId  = DomainContext.AppId;
            args.Member = MemberContext.Member.Id;

            NormalResult result = _pointCommodityManager.SetCartItemQuantity(args);

            return(RespondDataResult(result));
        }
コード例 #4
0
        public ActionResult UpdateProduct()
        {
            Product_InfoDto args = RequestArgs <Product_InfoDto>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            args.summary = args.summary.Replace("\n", @"\r\n");

            Product_Info product = Mapper.Map <Product_Info>(args);

            NormalResult result = _productManager.UpdateProduct(product, args.catalog_idList, args.attribute_idList);

            return(ApiResult(result.Successful, result.Message));
        }
コード例 #5
0
        // TODO: 如何显示保存成功?注意 ChipDialog 可能会遮挡后面显示的文字
        private void _chipDialog_SaveTriggerd(object sender, EventArgs e)
        {
            string strError = "";

            string reader_name = GetCurrentReaderName();

            if (string.IsNullOrEmpty(reader_name))
            {
                strError = "尚未选定当前读卡器";
                goto ERROR1;
            }

            ChipDialog    dialog    = (ChipDialog)sender;
            LogicChipItem chip      = dialog.LogicChipItem;
            ItemInfo      item_info = FindItemInfo(chip, out ListViewItem item);

            if (item_info == null)
            {
                strError = "cant find item_info";
                goto ERROR1;
            }
            TagInfo new_tag_info = BuildNewTagInfo(
                item_info.OldInfo,
                chip);

            NormalResult result = _driver.WriteTagInfo(GetCurrentReaderName(), item_info.OldInfo, new_tag_info);

            if (result.Value == 0)
            {
                this.ShowMessage("保存成功", "green", true);
                _chipDialog.ShowMessage("保存成功", "green", true);

                Reload(dialog, false);
            }
            else
            {
                strError = $"保存失败:{result.ErrorInfo}";
                goto ERROR1;
            }

            return;

ERROR1:
            this.ShowMessage(strError, "red", true);
            _chipDialog.ShowMessage(strError, "red", true);
        }
コード例 #6
0
        public ActionResult Login()
        {
            MemberLoginArgs args = RequestArgs <MemberLoginArgs>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }
            args.password = IOHelper.GetMD5HashFromString(args.password);
            Member member = _memberManager.GetMemberByMobilePhoneAndPassword(args.mobilephone, args.password);

            if (member == null == false)
            {
                //TODO:初始化 memberDto
                MemberAppDto memberAppDto = Mapper.Map <Member, MemberAppDto>(member);

                memberAppDto.primaryDistributionCount = _memberManager.GetMemberDistributionCount(memberAppDto.id, null);
                memberAppDto.secondDistributionCount  = _memberManager.GetMemberDistributionCount(null, Convert.ToInt32(memberAppDto.superiorAgentId));
                MemberUserContext userContext = new MemberUserContext()
                {
                    LoginTime = DateTime.Now,
                    Token     = Guid.NewGuid().ToString(),
                    UserId    = member.id,
                    Member    = memberAppDto
                };
                NormalResult <MemberUserContext> result = new NormalResult <MemberUserContext>();
                result.Data = userContext;

                _cachingService.Set(userContext.Token, userContext);

                //一般返回结果不需要自己new AppApiResult,看 return ApiResult 这个方法的几个重载
                AppApiResult apiResult = new AppApiResult()
                {
                    result  = "success",
                    message = "登录成功",
                    token   = result.Data.Token,
                    data    = memberAppDto
                };
                return(ApiResult(apiResult));
            }
            else
            {
                return(FailedResult("手机号或密码无效。"));
            }
        }
コード例 #7
0
        public ActionResult ClosePayOrder()
        {
            string strOutTradeNo = Request.QueryString["outTradeNo"];

            if (String.IsNullOrEmpty(strOutTradeNo))
            {
                return(RespondResult(false, "参数无效。"));
            }

            NormalResult result = _payManager.ClosePayOrder(strOutTradeNo, DomainContext.AuthorizerPay);

            if (result.Success)
            {
                _payManager.RefreshPayOrder(strOutTradeNo, DomainContext.AuthorizerPay);
            }

            return(RespondResult(result.Success, result.Message));
        }
コード例 #8
0
        /// <summary>
        /// 处理积分商城支付结果
        /// 先把钱存到账户余额,然后再从余额中下帐成单
        /// 防止订单过期,状态不对等各种原因导致钱丢失
        /// </summary>
        /// <param name="payOrder"></param>
        /// <returns></returns>
        private NormalResult ProcessPointCommodityPayNotify(PayOrderEntity payOrder)
        {
            NormalResult result = ProcessPayNotify(payOrder);

            if (result.Success == false)
            {
                return(result);
            }

            result = PointCommodityManager.Instance.ProcessWeixinPayNotify(payOrder);

            if (result.Success)
            {
                FinishPayOrder(payOrder.Id);
            }

            return(result);
        }
コード例 #9
0
        public ActionResult Deposit()
        {
            CashAccountDepositArgs args = RequestArgs <CashAccountDepositArgs>();

            if (args == null || args.Fee <= 0)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.Fee = args.Fee * 100;

            args.MemberId       = MemberContext.Member.Id;
            args.OpenId         = MemberContext.Member.OpenId;
            args.SpbillCreateIp = Request.UserHostAddress;

            NormalResult <CreatePayOrderResult> depositResult =
                _payManager.Deposit(args, DomainContext.AuthorizerPay);

            if (depositResult.Success)
            {
                WxPayData jsApiParam = new WxPayData(DomainContext.AuthorizerPay.Key);
                jsApiParam.SetValue("appId", DomainContext.AppId);
                jsApiParam.SetValue("timeStamp", WeixinApiHelper.GetTimesTamp().ToString());
                jsApiParam.SetValue("nonceStr", WeixinApiHelper.GetNonceStr());
                jsApiParam.SetValue("package", "prepay_id=" + depositResult.Data.PrepayId);
                jsApiParam.SetValue("signType", "MD5");
                jsApiParam.SetValue("paySign", jsApiParam.MakeSign());

                string parameters = jsApiParam.ToJson();

                //WeixinPayGetBrandWCPayRequestArgs result = new WeixinPayGetBrandWCPayRequestArgs();
                //result.AppId = this.DomainContext.AppId;
                //result.TimeStamp = WeixinApiHelper.GetTimesTamp().ToString();
                //result.NonceStr = WeixinApiHelper.GetNonceStr();
                //result.Package = "prepay_id=" + depositResult.Data.PrepayId;
                //result.SignType = "MD5";

                return(RespondDataResult(parameters));
            }
            else
            {
                return(RespondResult(false, depositResult.Message));
            }
        }
コード例 #10
0
        /// <summary>
        /// 创建订单
        /// 如果订单中存在库存不足、已下架的商品
        /// 则整个订单都不下单
        /// 0 成功下单 1 积分不足 2 库存不足 3 已下架商品
        /// 默认在1小时后过期
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public NormalResult <PointCommodityCheckoutOrderResult> CheckoutOrder(PointCommodityCheckoutOrderArgs args)
        {
            NormalResult <PointCommodityCheckoutOrderResult> result =
                new NormalResult <PointCommodityCheckoutOrderResult>(false);

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domainId", args.DomainId));
            parameterList.Add(new CommandParameter("@appId", args.AppId));
            parameterList.Add(new CommandParameter("@memberId", args.MemberId));

            string xml = XMLHelper.XmlSerialize(args.ItemList);

            parameterList.Add(new CommandParameter("@itemList", xml));

            /*
             * <ArrayOfPointCommodity>
             * <PointCommodity>
             * <Id>61384bd7-18ff-4cfa-80e6-7278ae713e43</Id>
             * <Quantity>1</Quantity>
             * </PointCommodity>
             * <PointCommodity>
             * <Id>5a2606e4-92e3-479b-85a5-594685e87ff7</Id>
             * <Quantity>2</Quantity>
             * </PointCommodity>
             * </ArrayOfPointCommodity>
             */

            DataSet dsResult =
                _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "PointCommodityCreateOrder", parameterList,
                                         new string[] { "result" });

            result.Reason = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString());
            if (result.Reason == 0)
            {
                result.Success = true;

                result.Data             = new PointCommodityCheckoutOrderResult();
                result.Data.OrderNumber = dsResult.Tables[0].Rows[0]["OrderNumber"].ToString();
                result.Data.OrderId     = Guid.Parse(dsResult.Tables[0].Rows[0]["OrderId"].ToString());
            }
            return(result);
        }
コード例 #11
0
        /// <summary>
        /// 订单支付
        /// </summary>
        /// <returns></returns>
        public ActionResult OrderPay()
        {
            PointCommodityOrderPayArgs args = RequestArgs <PointCommodityOrderPayArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.DomainId       = DomainContext.Domain.Id;
            args.AppId          = DomainContext.AppId;
            args.MemberId       = MemberContext.Member.Id;
            args.OpenId         = MemberContext.Member.OpenId;
            args.SpbillCreateIp = Request.UserHostAddress;

            NormalResult <PointCommodityOrderPayResult> result = _pointCommodityManager.OrderPay(args, DomainContext.AuthorizerPay);

            return(RespondDataResult(result));
        }
コード例 #12
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <returns></returns>
        public ActionResult ChangePwd()
        {
            MemberChangePwdArgs args = RequestArgs <MemberChangePwdArgs>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            Member member = _memberManager.GetMemberByMobilePhoneAndPassword(args.mobilephone, IOHelper.GetMD5HashFromString(args.oldPwd));

            if (member == null)
            {
                return(FailedResult("手机号或密码不正确。"));
            }

            NormalResult result = _memberManager.UpdateMemberPassword(member.id, IOHelper.GetMD5HashFromString(args.newPwd));

            return(ApiResult(result.Successful, "修改密码成功。"));
        }
コード例 #13
0
        public NormalResult <UserContext> Login(string account, string password)
        {
            if (String.IsNullOrEmpty(account) || String.IsNullOrEmpty(password))
            {
                return(new NormalResult <UserContext>("用户名或密码无效。"));
            }

            User userObj = null;

            using (Entities db = new Entities())
            {
                userObj = db.User.FirstOrDefault(e => e.account == account && e.password == password);

                if (userObj == null)
                {
                    return(new NormalResult <UserContext>("用户名或密码无效。"));
                }

                if (userObj.available == false)
                {
                    return(new NormalResult <UserContext>("该用户账户已被删除。"));
                }

                userObj.lastLoginTime = DateTime.Now;
                db.SaveChanges();
            }

            UserContext userContext = new UserContext()
            {
                LoginTime = DateTime.Now,
                Token     = Guid.NewGuid().ToString(),
                UserId    = userObj.id
            };
            NormalResult <UserContext> result = new NormalResult <UserContext>();

            result.Data = userContext;

            _cachingService.Set <UserContext>(userContext.Token, userContext);

            return(result);
        }
コード例 #14
0
        // 将读卡器恢复为出厂状态,和数字平台预设的状态(不鸣叫,被动模式)
        private void MenuItem_resetReaderToDigitalPlatformState_Click(object sender, EventArgs e)
        {
            string strError = "";

            {
                DialogResult result = MessageBox.Show(this,
                                                      "确实要将全部读卡器恢复为初始状态?",
                                                      "MainForm",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button2);
                if (result != DialogResult.Yes)
                {
                    return;
                }
            }

            {
                NormalResult result = _driver.LoadFactoryDefault("*");
                if (result.Value == -1)
                {
                    strError = result.ErrorInfo;
                    goto ERROR1;
                }
            }

            {
                NormalResult result = _driver.SetConfig("*", "beep:-,mode:host");
                if (result.Value == -1)
                {
                    strError = result.ErrorInfo;
                    goto ERROR1;
                }
            }

            MessageBox.Show(this, "OK");
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #15
0
        /// <summary>
        /// 核销
        /// </summary>
        /// <returns></returns>
        public NormalResult Charge(CouponChargeArgs args)
        {
            NormalResult result = new NormalResult();

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domainId", args.Domain));
            parameterList.Add(new CommandParameter("@appId", args.AppId));
            parameterList.Add(new CommandParameter("@couponRecordId", args.CouponRecordId));
            parameterList.Add(new CommandParameter("@chargeUser", args.ChargeUser));
            parameterList.Add(new CommandParameter("@chargeIP", args.ChargeIP));

            DataSet dsResult =
                _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "CouponCharge", parameterList,
                                         new string[] { "result" });

            result.Reason  = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString());
            result.Success = result.Reason == 0;

            return(result);
        }
コード例 #16
0
        // GET: AppApi/Exchange
        //会员申请提点
        public ActionResult ConsumePoint()
        {
            PointExchangeAppDto args = RequestArgs <PointExchangeAppDto>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            if (UserContext.Member.status.Equals("2") == false)
            {
                return(FailedResult("账号未通过审核。"));
            }

            //判断是否有未结束的提点
            bool isExistNotFinishFlag = _pointManager.CheckExistNotFinishPointExchange(UserContext.UserId);

            if (isExistNotFinishFlag)
            {
                return(FailedResult("存在未结束提点。"));
            }


            //用户积分需要实时查询
            Member member = _memberManager.GetMember(UserContext.Member.id);

            Point_Exchange pointExchange = new Point_Exchange();

            pointExchange.member_id     = member.id;
            pointExchange.status        = 1;
            pointExchange.amount        = member.total_point.HasValue?member.total_point.Value:0;
            pointExchange.exchange_time = DateTime.Now;

            _pointManager.CreatePointExchange(pointExchange);


            NormalResult result = _pointManager.CreatePointExchange(pointExchange);

            return(ApiResult(result.Successful, "申请提点成功。", Mapper.Map <PointExchangeAppDto>(pointExchange)));
        }
コード例 #17
0
        /// <summary>
        /// 返回 0 成功 1 登录名被占用
        /// 在用户管理中更新用户信息,全面更新
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public NormalResult UpdateUser(UserEntity user)
        {
            NormalResult result = new NormalResult(false);

            if (user == null)
            {
                result.Message = "参数错误。";
                return(result);
            }

            lock (_lockUserObj)
            {
                List <CommandParameter> parameterList = new List <CommandParameter>();
                parameterList.Add(new CommandParameter("@id", user.Id));
                parameterList.Add(new CommandParameter("@account", user.Account));

                int accountCount = int.Parse(_dataBase.ExecuteScalar(
                                                 "SELECT Count(Id) FROM [User] WHERE [Account] = @account AND [Id] <> @id", parameterList).ToString());
                if (accountCount > 0)
                {
                    result.Reason = 1;
                    return(result);
                }

                SqlStructureBuild sqlBuild = new SqlStructureBuild();
                sqlBuild.Table = "User";
                sqlBuild.Type  = SqlExpressionType.Update;
                sqlBuild.AddParameter("Id", user.Id, true);
                sqlBuild.AddParameter("Account", user.Account);
                sqlBuild.AddParameter("Name", user.Name);
                sqlBuild.AddParameter("Email", user.Email);
                sqlBuild.AddParameter("Telphone", user.Telphone);
                sqlBuild.AddParameter("MemberId", user.MemberId);
                sqlBuild.AddParameter("Remark", user.Remark);
                _dataBase.ExcuteSqlExpression(sqlBuild.GetSqlExpression());
            }

            result.Success = true;
            return(result);
        }
コード例 #18
0
        int SaveNewChip(out string strError)
        {
            strError = "";

            RfidChannel channel = StartRfidChannel(
                Program.MainForm.RfidCenterUrl,
                out strError);

            if (channel == null)
            {
                strError = "StartRfidChannel() error";
                return(-1);
            }
            try
            {
                TagInfo new_tag_info = LogicChipItem.ToTagInfo(
                    _tagExisting.TagInfo,
                    this.chipEditor_editing.LogicChipItem);
                NormalResult result = channel.Object.WriteTagInfo(
                    _tagExisting.ReaderName,
                    _tagExisting.TagInfo,
                    new_tag_info);
                if (result.Value == -1)
                {
                    strError = result.ErrorInfo;
                    return(-1);
                }

                return(0);
            }
            catch (Exception ex)
            {
                strError = "SaveNewChip() 出现异常: " + ex.Message;
                return(-1);
            }
            finally
            {
                EndRfidChannel(channel);
            }
        }
コード例 #19
0
        public ActionResult Charge()
        {
            string strRecordIdId = Request.QueryString["recordId"];
            Guid   recordId      = Guid.Empty;

            if (String.IsNullOrEmpty(strRecordIdId) || Guid.TryParse(strRecordIdId, out recordId) == false)
            {
                return(RespondResult(false, "参数无效。"));
            }

            CouponChargeArgs args = new CouponChargeArgs();

            args.Domain         = DomainContext.Domain.Id;
            args.AppId          = DomainContext.AppId;
            args.CouponRecordId = recordId;
            args.ChargeUser     = MemberContext.User.Id;
            args.ChargeIP       = Request.UserHostAddress;

            NormalResult result = _couponManager.Charge(args);

            #region 操作日志

            if (result.Success)
            {
                _operatedLogManager.Create(new OperatedLogEntity()
                {
                    Domain      = DomainContext.Domain.Id,
                    AppId       = DomainContext.AppId,
                    User        = MemberContext.User.Id,
                    IP          = Request.UserHostAddress,
                    Module      = EnumModule.Coupon,
                    Description = "核销卡券"
                });
            }

            #endregion

            return(RespondDataResult(result));
        }
コード例 #20
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (DetectVirus.Detect360() || DetectVirus.DetectGuanjia())
            {
                MessageBox.Show("dp2SSL 被木马软件干扰,无法启动");
                System.Windows.Application.Current.Shutdown();
                return;
            }

            WpfClientInfo.TypeOfProgram = typeof(App);
            if (StringUtil.IsDevelopMode() == false)
            {
                WpfClientInfo.PrepareCatchException();
            }

            WpfClientInfo.Initial("dp2SSL");
            base.OnStartup(e);

            this._channelPool.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
            this._channelPool.AfterLogin  += new AfterLoginEventHandle(Channel_AfterLogin);

            // 后台自动检查更新
            Task.Run(() =>
            {
                NormalResult result = WpfClientInfo.InstallUpdateSync();
                if (result.Value == -1)
                {
                    OutputHistory("自动更新出错: " + result.ErrorInfo, 2);
                }
                else if (result.Value == 1)
                {
                    OutputHistory(result.ErrorInfo, 1);
                }
                else if (string.IsNullOrEmpty(result.ErrorInfo) == false)
                {
                    OutputHistory(result.ErrorInfo, 0);
                }
            });
        }
コード例 #21
0
        /// <summary>
        /// 最终买单
        /// 走到这里表示不需要微信支付,或微信支付已经完成并到帐
        /// 0 支付成功 1 积分不足 2 账户余额不足 4 订单状态不是待支付 5 订单已经过期 6 订单不存在
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        private NormalResult Checkout(PointCommodityOrderEntity order)
        {
            NormalResult result = new NormalResult(false);

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@orderId", order.Id));

            DataSet dsResult =
                _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "PointCommodityCheckoutOrder", parameterList, new string[] { "result" });

            result.Reason = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString());

            InsertOrderLog(order, result.Reason);

            if (result.Reason == 0)
            {
                result.Success = true;
            }

            return(result);
        }
コード例 #22
0
        public NormalResult ClosePayOrder(string outTradeNo, AuthorizerPayConfig config)
        {
            NormalResult result = new NormalResult();

            if (config == null)
            {
                result.Success = false;
                result.Message = "当前公众号没有微信支付所需配置信息。";
                return(result);
            }

            WeixinPayCloseOrderArgs closeOrderArgs = new WeixinPayCloseOrderArgs();

            closeOrderArgs.AppId      = config.AppId;
            closeOrderArgs.MchId      = config.MchId;
            closeOrderArgs.OutTradeNo = outTradeNo;

            WxPayArgs wxPayArgs = config.GetWxPayArgs(false);

            RequestPayApiResult <WeixinPayCloseOrderResult> closeOrderResult =
                WxPayApi.CloseOrder(closeOrderArgs, wxPayArgs);

            if (closeOrderResult.Success == false)
            {
                _log.Write("CloseOrder 失败",
                           closeOrderResult.Message + "\r\n"
                           + JsonHelper.Serializer(closeOrderArgs) + " "
                           + JsonHelper.Serializer(closeOrderResult),
                           TraceEventType.Warning);

                result.Success = false;
                result.Message = closeOrderResult.Message;
                return(result);
            }

            result.Success = true;
            return(result);
        }
コード例 #23
0
        /// <summary>
        /// 设置购物车中指定商品的数量
        /// </summary>
        /// <returns></returns>
        public NormalResult SetCartItemQuantity(PointCommodityAddToCartArgs args)
        {
            NormalResult result = new NormalResult();

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domainId", args.Domain));
            parameterList.Add(new CommandParameter("@appId", args.AppId));
            parameterList.Add(new CommandParameter("@memberId", args.Member));
            parameterList.Add(new CommandParameter("@pointCommodity", args.PointCommodity));
            parameterList.Add(new CommandParameter("@quantity", args.Quantity));

            DataSet dsResult =
                _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "SetPointCommodityCartItemQuantity", parameterList,
                                         new string[] { "result" });

            result.Reason = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString());
            if (result.Reason == 0)
            {
                result.Success = true;
            }
            return(result);
        }
コード例 #24
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            FaceManager.Base.Name = "人脸中心";
            FaceManager.Url       = "ipc://FaceChannel/FaceServer";
            FaceManager.SetError += FaceManager_SetError;;
            FaceManager.Start(_cancelRefresh.Token);

            InterceptMouse.MouseClick += InterceptMouse_MouseClick;

            SetWindowPos(_position);

            // 后台自动检查更新
            var task = Task.Run(() =>
            {
                try
                {
                    NormalResult result = WpfClientInfo.InstallUpdateSync();
                    if (result.Value == -1)
                    {
                        SetError("update", "自动更新出错: " + result.ErrorInfo);
                    }
                    else if (result.Value == 1)
                    {
                        SetError("update", result.ErrorInfo);
                        // Updated?.Invoke(this, new UpdatedEventArgs { Message = result.ErrorInfo });
                    }
                    else if (string.IsNullOrEmpty(result.ErrorInfo) == false)
                    {
                        SetError("update", result.ErrorInfo);
                    }
                }
                catch (Exception ex)
                {
                    WpfClientInfo.WriteErrorLog($"自动后台更新出现异常: {ExceptionUtil.GetDebugText(ex)}");
                }
            });
        }
コード例 #25
0
        public ActionResult PayNotify()
        {
            string postString;

            using (Stream stream = HttpContext.Request.InputStream)
            {
                Byte[] postBytes = new Byte[stream.Length];
                stream.Read(postBytes, 0, (int)stream.Length);
                postString = Encoding.UTF8.GetString(postBytes);
            }

            _log.Write("收到支付结果通知", postString, TraceEventType.Verbose);

            NormalResult normalResult = _payManager.Notify(postString, DomainContext.AuthorizerPay);

            string isSuccess;

            if (normalResult.Success)
            {
                isSuccess = "SUCCESS";
            }
            else
            {
                isSuccess = "FAIL";
            }

            string resultContent =
                String.Format("<xml><return_code><![CDATA[{0}]]></return_code><return_msg><![CDATA[{1}]]></return_msg></xml>",
                              isSuccess, normalResult.Message);

            _log.Write("支付结果通知返回", resultContent, TraceEventType.Verbose);

            return(new ContentResult()
            {
                Content = resultContent
            });
        }
コード例 #26
0
        /// <summary>
        /// 会员开户
        /// </summary>
        /// <returns></returns>
        public ActionResult Register()
        {
            MemberRegisterArgs args = RequestArgs <MemberRegisterArgs>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            Member member = new Member();

            member.name              = args.userName;
            member.wechat_no         = args.wechatNo;
            member.phone_num         = args.mobilephone;
            member.superior_agent_id = this.UserContext.UserId;
            member.status            = 1;
            member.type              = 3;

            NormalResult result = _memberManager.CreateMember(member);

            if (result.Successful)
            {
                //发短信
                Yuntongxun.SendTemplateSMS(args.mobilephone, "197936", new string[] { "18994422279" });

                //新用户注册等待审核
                Yuntongxun.SendTemplateSMS("18994422239", "241364",
                                           new string[] { member.phone_num, _memberManager.GetMemberCount(1).ToString() });


                return(ApiResult(true, "申请开户成功"));
            }
            else
            {
                return(FailedResult(result.Message));
            }
        }
コード例 #27
0
        public NormalResult RemoveMemberTag(DomainContext domainContext, Guid id)
        {
            NormalResult result = new NormalResult(false);

            MemberTagEntity memberTag = GetMemberTag(id);

            if (memberTag == null)
            {
                result.Message = "分组不存在。";
                return(result);
            }

            //先往微信后台更新,成功后写数据库
            RequestApiResult removeResult = TagsApiWrapper.Remove(domainContext, memberTag.TagId);

            if (removeResult.Success == false)
            {
                result.Message = removeResult.Message;
                return(result);
            }

            //移除此标签下的用户的这个标签
            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domain", domainContext.Domain.Id));
            parameterList.Add(new CommandParameter("@appId", domainContext.AppId));
            parameterList.Add(new CommandParameter("@tagId", memberTag.TagId.ToString() + ","));

            _dataBase.ExecuteNonQuery(
                "UPDATE [Member] SET [TagList] =  REPLACE([TagList],@tagId,'') WHERE [Domain] = @domain AND [AppId] = @appId AND CHARINDEX(@tagId,[TagList]) > 0",
                parameterList);

            _dataBase.Remove(memberTag);

            result.Success = true;
            return(result);
        }
コード例 #28
0
        public ActionResult RegisterNoSuper()
        {
            MemberRegisterArgs args = RequestArgs <MemberRegisterArgs>();

            if (args == null)
            {
                return(FailedResult("参数无效。"));
            }

            Member member = new Member();

            member.phone_num = args.mobilephone;
            member.wechat_no = args.wechatNo;
            member.password  = IOHelper.GetMD5HashFromString(args.password);
            member.status    = 1;
            member.type      = 3;

            NormalResult result = _memberManager.CreateMember(member);

            if (result.Successful)
            {
                //注册使用模版
                Yuntongxun.SendTemplateSMS(args.mobilephone, "197936", new string[] { "18994422279" });

                //新用户注册等待审核
                Yuntongxun.SendTemplateSMS("18994422239", "241364",
                                           new string[] { member.phone_num, _memberManager.GetMemberCount(1).ToString() });


                return(ApiResult(true, "申请开户成功", Mapper.Map <MemberAppDto>(member)));
            }
            else
            {
                return(FailedResult(result.Message));
            }
        }
コード例 #29
0
        public ActionResult Distribute()
        {
            CouponDistributeArgs args = RequestArgs <CouponDistributeArgs>();

            if (args == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            args.DomainId       = UserContext.User.Domain;
            args.AppId          = DomainContext.AppId;
            args.DistributeUser = UserContext.User.Id;
            args.DistributeIP   = Request.UserHostAddress;
            if (args.LimitedTime.HasValue)
            {
                args.LimitedTime = args.LimitedTime.Value.Add(new TimeSpan(23, 59, 59));
            }

            NormalResult result = _couponManager.Distribute(args);

            #region 操作日志

            _operatedLogManager.Create(new OperatedLogEntity()
            {
                Domain      = DomainContext.Domain.Id,
                AppId       = DomainContext.AppId,
                User        = UserContext.User.Id,
                IP          = Request.UserHostAddress,
                Module      = EnumModule.Coupon,
                Description = "派发卡券"
            });

            #endregion

            return(RespondDataResult(result));
        }
コード例 #30
0
        /// <summary>
        /// 派发
        /// 0 分发成功 1 域或APPID不对应 2 库存不足 3 卡券已删除 4 卡券不存在 5 派发张数无效
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public NormalResult Distribute(CouponDistributeArgs args)
        {
            NormalResult result = new NormalResult();

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domainId", args.DomainId));
            parameterList.Add(new CommandParameter("@appId", args.AppId));
            parameterList.Add(new CommandParameter("@couponId", args.CouponId));
            parameterList.Add(new CommandParameter("@memberId", args.MemberId));
            parameterList.Add(new CommandParameter("@distributeUser", args.DistributeUser));
            parameterList.Add(new CommandParameter("@limitedTime", args.LimitedTime));
            parameterList.Add(new CommandParameter("@distributeIP", args.DistributeIP));
            parameterList.Add(new CommandParameter("@count", args.Count));

            DataSet dsResult =
                _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "CouponDistribute", parameterList,
                                         new string[] { "result" });

            result.Reason  = int.Parse(dsResult.Tables[0].Rows[0]["Result"].ToString());
            result.Success = result.Reason == 0;

            return(result);
        }