Exemplo n.º 1
0
        public static bool CreatAmountApplyRequest(MemberAmountRequestInfo applyInfo)
        {
            AmountDao amountDao = new AmountDao();
            bool      flag      = amountDao.CreatAmountApplyRequest(applyInfo);

            if (flag)
            {
                MemberInfo member = new MemberDao().GetMember(applyInfo.UserId);
                MemberAmountDetailedInfo memberAmountDetailedInfo = new MemberAmountDetailedInfo
                {
                    UserId          = applyInfo.UserId,
                    TradeAmount     = -applyInfo.Amount,
                    PayId           = Globals.GetGenerateId(),
                    UserName        = applyInfo.UserName,
                    TradeType       = TradeType.Withdrawals,
                    TradeTime       = DateTime.Now,
                    State           = 1,
                    TradeWays       = MemberAmountProcessor.GetWaysByRequestType(applyInfo.RequestType),
                    AvailableAmount = member.AvailableAmount - applyInfo.Amount,
                    Remark          = "余额提现。收款账号:" + applyInfo.AccountCode
                };
                flag = (amountDao.UpdateMember(memberAmountDetailedInfo) && MemberAmountProcessor.CreatAmount(memberAmountDetailedInfo));
            }
            return(flag);
        }
Exemplo n.º 2
0
        public static bool SetAmountRequestStatus(int[] serialids, int checkValue, string Remark = "", string Amount = "", string Operator = "")
        {
            bool flag = new AmountDao().SetAmountRequestStatus(serialids, checkValue, Remark, Amount, Operator);

            if (checkValue == -1 && flag)
            {
                for (int i = 0; i < serialids.Length; i++)
                {
                    int serialid = serialids[i];
                    MemberAmountRequestInfo amountRequestDetail = MemberAmountProcessor.GetAmountRequestDetail(serialid);
                    MemberInfo member = new MemberDao().GetMember(amountRequestDetail.UserId);
                    MemberAmountDetailedInfo memberAmountDetailedInfo = new MemberAmountDetailedInfo
                    {
                        UserId          = amountRequestDetail.UserId,
                        TradeAmount     = amountRequestDetail.Amount,
                        PayId           = Globals.GetGenerateId(),
                        UserName        = amountRequestDetail.UserName,
                        TradeType       = TradeType.WithdrawalsRefuse,
                        TradeTime       = DateTime.Now,
                        State           = 1,
                        TradeWays       = MemberAmountProcessor.GetWaysByRequestType(amountRequestDetail.RequestType),
                        AvailableAmount = member.AvailableAmount + amountRequestDetail.Amount,
                        Remark          = "余额提现驳回"
                    };
                    flag = (new AmountDao().UpdateMember(memberAmountDetailedInfo) && MemberAmountProcessor.CreatAmount(memberAmountDetailedInfo));
                    MemberAmountRequestInfo amountRequestDetail2 = MemberAmountProcessor.GetAmountRequestDetail(serialid);
                    if (amountRequestDetail2 != null)
                    {
                        string url = Globals.FullPath("/Vshop/MemberAmountRequestDetail.aspx?Id=" + amountRequestDetail2.Id);
                        try
                        {
                            Messenger.SendWeiXinMsg_MemberAmountDrawCashRefuse(amountRequestDetail2, url);
                        }
                        catch
                        {
                        }
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 3
0
        public static bool IsPassAutoToDistributor(MemberInfo cuser, bool isNeedToCheckAutoToDistributor = true)
        {
            bool         enableMemberAutoToDistributor = false;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.DistributorApplicationCondition)
            {
                decimal expenditure        = cuser.Expenditure;
                int     finishedOrderMoney = masterSettings.FinishedOrderMoney;
                if (finishedOrderMoney > 0)
                {
                    decimal   num2 = 0M;
                    DataTable userOrderPaidWaitFinish = new OrderDao().GetUserOrderPaidWaitFinish(cuser.UserId);
                    decimal   total     = 0M;
                    OrderInfo orderInfo = null;
                    for (int i = 0; i < userOrderPaidWaitFinish.Rows.Count; i++)
                    {
                        orderInfo = new OrderDao().GetOrderInfo(userOrderPaidWaitFinish.Rows[i]["orderid"].ToString());
                        if (orderInfo != null)
                        {
                            total = orderInfo.GetTotal();
                            if (total > 0M)
                            {
                                num2 += total;
                            }
                        }
                    }
                    if ((cuser.Expenditure + num2) >= finishedOrderMoney)
                    {
                        enableMemberAutoToDistributor = true;
                    }
                }
                if (((!enableMemberAutoToDistributor && masterSettings.EnableDistributorApplicationCondition) && (!string.IsNullOrEmpty(masterSettings.DistributorProductsDate) && !string.IsNullOrEmpty(masterSettings.DistributorProducts))) && masterSettings.DistributorProductsDate.Contains("|"))
                {
                    DateTime result = new DateTime();
                    DateTime time2  = new DateTime();
                    bool     flag2  = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[0].ToString(), out result);
                    bool     flag3  = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[1].ToString(), out time2);
                    if (((flag2 && flag3) && ((DateTime.Now.CompareTo(result) >= 0) && (DateTime.Now.CompareTo(time2) < 0))) && MemberProcessor.CheckMemberIsBuyProds(cuser.UserId, masterSettings.DistributorProducts, new DateTime?(result), new DateTime?(time2)))
                    {
                        enableMemberAutoToDistributor = true;
                    }
                }
                if ((!enableMemberAutoToDistributor && (masterSettings.RechargeMoneyToDistributor > 0M)) && (MemberAmountProcessor.GetUserMaxAmountDetailed(cuser.UserId) >= masterSettings.RechargeMoneyToDistributor))
                {
                    enableMemberAutoToDistributor = true;
                }
            }
            else
            {
                enableMemberAutoToDistributor = true;
            }
            if (isNeedToCheckAutoToDistributor && enableMemberAutoToDistributor)
            {
                enableMemberAutoToDistributor = masterSettings.EnableMemberAutoToDistributor;
            }
            return(enableMemberAutoToDistributor);
        }
Exemplo n.º 4
0
        public static bool IsPassAutoToDistributor(MemberInfo cuser, bool isNeedToCheckAutoToDistributor = true)
        {
            bool         flag           = false;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.DistributorApplicationCondition)
            {
                decimal expenditure        = cuser.Expenditure;
                int     finishedOrderMoney = masterSettings.FinishedOrderMoney;
                if (finishedOrderMoney > 0)
                {
                    decimal num = 0m;
                    System.Data.DataTable userOrderPaidWaitFinish = new OrderDao().GetUserOrderPaidWaitFinish(cuser.UserId);
                    for (int i = 0; i < userOrderPaidWaitFinish.Rows.Count; i++)
                    {
                        OrderInfo orderInfo = new OrderDao().GetOrderInfo(userOrderPaidWaitFinish.Rows[i]["orderid"].ToString());
                        if (orderInfo != null)
                        {
                            decimal total = orderInfo.GetTotal();
                            if (total > 0m)
                            {
                                num += total;
                            }
                        }
                    }
                    if (cuser.Expenditure + num >= finishedOrderMoney)
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    if (masterSettings.EnableDistributorApplicationCondition)
                    {
                        if (!string.IsNullOrEmpty(masterSettings.DistributorProductsDate) && !string.IsNullOrEmpty(masterSettings.DistributorProducts))
                        {
                            if (masterSettings.DistributorProductsDate.Contains("|"))
                            {
                                DateTime value  = default(DateTime);
                                DateTime value2 = default(DateTime);
                                bool     flag2  = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                {
                                    '|'
                                })[0].ToString(), out value);
                                bool flag3 = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                {
                                    '|'
                                })[1].ToString(), out value2);
                                if (flag2 && flag3 && DateTime.Now.CompareTo(value) >= 0 && DateTime.Now.CompareTo(value2) < 0)
                                {
                                    if (MemberProcessor.CheckMemberIsBuyProds(cuser.UserId, masterSettings.DistributorProducts, new DateTime?(value), new DateTime?(value2)))
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                    }
                }
                if (!flag && masterSettings.RechargeMoneyToDistributor > 0m && MemberAmountProcessor.GetUserMaxAmountDetailed(cuser.UserId) >= masterSettings.RechargeMoneyToDistributor)
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            if (isNeedToCheckAutoToDistributor && flag)
            {
                flag = masterSettings.EnableMemberAutoToDistributor;
            }
            return(flag);
        }