Ejemplo n.º 1
0
        /// <summary>
        /// 账户花销(包含写帐户日志)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool AccountExpend(decimal orderId,string ip)
        {
            Bll.Order.TOrderBLL obll = new TMM.Service.Bll.Order.TOrderBLL();
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            TOrder o = obll.Get(orderId);
            MAccount acc = GetByUserId(o.UserId);
            if (acc.Amount >= o.Total)
            {

                AccountLog accLog = new AccountLog()
                {
                    UserId = o.UserId,
                    OrderId = o.OrderId,
                    Amount = -o.Total,
                    AccountWay = (int)AmountWay.Out,
                    Ip = ip
                };

                albll.Insert(accLog);
                acc.Amount = acc.Amount - o.Total;
                return Update(acc);
            }
            return false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 账户花销(包含写帐户日志)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool AccountExpend(decimal orderId, string ip)
        {
            Bll.Order.TOrderBLL     obll  = new TMM.Service.Bll.Order.TOrderBLL();
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            TOrder   o   = obll.Get(orderId);
            MAccount acc = GetByUserId(o.UserId);

            if (acc.Amount >= o.Total)
            {
                AccountLog accLog = new AccountLog()
                {
                    UserId     = o.UserId,
                    OrderId    = o.OrderId,
                    Amount     = -o.Total,
                    AccountWay = (int)AmountWay.Out,
                    Ip         = ip
                };

                albll.Insert(accLog);
                acc.Amount = acc.Amount - o.Total;
                return(Update(acc));
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 帐户充值 for 投稿收入(包含写帐户日志)
        /// </summary>
        /// <param name="userId">投稿人</param>
        /// <param name="amount"></param>
        /// <param name="ip"></param>
        /// <param name="payway"></param>
        /// <param name="remark">将悬赏文档的名称写入备注</param>
        /// <returns></returns>
        public bool AddAmount(int userId, decimal amount, string ip, string remark)
        {
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            //写账户日志
            AccountLog accLog = new AccountLog()
            {
                UserId      = userId,
                Amount      = amount,
                AccountWay  = (int)AmountWay.INCOME_TG,
                Ip          = ip,
                PayWay      = 0,
                AdminRemark = remark
            };

            albll.Insert(accLog);
            //更新账户
            MAccount acc = GetByUserId(userId);

            acc.Amount = acc.Amount + amount;
            return(Update(acc));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 帐户花销 for 购买悬赏文档(包含写帐户日志)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="total"></param>
        /// <param name="ip"></param>
        /// <returns></returns>
        public bool AccountExpend(int userId, decimal total, string ip, string remark)
        {
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            MAccount acc = GetByUserId(userId);

            if (acc.Amount >= total)
            {
                AccountLog accLog = new AccountLog()
                {
                    UserId      = userId,
                    Amount      = -total,
                    AccountWay  = (int)AmountWay.ROut,
                    Ip          = ip,
                    PayWay      = 0,
                    AdminRemark = remark
                };

                albll.Insert(accLog);
                acc.Amount = acc.Amount - total;
                return(Update(acc));
            }
            return(false);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 账户充值 for 订单
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <param name="amount">金额</param>
        public bool AddAmount(decimal orderId, decimal amount, string ip, int payway)
        {
            Bll.Order.TOrderBLL     obll  = new TMM.Service.Bll.Order.TOrderBLL();
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            TOrder o = obll.Get(orderId);
            //写账户日志
            AccountLog accLog = new AccountLog()
            {
                UserId     = o.UserId,
                OrderId    = o.OrderId,
                Amount     = amount,
                AccountWay = (int)AmountWay.In,
                Ip         = ip,
                PayWay     = payway
            };

            albll.Insert(accLog);
            //更新账户
            MAccount acc = GetByUserId(o.UserId);

            acc.Amount = acc.Amount + amount;
            return(Update(acc));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 帐户花销 for 购买悬赏文档(包含写帐户日志)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="total"></param>
        /// <param name="ip"></param>
        /// <returns></returns>
        public bool AccountExpend(int userId, decimal total, string ip,string remark)
        {
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            MAccount acc = GetByUserId(userId);
            if (acc.Amount >= total)
            {

                AccountLog accLog = new AccountLog()
                {
                    UserId = userId,
                    Amount = -total,
                    AccountWay = (int)AmountWay.ROut,
                    Ip = ip,
                    PayWay = 0,
                    AdminRemark = remark
                };

                albll.Insert(accLog);
                acc.Amount = acc.Amount - total;
                return Update(acc);
            }
            return false;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 帐户充值 for 投稿收入(包含写帐户日志)
        /// </summary>
        /// <param name="userId">投稿人</param>
        /// <param name="amount"></param>
        /// <param name="ip"></param>
        /// <param name="payway"></param>
        /// <param name="remark">将悬赏文档的名称写入备注</param>
        /// <returns></returns>
        public bool AddAmount(int userId, decimal amount, string ip,string remark)
        {
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            //写账户日志
            AccountLog accLog = new AccountLog()
            {
                UserId = userId,
                Amount = amount,
                AccountWay = (int)AmountWay.INCOME_TG,
                Ip = ip,
                PayWay = 0,
                AdminRemark = remark
            };
            albll.Insert(accLog);
            //更新账户
            MAccount acc = GetByUserId(userId);
            acc.Amount = acc.Amount + amount;
            return Update(acc);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 账户充值 for 订单
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <param name="amount">金额</param>
        public bool AddAmount(decimal orderId, decimal amount,string ip,int payway)
        {
            Bll.Order.TOrderBLL obll = new TMM.Service.Bll.Order.TOrderBLL();
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            TOrder o = obll.Get(orderId);
            //写账户日志
            AccountLog accLog = new AccountLog() {
                UserId = o.UserId,
                OrderId = o.OrderId,
                Amount = amount,
                AccountWay = (int)AmountWay.In,
                Ip = ip,
                PayWay = payway
            };
            albll.Insert(accLog);
            //更新账户
            MAccount acc = GetByUserId(o.UserId);
            acc.Amount = acc.Amount + amount;
            return Update(acc);
        }