示例#1
0
        /// <summary>
        /// 添加举报信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddReportForAcceptDetail(OrderReportingModel model)
        {
            HelpeOrderModel help = HelpeOrderDAL.GetHelpOrderInfo(model.OrderID);

            model.OrderCode = help.OrderCode;
            model.RStatus   = 1;
            model.OrderType = 1;
            return(OrderReportingDAL.AddOrderReporting(model));
        }
示例#2
0
        /// <summary>
        /// 更新提供帮助订单为已打款
        /// </summary>
        /// <param name="hid"></param>
        /// <returns></returns>
        public int UpdateToPlayMoneyV1(int hid, int aid)
        {
            int                    result      = 0;
            string                 value       = SysAdminConfigDAL.GetConfigsByID(6);  //得到打款后返还金额
            string                 inteist     = SysAdminConfigDAL.GetConfigsByID(7);  //得到打款后利率
            string                 inteistlist = SysAdminConfigDAL.GetConfigsByID(11); //得到领导奖利率
            HelpeOrderModel        order       = HelpeOrderDAL.GetHelpOrderInfo(hid);
            List <MatchOrderModel> matchorders = MatchOrderDAL.GetMatchOrderInfo(hid, aid);

            using (TransactionScope scope = new TransactionScope())
            {
                //更改状态为已打款(此处不在变更利率为打款后利率)
                //int rowcount = HelpeOrderDAL.UpdateStatusandinster(hid, 4, decimal.Parse(inteist));
                int rowcount = HelpeOrderDAL.UpdateStatus(hid, 4);
                if (rowcount < 1)
                {
                    return(0);
                }
                rowcount = MatchOrderDAL.UpdateStatusToPayed(hid, aid);
                if (rowcount < 1)
                {
                    return(0);
                }
                //更新匹配接受订单的状态为对方已打款
                rowcount = AcceptHelpOrderDAL.UpdateStatus(aid, 4);
                if (rowcount < 1)
                {
                    return(0);
                }
                try
                {
                    UserBehaviorLogModel log = new UserBehaviorLogModel();
                    log.AOrderCode     = matchorders[0].AcceptOrderCode;
                    log.BehaviorSource = 1;
                    log.BehaviorType   = 4;
                    log.HOrderCode     = matchorders[0].HelperOrderCode;
                    log.MemberID       = order.MemberID;
                    log.MemberName     = order.MemberName;
                    log.MemberPhone    = order.MemberPhone;
                    log.ProcAmount     = matchorders[0].MatchedMoney;
                    log.Remark         = "会员:" + order.MemberPhone + " 变更单据为打款";
                    rowcount           = UserBehaviorLogDAL.AddUserBehaviorLog(log);
                }
                catch { }
                scope.Complete();
                result = 1;
            }
            return(result);
        }
示例#3
0
 /// <summary>
 /// 单据匹配方法4
 /// </summary>
 /// <returns></returns>
 public int OperateMatchOrder(int hid, int aid)
 {
     int result = 0;
     decimal money = 0;
     HelpeOrderModel help = HelpeOrderDAL.GetHelpOrderInfo(hid);
     AcceptHelpOrderModel accept = AcceptHelpOrderDAL.GetAcceptOrderInfo(aid);
     string helpsmscontent = SysAdminConfigDAL.GetConfigsByID(19);
     string acceptsmscontent = SysAdminConfigDAL.GetConfigsByID(20);
     string issendsms = SysAdminConfigDAL.GetConfigsByID(21);
     if (help == null || accept == null)
     {
         return 0;
     }
     if (help.HStatus == 3 || help.HStatus == 5)
     {
         return 0;
     }
     if (accept.AStatus == 3 || accept.AStatus == 5)
     {
         return 0;
     }
     if (help.DiffAmount == 0 || accept.DiffAmount == 0)
     {
         return 0;
     }
     //系统计算匹配金额
     if (help.DiffAmount < accept.DiffAmount)
     {
         money = help.DiffAmount;
     }
     else if (help.DiffAmount > accept.DiffAmount)
     {
         money = accept.DiffAmount;
     }
     else
     {
         money = help.DiffAmount;
     }
     using (TransactionScope scope = new TransactionScope())
     {
         //插入匹配表
         MatchOrderModel matchmodel = new MatchOrderModel();
         matchmodel.AcceptMemberID = accept.MemberID;
         matchmodel.AcceptMemberName = accept.MemberName;
         matchmodel.AcceptMemberPhone = accept.MemberPhone;
         matchmodel.AcceptOrderCode = accept.OrderCode;
         matchmodel.AcceptOrderID = aid;
         matchmodel.HelperMemberID = help.MemberID;
         matchmodel.HelperMemberName = help.MemberName;
         matchmodel.HelperMemberPhone = help.MemberPhone;
         matchmodel.HelperOrderCode = help.OrderCode;
         matchmodel.HelperOrderID = hid;
         matchmodel.MatchedMoney = money;
         matchmodel.MatchTime = DateTime.Now;
         int rowcount = MatchOrderDAL.AddMatchOrder(matchmodel);
         if (rowcount < 1)
         {
             return 0;
         }
         //更新提供订单表状态
         rowcount = HelpeOrderDAL.UpdateHelpOrderMatch(hid, money);
         if (rowcount < 1)
         {
             return 0;
         }
         //更新接受订单表状态
         rowcount = AcceptHelpOrderDAL.UpdateAcceptOrderMatch(aid, money);
         if (rowcount < 1)
         {
             return 0;
         }
         #region 发送短信
         if (issendsms == "1")
         {
             string helpsms = string.Format(helpsmscontent, help.OrderCode);
             string acceptsms = string.Format(acceptsmscontent, accept.OrderCode);
             string resule = SendSMSClass.SendSMS(help.MemberPhone, helpsms);
             resule = SendSMSClass.SendSMS(accept.MemberPhone, acceptsms);
         }
         #endregion
         scope.Complete();
         result = 1;
     }
     return result;
 }
示例#4
0
 /// <summary>
 /// 根据ID和会员查询提供帮助订单信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public HelpeOrderModel GetHelpOrderInfo(int id, int memberid)
 {
     return(HelpeOrderDAL.GetHelpOrderInfo(id, memberid));
 }
示例#5
0
 /// <summary>
 /// 根据ID得到单据的信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public HelpeOrderModel GetHelpordermodel(int id)
 {
     return(HelpeOrderDAL.GetHelpOrderInfo(id));
 }
示例#6
0
        /// <summary>
        /// 取消提供帮助的订单
        /// </summary>
        /// <param name="hid"></param>
        /// <param name="ispipei">单据是否已经匹配</param>
        /// <returns></returns>
        public int UpdateToCancle(int hid, int ispipei = 0)
        {
            int result = 0;
            List <LeaderAmountModel> leaderlist = MemberCapitalDetailDAL.GetLeaderamountListByOrderID(hid);

            using (TransactionScope scope = new TransactionScope())
            {
                //更改订单状态
                int rowcount = HelpeOrderDAL.UpdateStatus(hid, 3);
                if (rowcount < 1)
                {
                    return(0);
                }
                //返还会员追加的资金
                HelpeOrderModel model = HelpeOrderDAL.GetHelpOrderInfo(hid);
                rowcount = MemberCapitalDetailDAL.UpdateMemberStaticFreezeMoneyAndinster(model.MemberID, (0 - model.Amount), 1, model.MemberName, model.MemberPhone);
                //rowcount = MemberCapitalDetailDAL.UpdateMemberStaticCapital(model.MemberID, (0 - model.Amount), model.MemberName, model.MemberPhone);
                if (rowcount < 1)
                {
                    return(0);
                }
                //插入会员资金变动日志
                AmountChangeLogModel logmodel = new AmountChangeLogModel();
                logmodel.MemberID     = model.MemberID;
                logmodel.MemberName   = model.MemberName;
                logmodel.MemberPhone  = model.MemberPhone;
                logmodel.OrderCode    = model.OrderCode;
                logmodel.OrderID      = hid;
                logmodel.ProduceMoney = (0 - model.Amount);
                logmodel.Remark       = "会员:" + model.MemberPhone + " 取消提供帮助,扣减静态冻结资金 " + model.Amount.ToString() + "元";
                logmodel.Type         = 1;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return(0);
                }
                if (model.Interest > 0)
                {
                    //从账户扣减本次产生的利息
                    rowcount = MemberCapitalDetailDAL.UpdateStaticInterest(model.MemberID, (0 - model.Interest));
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    //插入日志
                    AmountChangeLogModel logmodel1 = new AmountChangeLogModel();
                    logmodel1.MemberID     = model.MemberID;
                    logmodel1.MemberName   = model.MemberName;
                    logmodel1.MemberPhone  = model.MemberPhone;
                    logmodel1.OrderCode    = model.OrderCode;
                    logmodel1.OrderID      = hid;
                    logmodel1.ProduceMoney = (0 - model.Amount);
                    logmodel1.Remark       = "会员:" + model.MemberPhone + " 取消提供帮助,扣减利息 " + model.Interest.ToString() + "元";
                    logmodel.Type          = 4;
                    rowcount = OperateLogDAL.AddAmountChangeLog(logmodel1);
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                }
                //撤销对会员领导人的推荐奖和领导奖
                if (leaderlist != null)
                {
                    foreach (var item in leaderlist)
                    {
                        if (item.LType == 0)
                        {
                            rowcount = MemberCapitalDetailDAL.UpdateDynamicInterest(item.MemberID, (0 - item.Amount), item.MemberName, item.MemberPhone);
                        }
                        else if (item.LType == 1)
                        {
                            rowcount = MemberCapitalDetailDAL.UpdateMemberDynamicFreezeMoney(item.MemberID, (0 - item.Amount), item.MemberName, item.MemberPhone);
                        }
                    }
                }

                //更新会员统计信息
                rowcount = MemberExtendInfoDAL.CancleHelperOrder(model.MemberID, hid);
                if (rowcount < 1)
                {
                    return(0);
                }
                if (ispipei == 1)//该单已经匹配
                {
                    List <MatchOrderModel> matchs = MatchOrderDAL.GetMatchOrderInfo(hid, 0);
                    rowcount = MatchOrderDAL.UpdateStatus(hid, 0);//更改状态为取消
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    foreach (var item in matchs)//更改接受帮助订单的状态
                    {
                        rowcount = AcceptHelpOrderDAL.CancleOrderForHelp(item.AcceptOrderID, item.MatchedMoney);
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                    }
                }
                scope.Complete();
                result = 1;
            }
            return(result);
        }
示例#7
0
        public int UpdateToPlayMoney(int hid)
        {
            int                    result      = 0;
            string                 value       = SysAdminConfigDAL.GetConfigsByID(6);  //得到打款后返还金额
            string                 inteist     = SysAdminConfigDAL.GetConfigsByID(7);  //得到打款后利率
            string                 inteistlist = SysAdminConfigDAL.GetConfigsByID(11); //得到领导奖利率
            HelpeOrderModel        order       = HelpeOrderDAL.GetHelpOrderInfo(hid);
            List <MatchOrderModel> matchorders = MatchOrderDAL.GetMatchOrderInfo(hid, 0);

            using (TransactionScope scope = new TransactionScope())
            {
                //更改状态为已打款和更改利率为已打款后的利率
                int rowcount = HelpeOrderDAL.UpdateStatusandinster(hid, 4, decimal.Parse(inteist));
                if (rowcount < 1)
                {
                    return(0);
                }
                //返还排单币更改会员利率为打款后利率
                //if (!string.IsNullOrWhiteSpace(value))
                //{
                //    rowcount = MemberCapitalDetailDAL.UpdateMemberStaticFreezeMoney(order.MemberID, decimal.Parse(value), order.MemberName, order.MemberPhone);
                //    if (rowcount < 1)
                //    {
                //        return 0;
                //    }
                //AmountChangeLogModel logmodel = new AmountChangeLogModel();
                //logmodel.MemberID = order.MemberID;
                //logmodel.MemberName = order.MemberName;
                //logmodel.MemberPhone = order.MemberPhone;
                //logmodel.OrderCode = order.OrderCode;
                //logmodel.OrderID = hid;
                //logmodel.ProduceMoney = order.Amount;
                //logmodel.Remark = "会员:" + order.MemberPhone + " 打款完成,返还" + order.Amount.ToString() + "元";
                //logmodel.Type = 5;
                //rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                //}
                //else
                //{
                //    rowcount = MemberCapitalDetailDAL.UpdateMemberInterest(order.MemberID, decimal.Parse(inteist));
                //    if (rowcount < 1)
                //    {
                //        return 0;
                //    }
                //}
                //更新匹配接受订单的状态为对方已打款
                if (matchorders.Count > 0)
                {
                    foreach (var item in matchorders)
                    {
                        rowcount = AcceptHelpOrderDAL.UpdateStatus(item.AcceptOrderID, 4);
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                    }
                }
                scope.Complete();
                result = 1;
            }
            return(result);
        }
示例#8
0
        /// <summary>
        /// 更新状态为已完成
        /// </summary>
        /// <returns></returns>
        public int UpdateSingleOrderToComplete(int aid, int hid)
        {
            int result = 0;
            //List<MatchOrderModel> matchorders = MatchOrderDAL.GetMatchOrderInfo(0, aid);
            HelpeOrderModel        helporder = HelpeOrderDAL.GetHelpOrderInfo(hid);        //查询提供帮助的单据
            AcceptHelpOrderModel   accorder  = AcceptHelpOrderDAL.GetAcceptOrderInfo(aid); //查询接受单据的信息
            List <MatchOrderModel> matchinfo = MatchOrderDAL.GetMatchOrderInfo(hid, aid);  //单据的匹配信息
            string value       = SysAdminConfigDAL.GetConfigsByID(4);                      //得到注册返还金额
            string scvalue     = SysAdminConfigDAL.GetConfigsByID(6);                      //得到注册返还金额
            string inteistlist = SysAdminConfigDAL.GetConfigsByID(11);                     //得到领导奖利率
            int    day         = SysAdminConfigDAL.GetConfigsByID(22).ParseToInt(20);      //得到领导奖推荐奖冻结天数
            string inteist     = SysAdminConfigDAL.GetConfigsByID(7);                      //得到打款后利率

            using (TransactionScope scope = new TransactionScope())
            {
                //更改当前的接受单据状态和完成金额
                int rowcount = AcceptHelpOrderDAL.UpdateStatusAndMoneyToComplete(aid, matchinfo[0].MatchedMoney);
                if (rowcount < 1)
                {
                    return(0);
                }
                //更改匹配信息
                rowcount = MatchOrderDAL.UpdateStatusToComplete(hid, aid);
                if (rowcount < 1)
                {
                    return(0);
                }
                //更改匹配的提供帮助订单的状态
                rowcount = HelpeOrderDAL.UpdateStatusForCompleteV1(helporder.ID, matchinfo[0].MatchedMoney);
                if (rowcount < 1)
                {
                    return(0);
                }
                decimal diffamount = (helporder.Amount - helporder.PayedAmount - matchinfo[0].MatchedMoney);
                if (diffamount == 0)
                {
                    //返还匹配会员的静态冻结资金和利息
                    rowcount = MemberCapitalDetailDAL.UpdateStaticInterestAndStaticFreezeMoney(helporder.MemberID, helporder.Amount, helporder.Interest);
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    //更改单据利率为高利率
                    rowcount = HelpeOrderDAL.UpdateCurrentInterest(hid, inteist.ParseToInt(2));
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    //更改该单据的利息为0
                    rowcount = HelpeOrderDAL.UpdateHelperOrderClearInterest(helporder.ID);
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    //返还推荐奖
                    if (helporder.IsFristOrder == 1 && helporder.IsRecommendBack == 0)
                    {
                        decimal inster = SysAdminConfigDAL.GetConfigsByID(16).ParseToInt(10);//得到首次推荐的利率
                        decimal money  = helporder.Amount * inster / 100;
                        ReMemberRelationModel model = ReMemberRelationDAL.GetReMemberRelation(helporder.MemberID);
                        if (day == 0)//若为0,则当时返还
                        {
                            //返还推荐奖
                            rowcount = MemberCapitalDetailDAL.UpdateDynamicInterestForComplete(model.MemberID, money);
                            if (rowcount < 1)
                            {
                                return(0);
                            }
                            AmountChangeLogModel logmodel = new AmountChangeLogModel();
                            logmodel.MemberID     = model.MemberID;
                            logmodel.MemberName   = model.MemberTruthName;
                            logmodel.MemberPhone  = model.MemberPhone;
                            logmodel.OrderCode    = helporder.OrderCode;
                            logmodel.OrderID      = helporder.ID;
                            logmodel.ProduceMoney = money;
                            logmodel.Remark       = "会员:" + model.MemberPhone + " 得到来自单据:" + helporder.OrderCode + "的推荐奖";
                            logmodel.Type         = 3;
                            rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                            if (rowcount < 1)
                            {
                                return(result);
                            }
                        }
                        else
                        {
                            //返还推荐奖到待返还列表
                            WaitFreeLeaderAmountModel waitfreemodel = new WaitFreeLeaderAmountModel();
                            waitfreemodel.MemberID       = model.MemberID;
                            waitfreemodel.MemberName     = model.MemberTruthName;
                            waitfreemodel.MemberPhone    = model.MemberPhone;
                            waitfreemodel.Amount         = money;
                            waitfreemodel.AStatus        = 1;
                            waitfreemodel.TheoryFreeTime = DateTime.Now.AddDays(day);
                            waitfreemodel.Type           = 2;
                            waitfreemodel.OrderCode      = helporder.OrderCode;
                            waitfreemodel.OrderID        = helporder.ID;
                            rowcount = MemberCapitalDetailDAL.AddWaitFreeMoney(waitfreemodel);
                            if (rowcount < 1)
                            {
                                return(0);
                            }
                        }
                        //返还激活码的钱
                        rowcount = MemberCapitalDetailDAL.UpdateStaticFreezeMoneyForReiger(helporder.MemberID, value.ParseToDecimal(0));
                        //更改单据为已经派发推荐奖
                        rowcount = HelpeOrderDAL.UpdateHelperOrderIsRecommendBack(helporder.ID);
                    }
                    if (helporder.IsLeaderBack == 0)
                    {
                        if (day == 0)
                        {
                            //返还领导奖
                            rowcount = MemberCapitalDetailDAL.PaymentLeaderPrizeForComplete(helporder.MemberID, inteistlist, helporder.OrderCode, helporder.ID);
                        }
                        else
                        {
                            //返还领导奖到待返还列表
                            rowcount = MemberCapitalDetailDAL.PaymentLeaderPrizeForComplete(helporder.MemberID, inteistlist, helporder.OrderCode, helporder.ID, day);
                        }
                        //更新单据状态
                        rowcount = HelpeOrderDAL.UpdateHelperOrderIsLeaderBack(helporder.ID);
                    }
                    //返还该单据排单币的金额
                    if (helporder.SchedulingAmount == 0)
                    {
                        rowcount = MemberCapitalDetailDAL.UpdateMemberStaticCapital(helporder.MemberID, scvalue.ParseToDecimal(0), helporder.MemberName, helporder.MemberPhone);
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                        rowcount = HelpeOrderDAL.UpdateHelperOrderIsRecommendBack(helporder.ID, scvalue.ParseToDecimal(0));//更新单据的排单币金额
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                        AmountChangeLogModel logmodel = new AmountChangeLogModel();
                        logmodel.MemberID     = helporder.MemberID;
                        logmodel.MemberName   = helporder.MemberName;
                        logmodel.MemberPhone  = helporder.MemberPhone;
                        logmodel.OrderCode    = helporder.OrderCode;
                        logmodel.OrderID      = helporder.ID;
                        logmodel.ProduceMoney = scvalue.ParseToDecimal(0);
                        logmodel.Remark       = "会员:" + helporder.MemberPhone + " 打款完成,返还排单币" + scvalue + "元";
                        logmodel.Type         = 5;
                        rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                    }
                }
                try
                {
                    UserBehaviorLogModel log = new UserBehaviorLogModel();
                    log.AOrderCode     = accorder.OrderCode;
                    log.BehaviorSource = 1;
                    log.BehaviorType   = 5;
                    log.HOrderCode     = helporder.OrderCode;
                    log.MemberID       = accorder.MemberID;
                    log.MemberName     = accorder.MemberName;
                    log.MemberPhone    = accorder.MemberPhone;
                    log.ProcAmount     = matchinfo[0].MatchedMoney;
                    log.Remark         = "会员:" + accorder.MemberPhone + "为单据" + accorder.OrderCode + "确认收款";
                    rowcount           = UserBehaviorLogDAL.AddUserBehaviorLog(log);
                }
                catch { }
                scope.Complete();
                result = 1;
            }
            return(result);
        }