Esempio n. 1
0
        /// <summary>
        /// 接受帮助列表页面
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult acceptOrderlist(AcceptHelpOrderModel seachmodel, int page = 1)
        {
            MemberInfoModel logmember = Session[AppContent.SESSION_WEB_LOGIN] as MemberInfoModel;

            if (logmember == null)
            {
                return(RedirectToAction("Index", "Login", new { area = "NewTemplateArea" }));
            }
            AcceptOrderListViewModel model = new AcceptOrderListViewModel();
            int totalcount = 0;

            seachmodel.MemberID  = logmember.ID;
            seachmodel.PageIndex = page;
            seachmodel.PageSize  = pagesize;
            List <AcceptHelpOrderModel>      orderlist = aobll.GetAllAcceptOrderListForPage(seachmodel, out totalcount);
            PagedList <AcceptHelpOrderModel> pagelist  = null;

            if (orderlist != null)
            {
                pagelist = new PagedList <AcceptHelpOrderModel>(orderlist, page, pagesize, totalcount);
            }
            model.orderlist   = pagelist;
            ViewBag.PageTitle = web.WebName;
            return(View(model));
        }
Esempio n. 2
0
        /// <summary>
        /// 匹配页面
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult matchedmanage(int page = 1, int id = 1)
        {
            int totalrowcount           = 0;
            int htotalrowcount          = 0;
            AcceptHelpOrderModel aorder = new AcceptHelpOrderModel();

            aorder.PageIndex = page;
            aorder.PageSize  = PageSize;
            HelpeOrderModel horder = new HelpeOrderModel();

            horder.PageIndex = id;
            horder.PageSize  = PageSize;
            List <AcceptHelpOrderModel>      waitorderlist = abll.GetWaitAcceptOrderListForPage(aorder, out totalrowcount);
            List <HelpeOrderModel>           helporderlist = bll.GetWaitHelpeOrderListForPage(horder, out htotalrowcount);
            PagedList <AcceptHelpOrderModel> acceptList    = null;
            PagedList <HelpeOrderModel>      helpList      = null;

            if (waitorderlist != null)
            {
                acceptList = new PagedList <AcceptHelpOrderModel>(waitorderlist, page, PageSize, totalrowcount);
            }
            if (helporderlist != null)
            {
                helpList = new PagedList <HelpeOrderModel>(helporderlist, id, PageSize, htotalrowcount);
            }
            MatchedManageViewModel model = new MatchedManageViewModel();

            model.acceptorderlist = acceptList;
            model.helporderlist   = helpList;
            return(View(model));
        }
Esempio n. 3
0
        /// <summary>
        /// 根据ID查询提供帮助订单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static AcceptHelpOrderModel GetAcceptOrderInfo(int id)
        {
            string sqltxt = @"select AStatus,OrderCode,MemberID,MemberPhone,MemberName,Amount,(Amount-ISNULL(MatchedAmount,0)) as DiffAmount,SourceType,MatchedAmount,DATEDIFF(DAY,AddTime,GETDATE()) AS diffday  from AcceptHelpOrder where ID=@id";

            SqlParameter[] paramter =
            {
                new SqlParameter("@id", id)
            };
            DataTable dt = helper.Query(sqltxt, paramter).Tables[0];

            if (dt.Rows.Count > 0)
            {
                AcceptHelpOrderModel model = new AcceptHelpOrderModel();
                model.MemberID      = Convert.ToInt32(dt.Rows[0]["MemberID"].ToString());
                model.MemberName    = dt.Rows[0]["MemberName"].ToString();
                model.MemberPhone   = dt.Rows[0]["MemberPhone"].ToString();
                model.OrderCode     = dt.Rows[0]["OrderCode"].ToString();
                model.Amount        = Convert.ToDecimal(dt.Rows[0]["Amount"].ToString());
                model.DiffAmount    = Convert.ToDecimal(dt.Rows[0]["DiffAmount"].ToString());
                model.SourceType    = Convert.ToInt32(dt.Rows[0]["SourceType"].ToString());
                model.MatchedAmount = Convert.ToDecimal(dt.Rows[0]["MatchedAmount"].ToString());
                model.DiffDay       = dt.Rows[0]["diffday"].ToString().ParseToInt(0);
                model.AStatus       = dt.Rows[0]["AStatus"].ToString().ParseToInt(0);
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 接受帮助单据信息页面
        /// </summary>
        /// <param name="orderid"></param>
        /// <returns></returns>
        public ActionResult AcceptOrderDetail(int orderid)
        {
            MemberInfoModel logmember = Session[AppContent.SESSION_WEB_LOGIN] as MemberInfoModel;

            if (logmember == null)
            {
                return(RedirectToAction("Index", "Login", new { area = "NewTemplateArea" }));
            }
            AcceptOrderViewModel model = new AcceptOrderViewModel();
            AcceptHelpOrderModel order = aobll.GetAcceptOrderInfo(orderid, logmember.ID);

            if (order == null)
            {
                return(RedirectToAction("Index", "WebHome", new { area = "NewTemplateArea" }));
            }
            //本人的信息
            model.acceptpeople = logmember;
            //匹配列表单据信息和会员信息及推荐人联系方式
            List <HelpOrderExtendInfoModel> acceptmodel = aobll.GetHelpextendmodels(orderid);

            model.helpOrderInfo = acceptmodel;
            model.acceptorder   = order;
            ViewBag.PageTitle   = web.WebName;
            return(View(model));
        }
Esempio n. 5
0
        /// <summary>
        /// 查询所有的帮助订单
        /// </summary>
        /// <returns></returns>
        public List <AcceptHelpOrderModel> GetAllAcceptOrderList()
        {
            List <AcceptHelpOrderModel> list = new List <AcceptHelpOrderModel>();
            StringBuilder strSql             = new StringBuilder();

            strSql.Append("select ID, AddTime, AStatus, SortIndex, OrderCode, MemberID, MemberPhone, MemberName, Amount, PayType, MatchedAmount, TurnOutOrder,CASE AStatus WHEN 0 THEN '未匹配' WHEN 1 THEN '部分匹配' WHEN 2 THEN '全部匹配' WHEN 3 THEN '已撤销' WHEN 4 THEN '对方已打款' WHEN 5 THEN '已完成' END AS AStatusName  ");
            strSql.Append("  from AcceptHelpOrder ");
            strSql.Append(" ORDER BY SortIndex DESC ,ID DESC ");
            DataSet ds = helper.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    AcceptHelpOrderModel model = new AcceptHelpOrderModel();
                    if (item["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(item["ID"].ToString());
                    }
                    if (item["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(item["AddTime"].ToString());
                    }
                    if (item["AStatus"].ToString() != "")
                    {
                        model.AStatus = int.Parse(item["AStatus"].ToString());
                    }
                    if (item["SortIndex"].ToString() != "")
                    {
                        model.SortIndex = int.Parse(item["SortIndex"].ToString());
                    }
                    model.OrderCode = item["OrderCode"].ToString();
                    if (item["MemberID"].ToString() != "")
                    {
                        model.MemberID = int.Parse(item["MemberID"].ToString());
                    }
                    model.MemberPhone = item["MemberPhone"].ToString();
                    model.MemberName  = item["MemberName"].ToString();
                    if (item["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(item["Amount"].ToString());
                    }
                    model.PayType = item["PayType"].ToString();
                    if (item["MatchedAmount"].ToString() != "")
                    {
                        model.MatchedAmount = decimal.Parse(item["MatchedAmount"].ToString());
                    }
                    model.TurnOutOrder = item["TurnOutOrder"].ToString();
                    model.AStatusName  = item["AStatusName"].ToString();
                    list.Add(model);
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 查询所有的待匹配的接受帮助订单
        /// </summary>
        /// <returns></returns>
        public List <AcceptHelpOrderModel> GetWaitAcceptOrderListForPage(AcceptHelpOrderModel model, out int totalrowcount)
        {
            List <AcceptHelpOrderModel> list = new List <AcceptHelpOrderModel>();
            string columms = @" ID, AddTime, AStatus, SortIndex, OrderCode, MemberID, MemberPhone, MemberName, Amount, PayType, MatchedAmount, TurnOutOrder,CASE AStatus WHEN 0 THEN '未匹配' WHEN 1 THEN '部分匹配' WHEN 2 THEN '全部匹配' WHEN 3 THEN '已撤销' WHEN 4 THEN '对方已打款' WHEN 5 THEN '已完成' END AS AStatusName,DATEDIFF(DAY,AddTime,GETDATE()) AS diffday ";

            string where = " AStatus not in (3,5) and (Amount-MatchedAmount)>0 ";
            PageProModel page = new PageProModel();

            page.colums    = columms;
            page.orderby   = " (DATEDIFF(DAY,AddTime,GETDATE())) ";
            page.pageindex = model.PageIndex;
            page.pagesize  = model.PageSize;
            page.tablename = @"dbo.AcceptHelpOrder";
            page.where     = where;
            DataTable dt = PublicHelperDAL.GetTable(page, out totalrowcount);

            foreach (DataRow item in dt.Rows)
            {
                AcceptHelpOrderModel acceptordermodel = new AcceptHelpOrderModel();
                if (item["ID"].ToString() != "")
                {
                    acceptordermodel.ID = int.Parse(item["ID"].ToString());
                }
                if (item["AddTime"].ToString() != "")
                {
                    acceptordermodel.AddTime = DateTime.Parse(item["AddTime"].ToString());
                }
                if (item["AStatus"].ToString() != "")
                {
                    acceptordermodel.AStatus = int.Parse(item["AStatus"].ToString());
                }
                if (item["SortIndex"].ToString() != "")
                {
                    acceptordermodel.SortIndex = int.Parse(item["SortIndex"].ToString());
                }
                acceptordermodel.OrderCode = item["OrderCode"].ToString();
                if (item["MemberID"].ToString() != "")
                {
                    acceptordermodel.MemberID = int.Parse(item["MemberID"].ToString());
                }
                acceptordermodel.MemberPhone = item["MemberPhone"].ToString();
                acceptordermodel.MemberName  = item["MemberName"].ToString();
                if (item["Amount"].ToString() != "")
                {
                    acceptordermodel.Amount = decimal.Parse(item["Amount"].ToString());
                }
                acceptordermodel.PayType = item["PayType"].ToString();
                if (item["MatchedAmount"].ToString() != "")
                {
                    acceptordermodel.MatchedAmount = decimal.Parse(item["MatchedAmount"].ToString());
                }
                acceptordermodel.TurnOutOrder = item["TurnOutOrder"].ToString();
                acceptordermodel.AStatusName  = item["AStatusName"].ToString();
                acceptordermodel.DiffDay      = int.Parse(item["diffday"].ToString());
                list.Add(acceptordermodel);
            }
            return(list);
        }
Esempio n. 7
0
        /// <summary>
        /// 添加举报信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddReportForHelperDetail(OrderReportingModel model)
        {
            AcceptHelpOrderModel accept = AcceptHelpOrderDAL.GetAcceptOrderInfo(model.OrderID);

            model.OrderCode = accept.OrderCode;
            model.RStatus   = 1;
            model.OrderType = 2;
            return(OrderReportingDAL.AddOrderReporting(model));
        }
Esempio n. 8
0
        /// <summary>
        /// 根据ID查询提供帮助订单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static AcceptHelpOrderModel GetAcceptOrderInfo(int id, int memberid)
        {
            string sqltxt = @"SELECT  ID,OrderCode ,
        MemberID ,
        MemberPhone ,
        MemberName ,
        Amount ,
        ( Amount - ISNULL(MatchedAmount, 0) ) AS DiffAmount ,
        SourceType ,
        MatchedAmount,
        DATEDIFF(DAY,AddTime,GETDATE()) AS diffday,
        CASE AStatus WHEN 0 THEN '未匹配' WHEN 1 THEN '部分匹配' WHEN 2 THEN '全部匹配' WHEN 3 THEN '已撤销' WHEN 4 THEN '对方已打款' WHEN 5 THEN '已完成' END AS AStatusName
       ,CASE SourceType WHEN 1 THEN '静态资金' WHEN 2 THEN '动态资金' END AS SourceTypeName,
      AStatus,
     PayType
FROM    AcceptHelpOrder
WHERE   ID = @id AND MemberID=@memberid";

            SqlParameter[] paramter =
            {
                new SqlParameter("@id",       id),
                new SqlParameter("@memberid", memberid)
            };
            DataTable dt = helper.Query(sqltxt, paramter).Tables[0];

            if (dt.Rows.Count > 0)
            {
                AcceptHelpOrderModel model = new AcceptHelpOrderModel();
                model.ID             = dt.Rows[0]["ID"].ToString().ParseToInt(0);
                model.MemberID       = Convert.ToInt32(dt.Rows[0]["MemberID"].ToString());
                model.MemberName     = dt.Rows[0]["MemberName"].ToString();
                model.MemberPhone    = dt.Rows[0]["MemberPhone"].ToString();
                model.OrderCode      = dt.Rows[0]["OrderCode"].ToString();
                model.Amount         = Convert.ToDecimal(dt.Rows[0]["Amount"].ToString());
                model.DiffAmount     = Convert.ToDecimal(dt.Rows[0]["DiffAmount"].ToString());
                model.SourceType     = Convert.ToInt32(dt.Rows[0]["SourceType"].ToString());
                model.MatchedAmount  = Convert.ToDecimal(dt.Rows[0]["MatchedAmount"].ToString());
                model.DiffDay        = dt.Rows[0]["diffday"].ToString().ParseToInt(0);
                model.SourceTypeName = dt.Rows[0]["SourceTypeName"].ToString();
                model.PayType        = dt.Rows[0]["PayType"].ToString();
                model.AStatus        = dt.Rows[0]["AStatus"].ToString().ParseToInt(0);
                model.AStatusName    = dt.Rows[0]["AStatusName"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddAcceptHelpOrder(AcceptHelpOrderModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AcceptHelpOrder(");
            strSql.Append("AddTime,LastUpdateTime,AStatus,SortIndex,OrderCode,MemberID,MemberPhone,MemberName,Amount,PayType,MatchedAmount,TurnOutOrder,SourceType");
            strSql.Append(") values (");
            strSql.Append("GETDATE(),GETDATE(),@AStatus,@SortIndex,@OrderCode,@MemberID,@MemberPhone,@MemberName,@Amount,@PayType,@MatchedAmount,@TurnOutOrder,@SourceType");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AStatus",       SqlDbType.Int),
                new SqlParameter("@SortIndex",     SqlDbType.Int),
                new SqlParameter("@OrderCode",     SqlDbType.NVarChar),
                new SqlParameter("@MemberID",      SqlDbType.Int),
                new SqlParameter("@MemberPhone",   SqlDbType.NVarChar),
                new SqlParameter("@MemberName",    SqlDbType.NVarChar),
                new SqlParameter("@Amount",        SqlDbType.Decimal),
                new SqlParameter("@PayType",       SqlDbType.NVarChar),
                new SqlParameter("@MatchedAmount", SqlDbType.Decimal),
                new SqlParameter("@TurnOutOrder",  SqlDbType.NVarChar),
                new SqlParameter("@SourceType",    SqlDbType.NVarChar)
            };
            parameters[0].Value  = model.AStatus;
            parameters[1].Value  = model.SortIndex;
            parameters[2].Value  = model.OrderCode;
            parameters[3].Value  = model.MemberID;
            parameters[4].Value  = model.MemberPhone;
            parameters[5].Value  = model.MemberName;
            parameters[6].Value  = model.Amount;
            parameters[7].Value  = model.PayType;
            parameters[8].Value  = model.MatchedAmount;
            parameters[9].Value  = model.TurnOutOrder;
            parameters[10].Value = model.SourceType;
            object obj = helper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 10
0
        public ActionResult accepthelp(AcceptHelpOrderModel order, int page = 1)
        {
            int totalrowcount = 0;

            order.PageIndex = page;
            order.PageSize  = PageSize;
            List <AcceptHelpOrderModel>      orderlist = abll.GetAllAcceptOrderListForPage(order, out totalrowcount);
            PagedList <AcceptHelpOrderModel> pageList  = null;

            if (orderlist != null)
            {
                pageList = new PagedList <AcceptHelpOrderModel>(orderlist, page, PageSize, totalrowcount);
            }
            this.ViewData["order.AStatus"] = GetStatusListItem(-10);
            AcceptHelperViewModel model = new AcceptHelperViewModel();

            model.orderlist   = pageList;
            model.totalcount  = totalrowcount;
            model.pagesize    = PageSize;
            model.currentpage = page;
            ViewBag.PageTitle = "订单列表";
            return(View(model));
        }
        public ActionResult addacceptorder(int soucetype, decimal money, string paytype)
        {
            MemberInfoModel      logmember = Session[AppContent.SESSION_WEB_LOGIN] as MemberInfoModel;
            AcceptHelpOrderModel accept    = new AcceptHelpOrderModel();

            accept.SourceType  = soucetype;
            accept.Amount      = money;
            accept.AStatus     = 0;
            accept.MemberID    = logmember.ID;
            accept.MemberName  = logmember.TruethName;
            accept.MemberPhone = logmember.MobileNum;
            accept.OrderCode   = "A" + getcodenum();
            accept.PayType     = paytype;
            string result = aobll.AddAcceptHelpOrder(accept);

            if (result == "1")
            {
                return(Json("1"));
            }
            else
            {
                return(Json(result.Substring(1)));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 查询所有的帮助订单
        /// </summary>
        /// <returns></returns>
        public static List <AcceptHelpOrderModel> GetTopAcceptOrderListByMemberID(int memberid, int top = 10)
        {
            List <AcceptHelpOrderModel> list = new List <AcceptHelpOrderModel>();
            StringBuilder strSql             = new StringBuilder();

            strSql.Append("select TOP (@topnum) ID, AddTime, AStatus, SortIndex, OrderCode, MemberID, MemberPhone, MemberName, Amount, PayType, MatchedAmount, TurnOutOrder,CASE AStatus WHEN 0 THEN '未匹配' WHEN 1 THEN '部分匹配' WHEN 2 THEN '全部匹配' WHEN 3 THEN '已撤销' WHEN 4 THEN '对方已打款' WHEN 5 THEN '已完成' END AS AStatusName,CASE SourceType WHEN 1 THEN '静态资金' WHEN 2 THEN '动态资金' END AS SourceTypeName  ");
            strSql.Append("  from AcceptHelpOrder ");
            strSql.Append(" WHERE MemberID=@memberid ");
            strSql.Append(" ORDER BY ID DESC ");
            SqlParameter[] paramter = { new SqlParameter("@memberid", memberid), new SqlParameter("@topnum", top) };
            DataSet        ds       = helper.Query(strSql.ToString(), paramter);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    AcceptHelpOrderModel model = new AcceptHelpOrderModel();
                    if (item["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(item["ID"].ToString());
                    }
                    if (item["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(item["AddTime"].ToString());
                    }
                    if (item["AStatus"].ToString() != "")
                    {
                        model.AStatus = int.Parse(item["AStatus"].ToString());
                    }
                    if (item["SortIndex"].ToString() != "")
                    {
                        model.SortIndex = int.Parse(item["SortIndex"].ToString());
                    }
                    model.OrderCode = item["OrderCode"].ToString();
                    if (item["MemberID"].ToString() != "")
                    {
                        model.MemberID = int.Parse(item["MemberID"].ToString());
                    }
                    model.MemberPhone = item["MemberPhone"].ToString();
                    model.MemberName  = item["MemberName"].ToString();
                    if (item["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(item["Amount"].ToString());
                    }
                    model.PayType = item["PayType"].ToString();
                    if (item["MatchedAmount"].ToString() != "")
                    {
                        model.MatchedAmount = decimal.Parse(item["MatchedAmount"].ToString());
                    }
                    model.TurnOutOrder   = item["TurnOutOrder"].ToString();
                    model.AStatusName    = item["AStatusName"].ToString();
                    model.SourceTypeName = item["SourceTypeName"].ToString();
                    list.Add(model);
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string AddAcceptHelpOrder(AcceptHelpOrderModel model)
        {
            string result = "0";
            MemberCapitalDetailModel moneydetail = MemberCapitalDetailDAL.GetMemberStaticCapital(model.MemberID);
            int rows = AcceptHelpOrderDAL.GetNotFinishOrderByMember(model.MemberID);

            if (rows > 0)
            {
                return("0还有未完成的接受帮助单据");
            }
            string maxacceptamont = SystemConfigs.GetmaxAcceptAmont(); //得到最大的接受帮助限制
            string minacceptamont = SystemConfigs.GetminAcceptAmont(); //得到最小的接受帮助限制

            if (model.Amount > maxacceptamont.ParseToDecimal(0))
            {
                return("0超出了平台规定的最大接受值");
            }
            if (model.Amount < minacceptamont.ParseToDecimal(0))
            {
                return("0超出了平台规定的最小接受值");
            }
            int daynum = SysAdminConfigBLL.GetConfigValue(24).ParseToInt(15);
            MemberExtendInfoModel extentmember = MemberExtendInfoDAL.GetMemberExtendInfo(model.MemberID);

            if (DateTime.Now < extentmember.LastHelperTime.AddDays(daynum))
            {
                return("0会员提供帮助单据仍处于冻结期");
            }
            using (TransactionScope scope = new TransactionScope())
            {
                //插入表
                int orderid = dal.AddAcceptHelpOrder(model);
                if (orderid < 1)
                {
                    return("0操作失败");
                }
                //扣减会员的相应金额记录
                int rowcount = 0;
                if (model.SourceType == 1)
                {
                    if (moneydetail.StaticCapital < model.Amount)
                    {
                        return("0操作失败");
                    }
                    rowcount = MemberCapitalDetailDAL.DeductionMemberStaticCapital(model.MemberID, 0 - model.Amount, 0);
                    //清空会员的利率(不判断结果,不排除没有这样单据的可能,因为存在特殊账户)
                    int rowcounts = HelpeOrderDAL.UpdateCurrentInterestToClear(model.MemberID);
                }
                else
                {
                    if (moneydetail.DynamicFunds < model.Amount)
                    {
                        return("0操作失败");
                    }
                    rowcount = MemberCapitalDetailDAL.DeductionMemberDynamicFunds(model.MemberID, 0 - model.Amount, 0);
                }
                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      = orderid;
                logmodel.ProduceMoney = 0 - model.Amount;
                logmodel.Remark       = "会员:" + model.MemberPhone + " 申请接受帮助 " + model.Amount.ToString() + "元";
                logmodel.Type         = 1;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                try
                {
                    UserBehaviorLogModel log = new UserBehaviorLogModel();
                    log.AOrderCode     = model.OrderCode;
                    log.BehaviorSource = 1;
                    log.BehaviorType   = 3;
                    log.HOrderCode     = "";
                    log.MemberID       = model.MemberID;
                    log.MemberName     = model.MemberName;
                    log.MemberPhone    = model.MemberPhone;
                    log.ProcAmount     = model.Amount;
                    log.Remark         = "会员:" + model.MemberPhone + "接受帮助单号为:" + model.OrderCode;
                    rowcount           = UserBehaviorLogDAL.AddUserBehaviorLog(log);
                }
                catch { }
                scope.Complete();
                result = "1";
            }
            return(result);
        }
Esempio n. 14
0
        /// <summary>
        /// 查询所有的帮助订单
        /// </summary>
        /// <returns></returns>
        public List <AcceptHelpOrderModel> GetAllAcceptOrderListForPage(AcceptHelpOrderModel model, out int totalrowcount)
        {
            List <AcceptHelpOrderModel> list = new List <AcceptHelpOrderModel>();
            string columms = @"ID, AddTime, AStatus, SourceType,SortIndex, OrderCode, MemberID, MemberPhone, MemberName, Amount, PayType, MatchedAmount, TurnOutOrder,CASE AStatus WHEN 0 THEN '未匹配' WHEN 1 THEN '部分匹配' WHEN 2 THEN '全部匹配' WHEN 3 THEN '已撤销' WHEN 4 THEN '对方已打款' WHEN 5 THEN '已完成' END AS AStatusName,CASE SourceType WHEN 1 THEN '静态资金' WHEN 2 THEN '动态资金' END AS SourceTypeName ";

            string where = "";
            if (model != null)
            {
                if (!string.IsNullOrWhiteSpace(model.OrderCode))
                {
                    where += "OrderCode='" + model.OrderCode + "'";
                }
                if (model.MemberID > 0 && string.IsNullOrWhiteSpace(where))
                {
                    where += @" MemberID =" + model.MemberID;
                }
                else if (model.MemberID > 0 && !string.IsNullOrWhiteSpace(where))
                {
                    where += @" AND MemberID =" + model.MemberID;
                }
                if (!string.IsNullOrWhiteSpace(model.MemberPhone) && string.IsNullOrWhiteSpace(where))
                {
                    where += @" MemberPhone Like '%" + model.MemberPhone + "%'";
                }
                else if (!string.IsNullOrWhiteSpace(model.MemberPhone) && !string.IsNullOrWhiteSpace(where))
                {
                    where += @" AND MemberPhone Like '%" + model.MemberPhone + "%'";
                }
                if (!string.IsNullOrWhiteSpace(model.MemberName) && string.IsNullOrWhiteSpace(where))
                {
                    where += @" MemberName ='" + model.MemberName + "'";
                }
                else if (!string.IsNullOrWhiteSpace(model.MemberName) && !string.IsNullOrWhiteSpace(where))
                {
                    where += @" AND MemberName ='" + model.MemberName + "'";
                }
                if (model.AStatus > 0 && string.IsNullOrWhiteSpace(where))
                {
                    where += @" AStatus =" + model.AStatus;
                }
                else if (model.AStatus > 0 && !string.IsNullOrWhiteSpace(where))
                {
                    where += @" AND AStatus =" + model.AStatus;
                }
            }
            PageProModel page = new PageProModel();

            page.colums    = columms;
            page.orderby   = "SortIndex";
            page.pageindex = model.PageIndex;
            page.pagesize  = model.PageSize;
            page.tablename = @"dbo.AcceptHelpOrder";
            page.where     = where;
            DataTable dt = PublicHelperDAL.GetTable(page, out totalrowcount);

            foreach (DataRow item in dt.Rows)
            {
                AcceptHelpOrderModel helpeordermodel = new AcceptHelpOrderModel();
                if (item["ID"].ToString() != "")
                {
                    helpeordermodel.ID = int.Parse(item["ID"].ToString());
                }
                if (item["AddTime"].ToString() != "")
                {
                    helpeordermodel.AddTime = DateTime.Parse(item["AddTime"].ToString());
                }
                if (item["AStatus"].ToString() != "")
                {
                    helpeordermodel.AStatus = int.Parse(item["AStatus"].ToString());
                }
                if (item["SortIndex"].ToString() != "")
                {
                    helpeordermodel.SortIndex = int.Parse(item["SortIndex"].ToString());
                }
                helpeordermodel.OrderCode = item["OrderCode"].ToString();
                if (item["MemberID"].ToString() != "")
                {
                    helpeordermodel.MemberID = int.Parse(item["MemberID"].ToString());
                }
                helpeordermodel.MemberPhone = item["MemberPhone"].ToString();
                helpeordermodel.MemberName  = item["MemberName"].ToString();
                if (item["Amount"].ToString() != "")
                {
                    helpeordermodel.Amount = decimal.Parse(item["Amount"].ToString());
                }
                model.PayType = item["PayType"].ToString();
                if (item["MatchedAmount"].ToString() != "")
                {
                    helpeordermodel.MatchedAmount = decimal.Parse(item["MatchedAmount"].ToString());
                }
                if (item["SourceType"].ToString() != "")
                {
                    helpeordermodel.SourceType = item["SourceType"].ToString().ParseToInt(0);
                }
                helpeordermodel.SourceTypeName = item["SourceTypeName"].ToString();
                helpeordermodel.TurnOutOrder   = item["TurnOutOrder"].ToString();
                helpeordermodel.AStatusName    = item["AStatusName"].ToString();
                list.Add(helpeordermodel);
            }
            return(list);
        }
Esempio n. 15
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);
        }
Esempio n. 16
0
 /// <summary>
 /// 查询所有的待匹配的接受帮助订单
 /// </summary>
 /// <returns></returns>
 public List <AcceptHelpOrderModel> GetWaitAcceptOrderListForPage(AcceptHelpOrderModel model, out int totalrowcount)
 {
     return(dal.GetWaitAcceptOrderListForPage(model, out totalrowcount));
 }
Esempio n. 17
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;
 }
Esempio n. 18
0
        /// <summary>
        /// 更新状态为已取消(前端使用)
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>
        public int UpdateToCancle(int aid, int ispipei)
        {
            int result = 0;

            using (TransactionScope scope = new TransactionScope())
            {
                //更改单据状态
                int rowcount = AcceptHelpOrderDAL.UpdateStatus(aid, 3);
                if (rowcount < 1)
                {
                    return(0);
                }
                //返还会员对应类型的资金
                AcceptHelpOrderModel order = AcceptHelpOrderDAL.GetAcceptOrderInfo(aid);
                if (order.SourceType == 1)//静态资金
                {
                    rowcount = MemberCapitalDetailDAL.UpdateMemberStaticCapital(order.MemberID, order.Amount, order.MemberName, order.MemberPhone);
                }
                else if (order.SourceType == 2)//动态资金
                {
                    rowcount = MemberCapitalDetailDAL.UpdateMemberDynamicFunds(order.MemberID, order.Amount, 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      = aid;
                logmodel.ProduceMoney = order.Amount;
                logmodel.Remark       = "会员:" + order.MemberPhone + " 取消提供帮助,返还扣减的资金 " + order.Amount.ToString() + "元";
                logmodel.Type         = 5;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return(0);
                }
                if (ispipei > 0)//若已经匹配则取消对应单据的信息
                {
                    List <MatchOrderModel> matchs = MatchOrderDAL.GetMatchOrderInfo(0, aid);
                    rowcount = MatchOrderDAL.UpdateStatus(0, aid);//更改状态为取消
                    if (rowcount < 1)
                    {
                        return(0);
                    }
                    foreach (var item in matchs)//更改接受帮助订单的状态
                    {
                        rowcount = HelpeOrderDAL.CancleOrderForHelp(item.HelperOrderID, item.MatchedMoney);
                        if (rowcount < 1)
                        {
                            return(0);
                        }
                    }
                }
                scope.Complete();
                result = 1;
            }
            return(result);
        }