Exemplo n.º 1
0
        /// <summary>
        /// 获取用户的数据权限
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List <long?> GetDepartmentUsers(long UserID)
        {
            List <long?> list = new List <long?>();

            IUserService userService = DIFactory.GetContainer().Resolve <IUserService>();

            var user = userService.Get(t => t.ID == UserID);

            if (user != null)
            {
                if (user.IsMore > 0)
                {
                    var DepartmentArray = user.AuthDepartmentIDs.ToLongList();
                    foreach (var m in DepartmentArray)
                    {
                        var users = userService.Gets(t => t.DepartmentID == m).Select(t => t.ID).ToList();

                        foreach (var c in users)
                        {
                            list.Add(c);
                        }

                        if (m == null)
                        {
                            list.Add(m);
                        }
                    }
                }
                else
                {
                    list.Add(user.ID);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public static LoginResult UserLogin(this HttpContextBase context, string name = "", string pwd = "",
                                            string verify = "")
        {
            if (string.IsNullOrEmpty(verify) || context.Session["CheckCode"] == null || !context.Session["CheckCode"].ToString().Equals(verify))
            {
                return(LoginResult.WrongVerify);
            }
            var service = DIFactory.GetContainer().Resolve <IUserMenuService>();
            var user    = service.UserLogin(name);

            if (user == null)
            {
                return(LoginResult.NoUser);
            }
            else if (!user.Password.Equals(MD5Encrypt.Encrypt(pwd)))
            {
                return(LoginResult.WrongPwd);
            }
            else if (user.State == (int)UserState.Frozen)
            {
                return(LoginResult.Frozen);
            }
            else
            {
                return(LoginResult.Success);
            }
        }
Exemplo n.º 3
0
        //获取拥有的权限
        private List <ActionModel> GetAction(Employee user)
        {
            IEmployeeMenuActionService iMenuActionService = DIFactory.GetContainer().Resolve <IEmployeeMenuActionService>();

            List <EmployeeMenuAction> menuActionlist = new List <EmployeeMenuAction>();

            List <ActionModel> actionList = new List <ActionModel>();

            if (user.IsAdmin == 0)
            {
                menuActionlist = iMenuActionService.Gets(t => user.MenuActionList.Contains(t.ID)).ToList();
            }
            else
            {
                menuActionlist = iMenuActionService.Gets().ToList();
            }

            foreach (var m in menuActionlist)
            {
                actionList.Add(new ActionModel()
                {
                    Controller = m.EmployeeMenu.Controller.ToLower(),
                    Action     = m.Code.ToLower(),
                });
            }

            return(actionList);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 收银宝订单支付成功后续处理
        /// </summary>
        /// <param name="posOrderQueryResponse"></param>
        /// <param name="orderPaid"></param>
        public void VspOrderHandle(POSOrderQueryResponse posOrderQueryResponse, OrderPaid orderPaid)
        {
            var iPingAnOrderPaidService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidService>();

            if (orderPaid.Merchant.AccountBank == AccountBankOption.PingAn.ToInt())
            {
                if (orderPaid.Status == OrderPaidStatusOption.Default.ToInt())
                {
                    orderPaid.Status = OrderPaidStatusOption.PaySuccess.ToInt();

                    orderPaid.PingAnOrderPaid.POSBaoSerialNumber = posOrderQueryResponse.trxid;

                    iPingAnOrderPaidService.Save(orderPaid.PingAnOrderPaid);
                    Save(orderPaid);

                    Commit();
                }

                //订单支付成功---调代付(代付成功,代付失败,代付中),当代付成功将信息记录到代付表,并更新主订单金额
                PingAnTltSingleOntimePay(orderPaid);
            }
            else if (orderPaid.Merchant.AccountBank == AccountBankOption.GuangDa.ToInt())
            {
                if (orderPaid.Status == OrderPaidStatusOption.Default.ToInt())
                {
                    orderPaid.Status = OrderPaidStatusOption.PaySuccess.ToInt();

                    Save(orderPaid);

                    Commit();
                }

                RechargeAndFreeze(orderPaid);
            }
        }
Exemplo n.º 5
0
        public static string UserRegister(string name, string pwd)
        {
            IUserAccountService service = DIFactory.GetContainer().Resolve <IUserAccountService>();
            UserAccount         user    = service.UserLogin(name);

            if (user != null)
            {
                return("该账号已经被注册");
            }
            else
            {
                var model = new UserAccount()
                {
                    Name       = name,
                    Password   = MD5Encrypt.Encrypt(pwd),
                    Account    = name,
                    CreatorId  = 1,
                    CreateTime = DateTime.Now,
                    UserType   = 1,
                    State      = 1,
                };
                var result = service.InsertUser(model);
                if (result != null)
                {
                    return("成功");
                }
                return("失败");
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 同步状态--光大
        /// </summary>
        /// <param name="orderPaid"></param>
        public void SyncStatus(OrderPaid orderPaid)
        {
            var iGuangDaAPIService        = DIFactory.GetContainer().Resolve <IGuangDaAPIService>();
            var iOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IOrderPaidRechargeService>();
            var iOrderPaidWithdrawService = DIFactory.GetContainer().Resolve <IOrderPaidWithdrawService>();

            //if (orderPaid.Status == OrderPaidStatusOption.PaySuccess.ToInt())
            //{
            //    RechargeAndFreeze(orderPaid);
            //}
            if (orderPaid.Status == OrderPaidStatusOption.RechargeWait.ToInt())
            {
                var orderPaidRecharge = iOrderPaidRechargeService.GetLast(t => t.OrderPaidID == orderPaid.ID);

                //查询充值或提现状态
                var response = iGuangDaAPIService.BTrsVeriAmount(orderPaidRecharge.SerialNumber, orderPaidRecharge.CreateDatetime);

                if (response?.Body?.TrsState == "0")
                {
                    RechargeSuccess(orderPaidRecharge, "", DateTime.Now);
                }
                else if (response?.Body?.TrsState == "1")
                {
                    RechargeFail(orderPaidRecharge);
                }
                else if (response.IsNotExists && DateTime.Now > orderPaidRecharge.CreateDatetime.AddMinutes(5))
                {
                    RechargeFail(orderPaidRecharge);
                }
            }
            //else if (orderPaid.Status == OrderPaidStatusOption.RechargeSuccess.ToInt())
            //{
            //    Freeze(orderPaid);
            //}
            //else if (orderPaid.Status == OrderPaidStatusOption.UnFrozenSuccess.ToInt())
            //{
            //    Withdraw(orderPaid);
            //}
            else if (orderPaid.Status == OrderPaidStatusOption.WithdrawWait.ToInt())
            {
                var orderPaidWithdraw = iOrderPaidWithdrawService.GetLast(t => t.OrderPaidID == orderPaid.ID);

                //查询充值或提现状态
                var response = iGuangDaAPIService.BTrsVeriAmount(orderPaidWithdraw.SerialNumber, orderPaidWithdraw.CreateDatetime);

                if (response?.Body?.TrsState == "0")
                {
                    WithdrawSuccess(orderPaidWithdraw);
                }
                else if (response?.Head?.ResCode == "000357" || response?.Body?.TrsState == "1")
                {
                    WithdrawFail(orderPaidWithdraw);
                }
                else if (response.IsNotExists && DateTime.Now > orderPaidWithdraw.CreateDatetime.AddMonths(5))
                {
                    WithdrawFail(orderPaidWithdraw);
                }
            }
        }
Exemplo n.º 7
0
        public override void Init()
        {
            var iEmployeeMenuActionService = DIFactory.GetContainer().Resolve <IEmployeeMenuActionService>();
            var iEmployeeMenuService       = DIFactory.GetContainer().Resolve <IEmployeeMenuService>();

            iEmployeeMenuActionService.SetCache();
            iEmployeeMenuService.SetCache();
        }
Exemplo n.º 8
0
        public void Freeze(OrderPaid orderPaid)
        {
            if (orderPaid.Status != OrderPaidStatusOption.RechargeSuccess.ToInt())
            {
                throw new Exception("当前状态不可冻结(" + orderPaid.StatusDesc + ")");
            }


            var iOrderPaidFreezeService = DIFactory.GetContainer().Resolve <IOrderPaidFreezeService>();
            var iGuangDaAPIService      = DIFactory.GetContainer().Resolve <IGuangDaAPIService>();
            //var iOrderPaidService = DIFactory.GetContainer().Resolve<IOrderPaidService>();

            OrderPaidFreeze orderPaidFreeze = new OrderPaidFreeze();

            orderPaidFreeze.OrderPaid    = orderPaid;
            orderPaidFreeze.Amount       = orderPaid.TransactionAmount;
            orderPaidFreeze.UnFreezeDate = DateTime.Now.AddMonths(orderPaid.Project.GuaranteeMonth);

            iOrderPaidFreezeService.Save(orderPaidFreeze);
            iOrderPaidFreezeService.Commit();

            var freezeResponse = iGuangDaAPIService.Freeze(orderPaidFreeze);

            orderPaidFreeze.ResponseCode    = freezeResponse.Head.ResCode;
            orderPaidFreeze.ResponseMessage = freezeResponse.Head.ResMsg;

            if (freezeResponse.IsOK && freezeResponse.Body?.FreezeState == "S")
            {
                FreezeSuccess(orderPaidFreeze, freezeResponse.Body.Balance);

                Commit();
            }
            else if (freezeResponse.IsWait || freezeResponse.Body?.FreezeState == "U")
            {
                //orderPaid.Status = OrderPaidStatusOption.FrozenWait.ToInt();
                //Save(orderPaid);

                //orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Wait.ToInt();
                //iOrderPaidFreezeService.Save(orderPaidFreeze);

                //当失败处理
                orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Fail.ToInt();
                iOrderPaidFreezeService.Save(orderPaidFreeze);

                Commit();

                throw new APIException("冻结失败中:" + freezeResponse.Head.ResMsg);
            }
            else if (freezeResponse.IsFail || freezeResponse.Body?.FreezeState == "F")
            {
                orderPaidFreeze.Status = OrderPaidFreezeStatusOption.Fail.ToInt();
                iOrderPaidFreezeService.Save(orderPaidFreeze);

                Commit();

                throw new APIException("冻结失败:" + freezeResponse.Head.ResMsg);
            }
        }
Exemplo n.º 9
0
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            this.logger.Warn($"{controllerType?.Name}被构造...");

            IUnityContainer container = DIFactory.GetContainer();

            //return base.GetControllerInstance(requestContext, controllerType);
            return((IController)container.Resolve(controllerType));
        }
Exemplo n.º 10
0
        private void TltSingleOntimePayFail(PingAnOrderPaidRecharge pingAnOrderPaidRecharge)
        {
            var iPingAnOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidRechargeService>();

            pingAnOrderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.SingleOntimePayFail.ToInt();

            pingAnOrderPaidRecharge.Status = PingAnOrderPaidRechargeStatusOption.SingleOntimePayFailed.ToInt();
            iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);
        }
Exemplo n.º 11
0
        private void RechargeFail(OrderPaidRecharge orderPaidRecharge)
        {
            var iOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IOrderPaidRechargeService>();

            orderPaidRecharge.Status = OrderPaidRechargeStatusOption.Fail.ToInt();
            iOrderPaidRechargeService.Save(orderPaidRecharge);

            //orderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.Cancel.ToInt();
            //Save(orderPaidRecharge.OrderPaid);
        }
Exemplo n.º 12
0
        public ActionResult Search()
        {
            var result = this._iSearchService.QueryCommodityPage(1, 20, "女人", null, "", "");


            ISearchService searchService1 = DIFactory.GetContainer().Resolve <ISearchService>();
            ISearchService searchService2 = DIFactory.GetContainer().Resolve <ISearchService>("update");

            return(View(result));
        }
Exemplo n.º 13
0
        /// <summary>
        /// 平安订单解止付(查询平安订单状态并判断--解止付)
        /// </summary>
        /// <param name="orderPaid"></param>
        private void PingAnUnFreeze(OrderPaid orderPaid)
        {
            var iPingAnAPIService               = DIFactory.GetContainer().Resolve <IPingAnAPIService>();
            var iOrderPaidService               = DIFactory.GetContainer().Resolve <IOrderPaidService>();
            var iPingAnOrderPaidService         = DIFactory.GetContainer().Resolve <IPingAnOrderPaidService>();
            var iPingAnOrderPaidUnFreezeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidUnFreezeService>();

            PingAnOrderPaidUnFreeze pingAnOrderPaidUnFreeze = new PingAnOrderPaidUnFreeze();

            pingAnOrderPaidUnFreeze.OrderPaid = orderPaid;
            pingAnOrderPaidUnFreeze.Amount    = orderPaid.TransactionAmount;

            iPingAnOrderPaidUnFreezeService.Save(pingAnOrderPaidUnFreeze);
            iPingAnOrderPaidUnFreezeService.Commit();

            var orderDetailResponse = QueryPingAnMarginsOrderDetail(orderPaid.PingAnOrderPaid.BankOrderNo);

            if (orderDetailResponse.IsOK)
            {
                if (orderDetailResponse.dataObject.marginsOrderInfoList != null)
                {
                    if (orderDetailResponse.dataObject.marginsOrderInfoList.FirstOrDefault().transStatus == PingAnOrderPaidStatusOption.FrozenSuccess.ToInt().ToString())
                    {
                        var response = iPingAnAPIService.UnFreezeMarginsOrder(orderPaid);

                        pingAnOrderPaidUnFreeze.ResponseCode    = response.responseCode;
                        pingAnOrderPaidUnFreeze.ResponseMessage = response.responseMsg;

                        if (response.IsOK)
                        {
                            PingAnUnFreezeSuccess(pingAnOrderPaidUnFreeze);

                            Commit();
                        }
                        else
                        {
                            pingAnOrderPaidUnFreeze.Status = PingAnOrderPaidUnFreezeStatusOption.Fail.ToInt();
                            iPingAnOrderPaidUnFreezeService.Save(pingAnOrderPaidUnFreeze);

                            Commit();

                            throw new APIException("解止付失败:" + response.responseMsg);
                        }
                    }
                    else
                    {
                        throw new APIException("订单状态" + ((PingAnOrderPaidStatusOption)Convert.ToInt32(orderDetailResponse.dataObject.marginsOrderInfoList.FirstOrDefault().transStatus)).ToDescription() + "不可操作");
                    }
                }
            }
            else
            {
                throw new APIException("查询失败:" + orderDetailResponse.responseMsg);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 平安端:单个订单信息查询
        /// </summary>
        /// <param name="BankOrderNo"></param>
        /// <returns></returns>
        private QueryBatchMarginsOrderDetialResponse QueryPingAnMarginsOrderDetail(string BankOrderNo)
        {
            var iPingAnAPIService = DIFactory.GetContainer().Resolve <IPingAnAPIService>();

            QueryPingAnMarginsOrderListRequest request = new QueryPingAnMarginsOrderListRequest();

            request.bankorderno = BankOrderNo;
            var orderDetailResponse = iPingAnAPIService.QueryBatchMarginsOrderDetial(request);

            return(orderDetailResponse as QueryBatchMarginsOrderDetialResponse);
        }
Exemplo n.º 15
0
        private void WithdrawFail(OrderPaidWithdraw orderPaidWithdraw)
        {
            var iOrderPaidWithdrawService = DIFactory.GetContainer().Resolve <IOrderPaidWithdrawService>();

            orderPaidWithdraw.Status = OrderPaidWithdrawStatusOption.Fail.ToInt();
            iOrderPaidWithdrawService.Save(orderPaidWithdraw);


            orderPaidWithdraw.OrderPaid.Status = OrderPaidStatusOption.UnFrozenSuccess.ToInt();
            Save(orderPaidWithdraw.OrderPaid);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 0成功 1用户不存在 2密码错误 3 验证码错误 4账号已冻结
        /// </summary>
        /// <param name="context"></param>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <param name="verify"></param>
        /// <returns></returns>
        public static LoginResult UserLogin(this HttpContextBase context, string name = "", string pwd = "", string verify = "")
        {
            if (string.IsNullOrEmpty(verify) || context.Session["CheckCode"] == null || !context.Session["CheckCode"].ToString().Equals(verify, StringComparison.OrdinalIgnoreCase))
            {
                return(LoginResult.WrongVerify);
            }
            IUserService service = DIFactory.GetContainer().Resolve <IUserService>();
            Base_User    user    = service.getUserInfoByUserName(name);

            if (user == null)
            {
                return(LoginResult.NoUser);
            }
            else if (!user.Password.Equals(MD5Encrypt.Encrypt(pwd)))
            {
                return(LoginResult.WrongPwd);
            }
            else if (user.State == (int)UserState.Frozen)
            {
                return(LoginResult.Frozen);
            }
            else
            {
                #region Cookie
                CurrentUser currentUser = new CurrentUser()
                {
                    Id          = user.Id,
                    Name        = user.UserName,
                    Account     = user.UserId,
                    PhoneNumber = user.PhoneNumber,
                    Password    = user.Password,
                    LoginTime   = DateTime.Now
                };
                HttpCookie myCookie = new HttpCookie("CurrentUser");
                myCookie.Value   = JsonHelper.ObjectToString <CurrentUser>(currentUser);
                myCookie.Expires = DateTime.Now.AddMinutes(5);
                context.Response.Cookies.Add(myCookie);
                #endregion Cookie

                #region Session
                //context.Session.RemoveAll();
                var sessionUser = context.Session["CurrentUser"];

                context.Session["CurrentUser"] = currentUser;
                context.Session.Timeout        = 3;//minute  session过期等于Abandon
                #endregion Session


                logger.Debug(string.Format("用户id={0} Name={1}登录系统", currentUser.Id, currentUser.Name));

                return(LoginResult.Success);
            }
        }
Exemplo n.º 17
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ControllerBuilder.Current.SetControllerFactory(new UnityControllerFactory());//控制器的实例化走UnityControllerFactory

            var iAutoExecService = DIFactory.GetContainer().Resolve <IEmployeeMenuActionService>();

            JobManager.Initialize(new Controllers.AutoExec());
        }
Exemplo n.º 18
0
        private void UnFreezeSuccess(OrderPaidUnFreeze orderPaidUnFreeze)
        {
            var iOrderPaidUnFreezeService = DIFactory.GetContainer().Resolve <IOrderPaidUnFreezeService>();
            var iMemberService            = DIFactory.GetContainer().Resolve <IMemberService>();

            orderPaidUnFreeze.OrderPaid.Status = OrderPaidStatusOption.UnFrozenSuccess.ToInt();
            Save(orderPaidUnFreeze.OrderPaid);

            orderPaidUnFreeze.Status    = OrderPaidUnFreezeStatusOption.Success.ToInt();
            orderPaidUnFreeze.TransTime = DateTime.Now;
            iOrderPaidUnFreezeService.Save(orderPaidUnFreeze);

            iMemberService.BalanceChange(orderPaidUnFreeze.OrderPaid.Member, orderPaidUnFreeze.Amount, MemberBalanceHistoryTypeOption.UnFreeze, (AccountBankOption)orderPaidUnFreeze.OrderPaid.Merchant.AccountBank, orderPaidUnFreeze.Amount * -1, remark: orderPaidUnFreeze.SerialNumber);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 解止付平安保证金订单
        /// </summary>
        /// <param name="orderPaid"></param>
        public void UnFreezePingAnMargins(OrderPaid orderPaid)
        {
            var iPingAnAPIService = DIFactory.GetContainer().Resolve <IPingAnAPIService>();
            var iOrderPaidService = DIFactory.GetContainer().Resolve <IOrderPaidService>();

            if (orderPaid.Status == OrderPaidStatusOption.FrozenSuccess.ToInt())
            {
                PingAnUnFreeze(orderPaid);
            }
            else
            {
                throw new APIException("当前状态(" + orderPaid.StatusDesc + ")无法操作");
            }
        }
Exemplo n.º 20
0
        public void Init(string url, string TltMerchantId, string userName, string userPassword, string privateKeyPassword)
        {
            var iTLTPreferencesService = DIFactory.GetContainer().Resolve <ITLTPreferencesService>();

            var TLTPreferences = iTLTPreferencesService.Get(t => t.TltMerchantId == TltMerchantId);

            if (TLTPreferences == null)
            {
                throw new APIException(PingAnExceptionOption.NotSetTLTParam);
            }

            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory.Remove(AppDomain.CurrentDomain.BaseDirectory.LastIndexOf("\\"), 1);

            tltExec = new TltExec(url, TltMerchantId, userName, userPassword, privateKeyPassword, baseDirectory + TLTPreferences.TLTPrivateKeyCer, baseDirectory + TLTPreferences.TLTSecurityCer);
        }
Exemplo n.º 21
0
        public static LoginResult UserLogin(this HttpContextBase context, string name = "", string pwd = "", string verify = "")
        {
            if (string.IsNullOrEmpty(verify) || context.Session["VerfyCode"] == null || !context.Session["VerfyCode"].ToString().Equals(verify, StringComparison.OrdinalIgnoreCase))
            {
                return(LoginResult.WrongVerify);
            }

            IUserMenuService service = DIFactory.GetContainer().Resolve <IUserMenuService>();
            User             user    = service.UserLogin(name);

            if (user == null)
            {
                return(LoginResult.NoUser);
            }
            else if (!user.Password.Equals(MD5Encrypt.Encrypt(pwd)))
            {
                return(LoginResult.WrongPwd);
            }
            else if (user.State == (int)UserState.Frozen)
            {
                return(LoginResult.Frozen);
            }
            else
            {
                CurrentUser currentUser = new CurrentUser
                {
                    Id        = user.Id,
                    Name      = user.Name,
                    Account   = user.Account,
                    Email     = user.Email,
                    Password  = user.Password,
                    LoginTime = DateTime.Now
                };
                #region cookie
                HttpCookie userCookie = new HttpCookie("CurrentUser");
                userCookie.Value   = JsonHelper.ObjectToString <CurrentUser>(currentUser);
                userCookie.Expires = DateTime.Now.AddMinutes(5);
                context.Response.Cookies.Add(userCookie);
                #endregion
                #region session
                context.Session["CurrentUser"] = currentUser;
                context.Session.Timeout        = 3;//minute  session过期等于Abandon
                #endregion
                service.UserLastLogin(user);
                return(LoginResult.Success);
            }
        }
Exemplo n.º 22
0
        private void UnFreeze(OrderPaid orderPaid)
        {
            //var iOrderPaidService = DIFactory.GetContainer().Resolve<IOrderPaidService>();
            var iOrderPaidUnFreezeService = DIFactory.GetContainer().Resolve <IOrderPaidUnFreezeService>();
            var iGuangDaAPIService        = DIFactory.GetContainer().Resolve <IGuangDaAPIService>();

            OrderPaidUnFreeze orderPaidUnFreeze = new OrderPaidUnFreeze();

            orderPaidUnFreeze.OrderPaid = orderPaid;
            orderPaidUnFreeze.Amount    = orderPaid.TransactionAmount;

            iOrderPaidUnFreezeService.Save(orderPaidUnFreeze);
            iOrderPaidUnFreezeService.Commit();

            var unFreezeResponse = iGuangDaAPIService.Unfreeze(orderPaidUnFreeze);

            orderPaidUnFreeze.ResponseCode    = unFreezeResponse.Head.ResCode;
            orderPaidUnFreeze.ResponseMessage = unFreezeResponse.Head.ResMsg;

            if (unFreezeResponse.IsOK)
            {
                UnFreezeSuccess(orderPaidUnFreeze);

                Commit();
            }
            //else if (unFreezeResponse.IsWait)
            //{
            //    orderPaid.Status = OrderPaidStatusOption.UnFrozenWait.ToInt();
            //    Save(orderPaid);

            //    orderPaidUnFreeze.Status = OrderPaidUnFreezeStatusOption.Wait.ToInt();
            //    iOrderPaidUnFreezeService.Save(orderPaidUnFreeze);

            //    Commit();

            //    throw new APIException("解冻中,请查询确认(" + unFreezeResponse.Head.ResMsg + ")");
            //}
            else if (unFreezeResponse.IsFail)
            {
                orderPaidUnFreeze.Status = OrderPaidUnFreezeStatusOption.Fail.ToInt();
                iOrderPaidUnFreezeService.Save(orderPaidUnFreeze);

                Commit();

                throw new APIException("解冻失败:" + unFreezeResponse.Head.ResMsg);
            }
        }
Exemplo n.º 23
0
        private void RechargeSuccess(OrderPaidRecharge orderPaidRecharge, string TransNumber, DateTime TransTime)
        {
            var iOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IOrderPaidRechargeService>();
            var iMemberService            = DIFactory.GetContainer().Resolve <IMemberService>();

            orderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.RechargeSuccess.ToInt();
            orderPaidRecharge.OrderPaid.Project.ReceiveAmount += orderPaidRecharge.Amount;
            Save(orderPaidRecharge.OrderPaid);

            orderPaidRecharge.Status         = OrderPaidRechargeStatusOption.Success.ToInt();
            orderPaidRecharge.BankCardNumber = orderPaidRecharge.OrderPaid.Member.BankCardNumber;
            orderPaidRecharge.TransNumber    = TransNumber;
            orderPaidRecharge.TransTime      = TransTime;
            iOrderPaidRechargeService.Save(orderPaidRecharge);

            iMemberService.BalanceChange(orderPaidRecharge.OrderPaid.Member, orderPaidRecharge.Amount, MemberBalanceHistoryTypeOption.Recharge, (AccountBankOption)orderPaidRecharge.OrderPaid.Merchant.AccountBank, remark: orderPaidRecharge.SerialNumber);
        }
Exemplo n.º 24
0
        public void TltSingleOntimePaySuccess(PingAnOrderPaidRecharge pingAnOrderPaidRecharge, string TransNumber, string SettleDay)
        {
            var iPingAnOrderPaidRechargeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidRechargeService>();
            var iMemberService = DIFactory.GetContainer().Resolve <IMemberService>();

            pingAnOrderPaidRecharge.OrderPaid.Status = OrderPaidStatusOption.SingleOntimePaySuccess.ToInt();
            // pingAnOrderPaidRecharge.OrderPaid.Project.ReceiveAmount += pingAnOrderPaidRecharge.Amount;
            Save(pingAnOrderPaidRecharge.OrderPaid);

            pingAnOrderPaidRecharge.Status         = PingAnOrderPaidRechargeStatusOption.SingleOntimePaySuccess.ToInt();
            pingAnOrderPaidRecharge.BankCardNumber = pingAnOrderPaidRecharge.OrderPaid.Member.AccountPingAn.BankCardNumber;
            pingAnOrderPaidRecharge.TransNumber    = TransNumber;
            pingAnOrderPaidRecharge.TransTime      = DateTime.ParseExact(SettleDay, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); // 清算日期--转为时间格式
            iPingAnOrderPaidRechargeService.Save(pingAnOrderPaidRecharge);

            iMemberService.BalanceChange(pingAnOrderPaidRecharge.OrderPaid.Member, pingAnOrderPaidRecharge.Amount, MemberBalanceHistoryTypeOption.Recharge, (AccountBankOption)pingAnOrderPaidRecharge.OrderPaid.Merchant.AccountBank, remark: pingAnOrderPaidRecharge.SerialNumber);    //修改金额
        }
Exemplo n.º 25
0
        /// <summary>
        /// 查询单笔代付订单详情
        /// </summary>
        /// <param name="pingAnOrderPaidRecharge"></param>
        /// <returns></returns>
        public QueryTltTradingResultResponse QuerySingleOntimePayDetail(PingAnOrderPaidRecharge pingAnOrderPaidRecharge)
        {
            var iTltService            = DIFactory.GetContainer().Resolve <ITltService>();
            var iTLTPreferencesService = DIFactory.GetContainer().Resolve <ITLTPreferencesService>();

            var TLTPreferences = iTLTPreferencesService.Get(t => t.MerchantID == pingAnOrderPaidRecharge.OrderPaid.MerchantID);

            //初始化通联通参数
            if (!iTltService.isReady())
            {
                iTltService.Init(url, TLTPreferences.TltMerchantId, TLTPreferences.TltUserName, TLTPreferences.TltUserPassword, TLTPreferences.TltPrivateKeyPassword);
            }
            //查询订单代付状态
            var response = iTltService.QueryTltTradingResult(GuidHelper.GenUniqueId(), pingAnOrderPaidRecharge.SerialNumber, "200004");   //200004为通联通接口交易代码

            return(response);
        }
Exemplo n.º 26
0
        private void Withdraw(OrderPaid orderPaid)
        {
            //var iOrderPaidService = DIFactory.GetContainer().Resolve<IOrderPaidService>();
            var iGuangDaAPIService        = DIFactory.GetContainer().Resolve <IGuangDaAPIService>();
            var iOrderPaidWithdrawService = DIFactory.GetContainer().Resolve <IOrderPaidWithdrawService>();

            OrderPaidWithdraw orderPaidWithdraw = new OrderPaidWithdraw();

            orderPaidWithdraw.OrderPaid = orderPaid;
            orderPaidWithdraw.Amount    = orderPaid.TransactionAmount;

            iOrderPaidWithdrawService.Save(orderPaidWithdraw);
            iOrderPaidWithdrawService.Commit();

            var withdrawResponse = iGuangDaAPIService.Withdraw(orderPaidWithdraw);

            orderPaidWithdraw.ResponseCode    = withdrawResponse.Head.ResCode;
            orderPaidWithdraw.ResponseMessage = withdrawResponse.Head.ResMsg;

            if (withdrawResponse.IsOK)
            {
                WithdrawSuccess(orderPaidWithdraw);

                Commit();
            }
            else if (withdrawResponse.IsWait)
            {
                orderPaid.Status = OrderPaidStatusOption.WithdrawWait.ToInt();
                Save(orderPaid);

                orderPaidWithdraw.Status = OrderPaidWithdrawStatusOption.Wait.ToInt();
                iOrderPaidWithdrawService.Save(orderPaidWithdraw);

                Commit();

                throw new APIException("提现中,请查询确认(" + withdrawResponse.Head.ResMsg + ")");
            }
            else
            {
                WithdrawFail(orderPaidWithdraw);

                Commit();

                throw new APIException("提现失败:" + withdrawResponse.Head.ResMsg);
            }
        }
Exemplo n.º 27
0
        private void PingAnUnFreezeSuccess(PingAnOrderPaidUnFreeze pingAnOrderPaidUnFreeze)
        {
            var iMemberService = DIFactory.GetContainer().Resolve <IMemberService>();
            var iPingAnOrderPaidUnFreezeService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidUnFreezeService>();
            var iPingAnOrderPaidService         = DIFactory.GetContainer().Resolve <IPingAnOrderPaidService>();

            pingAnOrderPaidUnFreeze.OrderPaid.Status = OrderPaidStatusOption.UnFrozenSuccess.ToInt();  //更新订单主表状态
            Save(pingAnOrderPaidUnFreeze.OrderPaid);

            pingAnOrderPaidUnFreeze.OrderPaid.PingAnOrderPaid.Status = PingAnOrderPaidStatusOption.UnFrozenSuccess.ToInt();  //更新平安订单子表状态
            iPingAnOrderPaidService.Save(pingAnOrderPaidUnFreeze.OrderPaid.PingAnOrderPaid);

            pingAnOrderPaidUnFreeze.Status    = PingAnOrderPaidUnFreezeStatusOption.Success.ToInt(); //更新解止付订单状态
            pingAnOrderPaidUnFreeze.TransTime = DateTime.Now;
            iPingAnOrderPaidUnFreezeService.Save(pingAnOrderPaidUnFreeze);

            iMemberService.BalanceChange(pingAnOrderPaidUnFreeze.OrderPaid.Member, pingAnOrderPaidUnFreeze.Amount, MemberBalanceHistoryTypeOption.UnFreeze, (AccountBankOption)pingAnOrderPaidUnFreeze.OrderPaid.Merchant.AccountBank, pingAnOrderPaidUnFreeze.Amount * -1, remark: pingAnOrderPaidUnFreeze.SerialNumber);
        }
Exemplo n.º 28
0
        public void PingAnFreeze(PingAnOrderPaid pingAnOrderPaid, string tradeTime)
        {
            var iPingAnOrderPaidService = DIFactory.GetContainer().Resolve <IPingAnOrderPaidService>();
            var iMemberService          = DIFactory.GetContainer().Resolve <IMemberService>();

            pingAnOrderPaid.Status            = PingAnOrderPaidStatusOption.FrozenSuccess.ToInt();
            pingAnOrderPaid.FreezeSuccessTime = Convert.ToDateTime(tradeTime);

            iPingAnOrderPaidService.Save(pingAnOrderPaid);
            iPingAnOrderPaidService.Commit();

            pingAnOrderPaid.OrderPaid.Project.ReceiveAmount += pingAnOrderPaid.OrderPaid.TransactionAmount;
            Save(pingAnOrderPaid.OrderPaid);

            iMemberService.BalanceChange(pingAnOrderPaid.OrderPaid.Member, pingAnOrderPaid.OrderPaid.TransactionAmount * -1, MemberBalanceHistoryTypeOption.Freeze, (AccountBankOption)pingAnOrderPaid.OrderPaid.Merchant.AccountBank, pingAnOrderPaid.OrderPaid.TransactionAmount, remark: pingAnOrderPaid.OrderPaid.OrderNumber);    //修改金额

            Commit();
        }
Exemplo n.º 29
0
        public void RechargeAndFreeze(OrderPaid orderPaid)
        {
            var iOrderPaidService = DIFactory.GetContainer().Resolve <IOrderPaidService>();

            if (orderPaid.Status == OrderPaidStatusOption.PaySuccess.ToInt())
            {
                Recharge(orderPaid);

                Freeze(orderPaid);
            }
            else if (orderPaid.Status == OrderPaidStatusOption.RechargeSuccess.ToInt())
            {
                Freeze(orderPaid);
            }
            else
            {
                throw new APIException("当前状态(" + orderPaid.StatusDesc + ")无法操作");
            }
        }
Exemplo n.º 30
0
        public void UnFreezeAndWithdraw(OrderPaid orderPaid)
        {
            var iOrderPaidService = DIFactory.GetContainer().Resolve <IOrderPaidService>();

            if (orderPaid.Status == OrderPaidStatusOption.FrozenSuccess.ToInt())
            {
                UnFreeze(orderPaid);

                Withdraw(orderPaid);
            }
            else if (orderPaid.Status == OrderPaidStatusOption.UnFrozenSuccess.ToInt())
            {
                Withdraw(orderPaid);
            }
            else
            {
                throw new APIException("当前状态(" + orderPaid.StatusDesc + ")无法操作");
            }
        }