/// <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); }
/// <summary> /// 账单明细 /// </summary> public void AccountDetail(int first, string accWays, DateTime?sd, DateTime?ed) { int rows = 10; int count = 0; PropertyBag["cur_page_account"] = true; U_UserInfo logonUser = base.GetUser(); Service.Bll.Order.AccountLogBLL abll = new TMM.Service.Bll.Order.AccountLogBLL(); PropertyBag["sumIncome"] = abll.SumIncome(logonUser.UserId); //可用余额 Service.Bll.User.MAccountBLL accBll = new TMM.Service.Bll.User.MAccountBLL(); PropertyBag["acc"] = accBll.GetByUserId(logonUser.UserId); int[] accountWays = null; if (accWays == "receipt") { accountWays = new int[] { (int)AmountWay.In, (int)AmountWay.INCOME, (int)AmountWay.MIn, (int)AmountWay.INCOME_TG }; } if (accWays == "payout") { accountWays = new int[] { (int)AmountWay.Out, (int)AmountWay.ROut }; } IList <AccountLog> list = abll.GetList(logonUser.UserId, accountWays, sd, ed, first, rows, out count); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; PropertyBag["sd"] = sd; PropertyBag["ed"] = ed; }
/// <summary> /// 账单明细 /// </summary> public void AccountDetail(int first, string accWays, DateTime? sd, DateTime? ed) { int rows = 10; int count = 0; PropertyBag["cur_page_account"] = true; U_UserInfo logonUser = base.GetUser(); Service.Bll.Order.AccountLogBLL abll = new TMM.Service.Bll.Order.AccountLogBLL(); PropertyBag["sumIncome"] = abll.SumIncome(logonUser.UserId); //可用余额 Service.Bll.User.MAccountBLL accBll = new TMM.Service.Bll.User.MAccountBLL(); PropertyBag["acc"] = accBll.GetByUserId(logonUser.UserId); int[] accountWays = null; if (accWays == "receipt") { accountWays = new int[] { (int)AmountWay.In,(int)AmountWay.INCOME,(int)AmountWay.MIn,(int)AmountWay.INCOME_TG }; } if (accWays == "payout") { accountWays = new int[] { (int)AmountWay.Out,(int)AmountWay.ROut}; } IList<AccountLog> list = abll.GetList(logonUser.UserId, accountWays, sd, ed, first, rows, out count); ListPage lp = new ListPage((IList)list, first, rows, count); PropertyBag["lp"] = lp; PropertyBag["sd"] = sd; PropertyBag["ed"] = ed; }
/// <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; }
public void Initialize() { TOrderBll = new TMM.Service.Bll.Order.TOrderBLL(); TOrderDetailBll = new TMM.Service.Bll.Order.TOrderDetailBLL(); MPurchaseBll = new TMM.Service.Bll.User.MPurchaseBLL(); MAccountBll = new TMM.Service.Bll.User.MAccountBLL(); MPayLogBll = new TMM.Service.Bll.Order.MPayLogBLL(); MAccountLogBll = new TMM.Service.Bll.Order.AccountLogBLL(); DDocInfoBll = new TMM.Service.Bll.Doc.DDocInfoBLL(); UserInfoBll = new TMM.Service.Bll.User.U_UserInfoBLL(); ExchangeAccountBll = new TMM.Service.Bll.Order.ExchangeAccountBLL(); }
public void Initialize() { UserInfoBll = new TMM.Service.Bll.User.U_UserInfoBLL(); MessageBll = new TMM.Service.Bll.User.M_MessageBLL(); DocInfoBll = new TMM.Service.Bll.Doc.DDocInfoBLL(); MCatalogBll = new TMM.Service.Bll.Doc.MCatalogBLL(); MFavoriteBll = new TMM.Service.Bll.Doc.MFavoriteBLL(); DTagBll = new TMM.Service.Bll.Doc.D_TagBLL(); MPurchaseBll = new TMM.Service.Bll.User.MPurchaseBLL(); MAccountBll = new TMM.Service.Bll.User.MAccountBLL(); TReqDocBll = new TMM.Service.Bll.Doc.TReqDocBLL(); AccountLogBll = new TMM.Service.Bll.Order.AccountLogBLL(); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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; }
/// <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); }
/// <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); }