public HttpResponseMessage GetBrokerWithdraw(EnumBrokerWithdrawSearchOrderBy orderByAll = EnumBrokerWithdrawSearchOrderBy.State, bool isDes = true, int page = 1, int pageSize = 10) { var condition = new BrokerWithdrawSearchCondition { OrderBy = orderByAll, Page = Convert.ToInt32(page), PageCount = pageSize, isDescending = isDes }; var list = _brokerwithdrawService.GetBrokerWithdrawsByCondition(condition).Select(p => new { Id = p.Id, bankname = p.BankCard.Bank.Codeid, banknumber = p.BankCard.Num, brokername = p.Broker.Brokername, withdrawnum = p.WithdrawTotalNum, state = p.State, accacount = p.AccAccountantId.Brokername, WithdrawTime = p.WithdrawTime }).ToList().Select(p => new { Id = p.Id, bankname = p.bankname, banknumber = p.banknumber, withdrawnum = p.withdrawnum, brokername = p.brokername, state = p.state, accacount = p.accacount, WithdrawTime = p.WithdrawTime.ToString("yyyy-MM-dd") }); var Count = _brokerwithdrawService.GetBrokerWithdrawCount(condition); return(PageHelper.toJson(new { List = list, Condition = condition, totalCount = Count })); }
public HttpResponseMessage DeleteBankCard([FromBody] string id) { if (!string.IsNullOrEmpty(id) && id != "0") { int Id; if (!Int32.TryParse(id, out Id)) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据异常"))); } var user = (UserBase)_workContext.CurrentUser; if (user != null) { var broker = _brokerService.GetBrokerByUserId(user.Id);//获取当前经纪人 if (broker == null) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "获取用户失败,请检查是否登陆"))); } else { int [] ids = { Id }; var bankcardSearchCon = new BankCardSearchCondition { Brokers = broker, Ids = ids }; if (_bankcardService.GetBankCardCount(bankcardSearchCon) > 0)//判断是否是自己的卡 { var Bank = _bankcardService.GetBankCardById(Id); if (Bank == null) { return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据异常"))); } BankCardEntity[] banks = { Bank }; BrokerWithdrawSearchCondition bwithSearchCon = new BrokerWithdrawSearchCondition { Brokers = broker, BankCards = banks }; if (_brokerwithdrawService.GetBrokerWithdrawCount(bwithSearchCon) > 0)//判断用户提现表是否使用此卡 { return(PageHelper.toJson(PageHelper.ReturnValue(false, "有该银行相关提现数据不能删除"))); } _bankcardService.Delete(Bank); return(PageHelper.toJson(PageHelper.ReturnValue(true, "删除成功"))); } else { return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据异常"))); } } } } return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据异常"))); }