public ActionResult Index(JobOrders JobOrders, EFPagingInfo <JobOrders> p, bool?IsShowSupAgent, int?LowerLevel, DateTime?STime, DateTime?ETime, int IsFirst = 0) { IPageOfItems <JobOrders> JobOrdersList = null; if (IsShowSupAgent == null) { IsShowSupAgent = false; } ViewBag.BasicAgent = BasicAgent; ViewBag.IsAll = IsAll; LowerLevel = LowerLevel == null ? 0 : LowerLevel; if (IsFirst == 0) { JobOrders.State = 99; JobOrdersList = new PageOfItems <JobOrders>(new List <JobOrders>(), 0, 10, 0, new Hashtable()); } else { p = this.Condition(JobOrders, p, STime, ETime); IList <SysAgent> SysAgentList = null; if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity, true);//获取所有下级代理商信息 } UID = SysAgentList.Select(o => o.Id).ToList(); p.SqlWhere.Add(f => UID.Contains(f.AgentId)); } else { p.SqlWhere.Add(f => f.AgentId == BasicAgent.Id);//读取全部分支机构 } JobOrdersList = Entity.Selects <JobOrders>(p); } ViewBag.JobOrdersList = JobOrdersList; ViewBag.JobOrders = JobOrders; ViewBag.Edit = this.checkPower("Edit"); ViewBag.ETime = ETime; ViewBag.STime = STime; ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.LowerLevel = LowerLevel; List <int> UId = JobOrdersList.Select(o => o.UId).Distinct().ToList(); ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId.Contains(n.Id)).ToList(); return(View()); }
public ActionResult Index(ApplyJoin ApplyJoin, EFPagingInfo<ApplyJoin> p, int IsFirst = 0 ,int IsShowSupAgent = -1) { ViewBag.Save = checkPower("Save"); ViewBag.IsShowSupAgent = IsShowSupAgent; if (IsFirst == 0) { PageOfItems<ApplyJoin> ApplyJoinList1 = new PageOfItems<ApplyJoin>(new List<ApplyJoin>(), 0, 10, 0, new Hashtable()); ViewBag.ApplyJoinList = ApplyJoinList1; ViewBag.ApplyJoin = ApplyJoin; ViewBag.BasicProvinceList = Entity.BasicProvince.ToList(); ViewBag.BasicCityList = Entity.BasicCity.ToList(); return View(); } if (!ApplyJoin.ServiceType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.ServiceType == ApplyJoin.ServiceType); } if (!ApplyJoin.ApplyType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.ApplyType == ApplyJoin.ApplyType); } if (!ApplyJoin.Linker.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Linker.Contains(ApplyJoin.Linker)); } if (!ApplyJoin.Mobile.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Mobile.Contains(ApplyJoin.Mobile)); } if (!ApplyJoin.ComName.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.ComName.Contains(ApplyJoin.ComName)); } if (!ApplyJoin.Province.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Province == ApplyJoin.Province); } if (!ApplyJoin.City.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.City == ApplyJoin.City); } if (!ApplyJoin.State.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.State == ApplyJoin.State); } //List<Int32> AgentId = new List<Int32>(); //IList<SysAgent> SysAgentList = BasicAgent.GetSupAgent(Entity); //foreach (var pp in SysAgentList) //{ // AgentId.Add(pp.Id); //} //p.SqlWhere.Add(f =>AgentId.Contains(f.AgentId)); if (IsShowSupAgent == 1) { List<Int32> AgentId = new List<Int32>(); IList<SysAgent> SysAgentList = BasicAgent.GetSupAgent(Entity); foreach (var pp in SysAgentList) { AgentId.Add(pp.Id); } p.SqlWhere.Add(f => AgentId.Contains(f.AgentId)); } else { p.SqlWhere.Add(f => f.AgentId == BasicAgent.Id); } p.OrderByList.Add("Id", "DESC"); IPageOfItems<ApplyJoin> ApplyJoinList = Entity.Selects<ApplyJoin>(p); ViewBag.ApplyJoinList = ApplyJoinList; ViewBag.ApplyJoin = ApplyJoin; ViewBag.BasicProvinceList = Entity.BasicProvince.ToList(); ViewBag.BasicCityList = Entity.BasicCity.ToList(); return View(); }
/// <summary> /// /// </summary> /// <param name="Orders"></param> /// <param name="p"></param> /// <param name="IsShowSupAgent">是否显示下级</param> /// <param name="LowerLevel">下级代理商</param> /// <returns></returns> public ActionResult Index(Orders Orders, EFPagingInfo <Orders> p, bool?IsShowSupAgent, int?LowerLevel, int IsFirst = 0) { bool IsAll = false; if (checkPower("ALL")) { IsAll = true; } ViewBag.IsAll = IsAll; #region 条件校验 if (IsShowSupAgent == null) { IsShowSupAgent = false; } LowerLevel = LowerLevel == null ? 0 : LowerLevel; p.SqlWhere.Add(f => f.PayState != 0); p.SqlWhere.Add(f => f.TState == 2); if (!Orders.TNum.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TNum == Orders.TNum); } if (!Orders.TName.IsNullOrEmpty()) { IList <Users> UList = Entity.Users.Where(n => n.TrueName == Orders.TName || n.NeekName == Orders.TName || n.UserName == Orders.TName).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } if (!Orders.TType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TType == Orders.TType); } if (!Orders.AId.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AId == Orders.AId); } if (!Orders.AgentState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AgentState == Orders.AgentState); } if (!Orders.STime.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.PayTime > Orders.STime); } else { Orders.STime = DateTime.Now.AddMonths(-1); } if (!Orders.ETime.IsNullOrEmpty()) { DateTime ETime = Orders.ETime; p.SqlWhere.Add(f => f.PayTime < ETime); } else { Orders.ETime = DateTime.Now; } TimeSpan TS = Orders.ETime.Subtract(Orders.STime); int Days = TS.Days; if (Days > 31) { ViewBag.ErrorMsg = "统计时间间隔不能超过31天!"; return(View("Error")); } if (IsAll) { IList <SysAgent> SysAgentList = null; if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity, true);//获取所有下级代理商信息 } UID = SysAgentList.Select(o => o.Id).ToList(); p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == BasicAgent.Id);//读取全部分支机构 } } else { p.SqlWhere.Add(f => f.AId == AdminUser.Id);//读取用户 } #endregion p.OrderByList.Add("Id", "DESC"); IPageOfItems <Orders> OrdersList = null; if (IsFirst == 0) { OrdersList = new PageOfItems <Orders>(new List <Orders>(), 0, 10, 0, new Hashtable()); } else { OrdersList = Entity.Selects <Orders>(p); } ViewBag.OrdersList = OrdersList; ViewBag.Orders = Orders; //统计查询 if (OrdersList.TotalCount > 0) { var iquery = Entity.Orders.AsQueryable(); foreach (var item in p.SqlWhere) { iquery = iquery.Where(item); } //总金额 decimal SumAmoney = iquery.Sum(o => o.Amoney); ViewBag.SumAmoney = SumAmoney; //我的总佣金 decimal?SumMyProfit = Entity.OrderProfitLog.Where(o => o.Agent == BasicAgent.Id).Join(iquery, op => op.TNum, o => o.TNum, (op, o) => op.Profit).Sum(o => (decimal?)o); ViewBag.SumMyProfit = SumMyProfit; } //商户查询 IList <Orders> List = OrdersList.GroupBy(n => n.UId).Select(n => n.First()).ToList(); List <int> UId = new List <int>(); foreach (var pp in List) { UId.Add(pp.UId); } Dictionary <string, decimal> DicOrderProfitLog = new Dictionary <string, decimal>(); IList <Users> UsersList = Entity.Users.Where(n => UId.Contains(n.Id)).ToList(); foreach (var item in OrdersList) { DicOrderProfitLog.Add(item.TNum, Entity.OrderProfitLog.Where(o => o.TNum == item.TNum && o.Agent == BasicAgent.Id).Select(o => o.Profit).FirstOrDefault()); } ViewBag.DicOrderProfitLog = DicOrderProfitLog; ViewBag.UsersList = UsersList; ViewBag.SysAdminList = Entity.SysAdmin.Where(n => n.State == 1 && n.AgentId == AdminUser.AgentId).ToList(); //ViewBag.PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.BasicAgent = BasicAgent; SysSet SysSet = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet; ViewBag.LowerLevel = LowerLevel; ViewBag.Edit = this.checkPower("Edit"); return(View()); }
/// <summary> /// 解冻管理 /// </summary> /// <param name="Users"></param> /// <param name="p"></param> /// <returns></returns> public ActionResult Index(StopPayAudit StopPayAudit, EFPagingInfo <StopPayAudit> p, bool IsShowSupAgent = false, int LowerLevel = 0, int UserSelect = 1, int IsFirst = 0) { if (!StopPayAudit.TState.IsNullOrEmpty()) { p.SqlWhere.Add(o => o.TState == StopPayAudit.TState); } //一级只有的功能 if (BasicAgent.Tier == 1) { IList <SysAgent> SysAgentList = null; if (IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity, true);//获取所有下级代理商信息 } UID = SysAgentList.Select(o => o.Id).ToList(); p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == BasicAgent.Id);//读取全部分支机构 } } else { p.SqlWhere.Add(f => f.Agent == BasicAgent.Id); } if (!StopPayAudit.CreateAdminName.IsNullOrEmpty()) { List <int> uids = new List <int>(); if (StopPayAudit.UId == 1) { uids = Entity.Users.Where(o => o.UserName == StopPayAudit.CreateAdminName).Select(o => o.Id).ToList(); } else if (StopPayAudit.UId == 2) { uids = Entity.Users.Where(o => o.Mobile == StopPayAudit.CreateAdminName).Select(o => o.Id).ToList(); } else if (StopPayAudit.UId == 3) { uids = Entity.Users.Where(o => o.TrueName == StopPayAudit.CreateAdminName).Select(o => o.Id).ToList(); } p.SqlWhere.Add(f => uids.Contains(f.UId)); } p.OrderByList.Add("Id", "DESC"); IPageOfItems <StopPayAudit> StopPayAuditList = null; if (IsFirst == 0) { StopPayAuditList = new PageOfItems <StopPayAudit>(new List <StopPayAudit>(), 0, 10, 0, new Hashtable()); } else { StopPayAuditList = Entity.Selects <StopPayAudit>(p); } //用户表 var SPAUsersList = StopPayAuditList.Select(o => o.UId).ToList(); ViewBag.UserSelect = Entity.Users.Where(o => SPAUsersList.Contains(o.Id)).ToList(); ViewBag.StopPayAuditList = StopPayAuditList; ViewBag.StopPayAudit = StopPayAudit; ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.LowerLevel = LowerLevel; return(View()); }
public ActionResult Index(Orders Orders, EFPagingInfo <Orders> p, bool?IsShowSupAgent, int?LowerLevel, int IsFirst = 0) { if (IsFirst == 0) { if (IsShowSupAgent == null) { IsShowSupAgent = false; } if (checkPower("ALL")) { IsAll = true; } LowerLevel = LowerLevel == null ? 0 : LowerLevel; ViewBag.IsAll = IsAll; PageOfItems <Orders> OrdersList1 = new PageOfItems <Orders>(new List <Orders>(), 0, 10, 0, new Hashtable()); ViewBag.OrdersList = OrdersList1; ViewBag.Orders = Orders; //查询对应的商户 List <int> UId1 = OrdersList1.Select(o => o.UId).Distinct().ToList(); ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId1.Contains(n.Id)).ToList(); ViewBag.PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.BasicAgent = BasicAgent; SysSet SysSet1 = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet1; ViewBag.Entity = Entity; ViewBag.LowerLevel = LowerLevel; return(View()); } //if (Orders.STime.IsNullOrEmpty()) //{ // Orders.STime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //} //if (Orders.ETime.IsNullOrEmpty()) //{ // Orders.ETime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //} //if (!Orders.STime.IsNullOrEmpty() && !Orders.ETime.IsNullOrEmpty()) //{ // DateTime ETime = Orders.ETime; // p.SqlWhere.Add(f => f.PayTime > Orders.STime && f.PayTime < ETime); //} if (IsShowSupAgent == null) { IsShowSupAgent = false; } if (checkPower("ALL")) { IsAll = true; } ViewBag.IsAll = IsAll; /*有没有指定交易所属代理 * 有:校验是否从属关系 * 无:指定当前代理 */ if (!Orders.Agent.IsNullOrEmpty()) { if (!IsBelongToAgent(Orders.Agent)) { ViewBag.ErrorMsg = "只能查询当前用户下属代理的交易"; return(View("Error")); } } else { Orders.Agent = this.BasicAgent.Id; } LowerLevel = LowerLevel == null ? 0 : LowerLevel; //没有"管理所有"权限的只能看到操作员自己的数据 //if (!IsAll) //{ // p.SqlWhere.Add(f => f.AId == AdminUser.Id);//交易所属用户 //} //else { IList <SysAgent> SysAgentList = null; if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity); } else { SysAgentList = BasicAgent.GetSupAgent(Entity);//获取所有下级代理商信息 } foreach (var s in SysAgentList) { UID.Add(s.Id); } p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == Orders.Agent);//交易所属代理 } } #region 筛选条件 if (!Orders.OrderAddress.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OrderAddress.Contains(Orders.OrderAddress)); } if (!Orders.TNum.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TNum == Orders.TNum); } if (!Orders.LagEntryDay.IsNullOrEmpty()) { if (Orders.LagEntryDay == 99) { p.SqlWhere.Add(f => f.LagEntryDay == 0); } else { p.SqlWhere.Add(f => f.LagEntryDay > 0); } } if (!Orders.TrunType.IsNullOrEmpty()) { if (Orders.TrunType == 1) { p.SqlWhere.Add(f => f.TrunType == 1); } else { p.SqlWhere.Add(f => f.TrunType == 0); } } if (!Orders.TName.IsNullOrEmpty()) { IList <Users> UList = Entity.Users.Where(n => n.TrueName.Contains(Orders.TName) || n.NeekName.Contains(Orders.TName) || n.UserName == Orders.TName).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } if (!Orders.PayWay.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.PayWay == Orders.PayWay); } if (!Orders.STime.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AddTime >= Orders.STime); } if (!Orders.ETime.IsNullOrEmpty()) { DateTime ETime = Orders.ETime.AddHours(23).AddMinutes(59).AddSeconds(59); p.SqlWhere.Add(f => f.AddTime <= ETime); } #region 交易类型条件判断 p.SqlWhere.Add(f => f.TType == 2);//读取对应的类型 if (Orders.TType == 2) { if (!Orders.TState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TState == Orders.TState); } } #endregion #endregion p.OrderByList.Add("Id", "DESC"); IPageOfItems <Orders> OrdersList = Entity.Selects <Orders>(p); ViewBag.OrdersList = OrdersList; ViewBag.Orders = Orders; //查询对应的商户 List <int> UId = OrdersList.Select(o => o.UId).Distinct().ToList(); ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId.Contains(n.Id)).ToList(); //因为上面判段过了,这里其实是不用的 //if (checkPower("ALL")) //{ // ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && n.Agent == AdminUser.AgentId && UId.Contains(n.Id)).ToList(); //} //else //{ // ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && n.AId == AdminUser.Id && UId.Contains(n.Id)).ToList(); //} ViewBag.PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.BasicAgent = BasicAgent; SysSet SysSet = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet; ViewBag.Entity = Entity; ViewBag.LowerLevel = LowerLevel; return(View()); }
public ActionResult Index(Orders Orders, EFPagingInfo <Orders> p, bool?IsShowSupAgent, int?LowerLevel, int IsFirst = 0) { if (IsShowSupAgent == null) { IsShowSupAgent = false; } if (IsFirst == 0) { if (checkPower("ALL")) { IsAll = true; } ViewBag.IsAll = IsAll; PageOfItems <Orders> OrdersList1 = new PageOfItems <Orders>(new List <Orders>(), 0, 10, 0, new Hashtable()); ViewBag.OrdersList = OrdersList1; ViewBag.Orders = Orders; //查询对应的商户 List <int> UId1 = OrdersList1.Select(o => o.UId).Distinct().ToList(); ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId1.Contains(n.Id)).ToList(); ViewBag.PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); ViewBag.IsShowSupAgent = false; ViewBag.BasicAgent = BasicAgent; SysSet SysSet1 = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet1; ViewBag.Entity = Entity; ViewBag.LowerLevel = 0; ViewBag.Edit = this.checkPower("Edit"); return(View()); } if (checkPower("ALL")) { IsAll = true; } ViewBag.IsAll = IsAll; /*有没有指定交易所属代理 * 有:校验是否从属关系 * 无:指定当前代理 */ if (!Orders.Agent.IsNullOrEmpty()) { if (!IsBelongToAgent(Orders.Agent)) { ViewBag.ErrorMsg = "只能查询当前用户下属代理的交易"; return(View("Error")); } } else { Orders.Agent = this.BasicAgent.Id; } LowerLevel = LowerLevel == null ? 0 : LowerLevel; //没有"管理所有"权限的只能看到操作员自己的数据 if (!IsAll) { p.SqlWhere.Add(f => f.AId == AdminUser.Id);//交易所属用户 } else { IList <SysAgent> SysAgentList = null; if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity, true);//获取所有下级代理商信息 } UID = SysAgentList.Select(o => o.Id).ToList(); p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == BasicAgent.Id);//读取全部分支机构 } } #region 筛选条件 if (!Orders.OrderAddress.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OrderAddress.Contains(Orders.OrderAddress)); } if (!Orders.TNum.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TNum == Orders.TNum); } if (!Orders.LagEntryDay.IsNullOrEmpty()) { if (Orders.LagEntryDay == 99) { p.SqlWhere.Add(f => f.LagEntryDay == 0); } else { p.SqlWhere.Add(f => f.LagEntryDay > 0); } } if (!Orders.TrunType.IsNullOrEmpty()) { if (Orders.TrunType == 1) { p.SqlWhere.Add(f => f.TrunType == 1); } else { p.SqlWhere.Add(f => f.TrunType == 0); } } if (!Orders.TName.IsNullOrEmpty()) { IList <Users> UList = Entity.Users.Where(n => n.TrueName.Contains(Orders.TName) || n.NeekName.Contains(Orders.TName) || n.UserName == Orders.TName).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } if (!Orders.PayWay.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.PayWay == Orders.PayWay); } if (!Orders.STime.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.AddTime >= Orders.STime); } if (!Orders.ETime.IsNullOrEmpty()) { DateTime ETime = Orders.ETime.AddHours(23).AddMinutes(59).AddSeconds(59); p.SqlWhere.Add(f => f.AddTime <= ETime); } #region 交易类型条件判断 if (!Orders.TType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TType == Orders.TType);//读取对应的类型 if (Orders.TType == 1) { if (!Orders.TState.IsNullOrEmpty()) { switch (Orders.TState) { case 1: //未付 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); break; case 2: //已付 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); break; case 3: //待传证照 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 1); break; case 4: //待审核 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 2); break; case 5: //审核失败 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 4); break; case 6: //退单 p.SqlWhere.Add(f => f.TState == 4); break; case 7: //待入帐 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0); break; } } } if (Orders.TType == 2) { if (!Orders.TState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TState == Orders.TState); } } if (Orders.TType == 3) { switch (Orders.TState) { case 1: //未付 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); break; case 2: //已付 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); break; case 3: //待传证照 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 1); break; case 4: //待审核 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 2); break; case 5: //审核失败 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 4); break; } } if (Orders.TType == 5) { if (!Orders.TState.IsNullOrEmpty()) { switch (Orders.TState) { case 99: //未付 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); break; case 1: //处理中 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 0); break; case 2: //已汇出 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 2); break; case 4: //出款中 p.SqlWhere.Add(f => (f.TState == 2 && f.PayState == 2 && f.IdCardState == 0) || (f.TState == 2 && f.PayState == 1 && f.IdCardState == 3)); break; case 3: //审核失败 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 4); break; case 5: //退款中 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 3); break; case 6: //已退款 p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 4); break; case 7: //待传身份证 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 1); break; case 8: //已传身份证 p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.IdCardState == 2); break; } } } if (Orders.TType == 6) { if (!Orders.TState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TState == Orders.TState); } } if (Orders.TType == 7 || Orders.TType == 8 || Orders.TType == 9) { if (!Orders.TState.IsNullOrEmpty()) { if (Orders.TState == 99) { p.SqlWhere.Add(f => f.TState == 0); } if (Orders.TState == 1) { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 0); } if (Orders.TState == 2) { p.SqlWhere.Add(f => f.TState == 2 && f.PayState == 1); } if (Orders.TState == 3)//退单 { p.SqlWhere.Add(f => f.TState == 4); } if (Orders.TState == 4)//待入帐 { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 0); } if (Orders.TState == 5)//待审核 { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 1 && f.IdCardState == 2); } if (Orders.TState == 6)//待传证照 { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 1 && f.IdCardState == 1); } if (Orders.TState == 7)//审核失败 { p.SqlWhere.Add(f => f.TState == 1 && f.PayState == 1 && f.InState == 1 && f.IdCardState == 4); } } } if (Orders.TType == 10) { if (!Orders.TState.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TState == Orders.TState); } } } #endregion #endregion p.OrderByList.Add("Id", "DESC"); IPageOfItems <Orders> OrdersList = Entity.Selects <Orders>(p); ViewBag.OrdersList = OrdersList; ViewBag.Orders = Orders; //查询对应的商户 List <int> UId = OrdersList.Select(o => o.UId).Distinct().ToList(); ViewBag.UsersList = Entity.Users.Where(n => n.State == 1 && UId.Contains(n.Id)).ToList(); ViewBag.PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.BasicAgent = BasicAgent; SysSet SysSet = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet; ViewBag.Entity = Entity; ViewBag.LowerLevel = LowerLevel; ViewBag.Edit = this.checkPower("Edit"); return(View()); }
// // GET: /ApplyCreditCard/ public ActionResult Index(ApplyCreditCard ApplyCreditCard, EFPagingInfo <ApplyCreditCard> p, DateTime?STime, DateTime?ETime, int IsFirst = 0, int IsShowSupAgent = -1, string BankName = "") { ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.Entity = Entity; if (STime.IsNullOrEmpty()) { STime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); } if (ETime.IsNullOrEmpty()) { // ETime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); ETime = DateTime.Now; } ViewBag.ETime = ETime; ViewBag.STime = STime; ViewBag.BasicBankList = Entity.BasicBank.Where(n => n.CreditCardUrl != null).ToList(); ViewBag.ApplyCreditCard = ApplyCreditCard; ViewBag.BankName = BankName; ViewBag.BasicAgent = BasicAgent; if (IsFirst == 0) { PageOfItems <ApplyCreditCard> ApplyCreditCardList1 = new PageOfItems <ApplyCreditCard>(new List <ApplyCreditCard>(), 0, 10, 0, new Hashtable()); ViewBag.ApplyCreditCardList = ApplyCreditCardList1; return(View()); } // ETime = ETime.Value.AddDays(1); p.SqlWhere.Add(f => f.AddTime >= STime && f.AddTime <= ETime); //if (BasicAgent.Tier == 1) //{ // p.SqlWhere.Add(f => f.FirstAgentId == BasicAgent.Id); //} //else //{ // p.SqlWhere.Add(f => f.AgentId == BasicAgent.Id); //} if (IsShowSupAgent == 1) { List <Int32> AgentId = new List <Int32>(); IList <SysAgent> SysAgentList = BasicAgent.GetSupAgent(Entity); foreach (var pp in SysAgentList) { AgentId.Add(pp.Id); } p.SqlWhere.Add(f => AgentId.Contains(f.AgentId)); } else { p.SqlWhere.Add(f => f.AgentId == BasicAgent.Id); } if (!BankName.IsNullOrEmpty()) { IList <BasicBank> BasicBankList = Entity.BasicBank.Where(b => b.Name.Contains(BankName)).ToList(); IList <int> BasicBankId = new List <int>(); foreach (var item in BasicBankList) { BasicBankId.Add(item.Id); } p.SqlWhere.Add(f => BasicBankId.Contains(f.BankId)); } if (!ApplyCreditCard.OrderNum.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OrderNum == ApplyCreditCard.OrderNum); } if (!ApplyCreditCard.UserMobile.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.UserMobile == ApplyCreditCard.UserMobile); } if (!ApplyCreditCard.UserName.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.UserName == ApplyCreditCard.UserName); } if (!ApplyCreditCard.State.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.State == ApplyCreditCard.State); } if (!ApplyCreditCard.FirstAgentAmount.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.FirstAgentAmount == ApplyCreditCard.FirstAgentAmount); } p.OrderByList.Add("Id", "DESC"); IPageOfItems <ApplyCreditCard> ApplyCreditCardList = Entity.Selects <ApplyCreditCard>(p); ViewBag.ApplyCreditCardList = ApplyCreditCardList; return(View()); }
public ActionResult Index(Users Users, EFPagingInfo <Users> p, bool?IsShowSupAgent, int?LowerLevel, int IsFirst = 0) { #region 条件 if (checkPower("ALL")) { IsAll = true; } if (IsShowSupAgent == null) { IsShowSupAgent = false; } LowerLevel = LowerLevel == null ? 0 : LowerLevel; ViewBag.IsAll = IsAll; /*有没有指定交易所属代理 * 有:校验是否从属关系 * 无:指定当前代理 */ if (!Users.Agent.IsNullOrEmpty()) { if (!IsBelongToAgent(Users.Agent)) { ViewBag.ErrorMsg = "只能查询当前用户下属代理的交易"; return(View("Error")); } } else { Users.Agent = this.BasicAgent.Id; } IList <SysAgent> SysAgentList = null; //没有"管理所有"权限的只能看到操作员自己的数据 if (!IsAll) { p.SqlWhere.Add(f => f.AId == AdminUser.Id);//指定的操作员 } else { if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity);//获取所有下级代理商信息 } foreach (var s in SysAgentList) { UID.Add(s.Id); } p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == Users.Agent);//指定的代理 } } if (Users.CardStae.IsNullOrEmpty()) { Users.CardStae = 2; } if (!Users.RegAddress.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.RegAddress.Contains(Users.RegAddress)); } if (!Users.UserName.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.UserName == Users.UserName); } if (!Users.TrueName.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.TrueName == Users.TrueName || f.NeekName == Users.TrueName); } if (!Users.Mobile.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.Mobile == Users.Mobile); } if (!Users.State.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.State == (Users.State == 99 ? 0 : Users.State)); } if (!Users.CardNum.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.CardNum == Users.CardNum); } if (!Users.CardStae.IsNullOrEmpty()) { int CardStae = Users.CardStae; if (CardStae == 99) { CardStae = 0; } if (CardStae != 88) { p.SqlWhere.Add(f => f.CardStae == CardStae); } } #endregion p.OrderByList.Add("Id", "DESC"); IPageOfItems <Users> UsersList = null; if (IsFirst == 0) { UsersList = new PageOfItems <Users>(new List <Users>(), 0, 10, 0, new Hashtable()); } else { UsersList = Entity.Selects <Users>(p); } foreach (var item in UsersList) { item.Address = item.QRCode(); } ViewBag.UsersList = UsersList; ViewBag.Users = Users; SysSet SysSet = Entity.SysSet.FirstOrNew(); ViewBag.SysSet = SysSet; ViewBag.IsShowSupAgent = IsShowSupAgent; ViewBag.SysAgentList = SysAgentList; ViewBag.LowerLevel = LowerLevel; ViewBag.Entity = Entity; ViewBag.IsAssureImg = checkPower("SaveAssureImg"); ViewBag.IsFrozen = this.checkPower("Frozen"); ViewBag.IsUnFrozen = this.checkPower("UnFrozen"); ViewBag.MyUsers = this.checkPower("MyUsers"); return(View()); }
public void Add(MsgAdmin MsgAdmin, int?IsObj, int?IsAdmin, int?IsPId, int?IsLevel) { string sendUsers = ""; //获取发送对象 if (IsObj.HasValue) { switch (IsObj) { case 0: //管理员 MsgAdmin.IsAdmin = 0; #region 给管理员发送 if (IsAdmin.HasValue) { if (IsAdmin.Value == 0) { //选择了所有的管理员 IList <SysAdmin> ListAdmin = BasicAgent.GetAgentAdmins(Entity); //获取所有的管理员 if (ListAdmin.Count > 1) { MsgAdmin.AId = 0; foreach (var item in ListAdmin) { sendUsers += item.Id + ","; } } else { MsgAdmin.AId = ListAdmin[0].Id; } } else { //如果选择了单个管理员 MsgAdmin.AId = IsAdmin.Value; } } #endregion break; case 1: //代理商 MsgAdmin.IsAdmin = 1; #region 给代理商发送 int isLevel = IsLevel.HasValue ? IsLevel.Value : 0; if (IsPId.HasValue) { if (IsPId.Value == 0) //如果选择的所有代理商 { IList <SysAgent> ListAgent = BasicAgent.GetSupAgent(Entity); if (isLevel == 1) { //包含下级 ListAgent = ListAgent.GetSupAgent(Entity); } IList <SysAdmin> modelAdmin = ListAgent.GetAgentAdmins(Entity); if (modelAdmin.Count > 1) { MsgAdmin.AId = 0; foreach (var adminItem in modelAdmin) { sendUsers += adminItem.Id + ","; } } else { MsgAdmin.AId = modelAdmin[0].Id; } } else //如果选择的单个代理商 { SysAgent agentModel = Entity.SysAgent.FirstOrDefault(x => x.Id == IsPId); IList <SysAdmin> modelAdmin = null; if (isLevel == 0) //不包含下级 { modelAdmin = agentModel.GetAgentAdmins(Entity); } else //包含下级 { //获取下级代理商 IList <SysAgent> ListAgent = agentModel.GetSupAgent(Entity); modelAdmin = ListAgent.GetAgentAdmins(Entity); } if (modelAdmin.Count > 1) { MsgAdmin.AId = 0; foreach (var item in modelAdmin) { sendUsers += item.Id + ","; } } else { MsgAdmin.AId = modelAdmin[0].Id; } } } #endregion break; } } MsgAdmin.PId = AdminUser.Id; MsgAdmin.SendUsers = !string.IsNullOrWhiteSpace(sendUsers) ? "," + sendUsers : ",0,"; MsgAdmin.Name = MsgAdmin.Name; MsgAdmin.Info = MsgAdmin.Info; MsgAdmin.State = MsgAdmin.State; MsgAdmin.AddTime = DateTime.Now; Entity.MsgAdmin.AddObject(MsgAdmin); Entity.SaveChanges(); BaseRedirect(); }
private EFPagingInfo <FastOrder> Condition(FastOrder FastOrder, EFPagingInfo <FastOrder> p, bool IsShowSupAgent, int LowerLevel) { #region 筛选条件 if (!FastOrder.TNum.IsNullOrEmpty()) { if (FastOrder.UId == 1) { p.SqlWhere.Add(f => f.TNum == FastOrder.TNum); } else { IList <Users> UList = Entity.Users.Where(n => n.TrueName.Contains(FastOrder.TNum) || n.NeekName.Contains(FastOrder.TNum) || n.UserName == FastOrder.TNum).ToList(); List <int> UIds = new List <int>(); foreach (var pp in UList) { UIds.Add(pp.Id); } p.SqlWhere.Add(f => UIds.Contains(f.UId)); } } if (!FastOrder.UserState.IsNullOrEmpty()) { var value = FastOrder.UserState == 99 ? 0 : FastOrder.UserState; p.SqlWhere.Add(o => o.UserState == value); } IList <SysAgent> SysAgentList = null; if ((bool)IsShowSupAgent) { IList <int> UID = new List <int>(); if (LowerLevel != 0) { SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == LowerLevel).FirstOrNew(); SysAgentList = LowerLevelAgent.GetSupAgent(Entity, true); } else { SysAgentList = BasicAgent.GetSupAgent(Entity, true);//获取所有下级代理商信息 } UID = SysAgentList.Select(o => o.Id).ToList(); p.SqlWhere.Add(f => UID.Contains(f.Agent)); } else { p.SqlWhere.Add(f => f.Agent == BasicAgent.Id);//读取全部分支机构 } if (!FastOrder.STime.IsNullOrEmpty() && !FastOrder.ETime.IsNullOrEmpty()) { DateTime ETime = FastOrder.ETime; p.SqlWhere.Add(f => f.AddTime > FastOrder.STime && f.AddTime < ETime); } #region 交易类型条件判断 if (!FastOrder.OType.IsNullOrEmpty()) { p.SqlWhere.Add(f => f.OType == FastOrder.OType);//读取对应的类型 } if (!FastOrder.State.IsNullOrEmpty()) { switch (FastOrder.State) { case 1: //未付 p.SqlWhere.Add(f => f.State == 1 && f.PayState == 0); break; case 2: //已付 p.SqlWhere.Add(f => f.State == 1 && f.PayState == 1); break; case 99: //交易关闭 p.SqlWhere.Add(f => f.State == 0); break; } } #endregion #endregion p.OrderByList.Add("Id", "DESC"); return(p); }
public object MoneySave(SysAgent SysAgent, int?AnsyCash0, int?AnsyCash1, int?AnsyNext0, int?AnsyNext1) { SysAgent.Cash0 = SysAgent.Cash0 / 1000; SysAgent.Cash1 = SysAgent.Cash1 / 1000; if (SysAgent.Cash0 < BasicSet.AgentCash0 || SysAgent.ECash0 < BasicSet.AgentECash0 || SysAgent.Cash1 < BasicSet.AgentCash1 || SysAgent.ECash1 < BasicSet.AgentECash1) { ViewBag.ErrorMsg = "费率设置有误!"; return(View("Error")); } if (SysAgent.Cash0Times > BasicSet.AgentCash0Times || SysAgent.Cash1Times > BasicSet.AgentCash1Times) { ViewBag.ErrorMsg = "费率设置有误!"; return(View("Error")); } SysAgent.Name = BasicAgent.Name; SysAgent.State = BasicAgent.State; BasicAgent = Request.ConvertRequestToModel <SysAgent>(BasicAgent, SysAgent); Entity.SaveChanges(); string AgentIds = BasicAgent.Id.ToString();//用户下方批量更新下级代理 IList <SysAgent> AgentList = null; if (!AnsyCash0.IsNullOrEmpty() || !AnsyCash1.IsNullOrEmpty() || !AnsyNext0.IsNullOrEmpty() || !AnsyNext1.IsNullOrEmpty()) { if (BasicAgent.Tier < BasicAgent.AgentLevelMax)// 当前级数小于最大级数,说明还有 { //取得代理商所有的下级 AgentList = BasicAgent.GetSupAgent(Entity, true); foreach (var p in AgentList) { AgentIds = AgentIds + "," + p.Id; } } } if (AnsyCash0 == 1)//同步到用户 { string SQL = "Update Users Set ECash0=" + BasicAgent.ECash0 + ",Cash0=" + BasicAgent.Cash0 + " where Agent in(" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); } if (AnsyCash1 == 1)//同步到用户 { string SQL = "Update Users Set ECash1=" + BasicAgent.ECash1 + ",Cash1=" + BasicAgent.Cash1 + " where Agent in(" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); } if (AnsyNext0 == 1)//同步到代理 { string SQL = "Update SysAgent Set ECash0=" + BasicAgent.ECash0 + ",Cash0=" + BasicAgent.Cash0 + ",Cash0Times=" + BasicAgent.Cash0Times + " where Id in(" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); } if (AnsyNext1 == 1)//同步到代理 { string SQL = "Update SysAgent Set ECash1=" + BasicAgent.ECash1 + ",Cash1=" + BasicAgent.Cash1 + ",Cash1Times=" + BasicAgent.Cash1Times + " where Id in(" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); } BaseRedirect(); return(null); }
public void Save(int[] PId, double[] Cost, int[] PState, int?AnsyCash, int?AnsyNext) { bool Check = true; for (int i = 0; i < PId.Length; i++) { int Pid = PId[i]; double cost = Cost[i] / 1000; PayConfig PC = Entity.PayConfig.FirstOrDefault(n => n.Id == Pid); if (PC == null) { Check = false; } if (cost >= PC.CostAgent) { UserPayAgent PCT = Entity.UserPayAgent.FirstOrNew(n => n.AId == BasicAgent.Id && n.PId == Pid); PCT.Cost = Cost[i] / 1000; if (PCT.Id.IsNullOrEmpty()) { PCT.PId = PId[i]; PCT.AId = BasicAgent.Id; Entity.UserPayAgent.AddObject(PCT); } } else { Check = false; } } if (Check) { Entity.SaveChanges(); } else { Response.Redirect("/Agent/home/error.html?msg=费率设置有误~"); return; } IList <PayConfig> PayConfigList = new List <PayConfig>(); IList <UserPayAgent> UserPayAgentList = new List <UserPayAgent>(); IList <SysAgent> AgentList = new List <SysAgent>(); string AgentIds = "0"; if (AnsyCash == 1 || AnsyNext == 1) { PayConfigList = Entity.PayConfig.Where(n => n.State == 1).ToList(); UserPayAgentList = Entity.UserPayAgent.Where(n => n.AId == BasicAgent.Id).ToList(); //取得代理商所有的下级 AgentList = BasicAgent.GetSupAgent(Entity, true); foreach (var p in AgentList) { AgentIds = AgentIds + "," + p.Id; } } if (AnsyCash == 1) { //使用删除全部后根据用户表生成,有效解决了因接口关闭或新增加接口,老用户没有配置问题 string SQL = "Delete UserPay Where UId in(Select Id From Users Where Agent in(" + AgentIds + "))"; Entity.ExecuteStoreCommand(SQL); foreach (var p in PayConfigList) { double? cost = p.CostUser; UserPayAgent PCT = UserPayAgentList.FirstOrNew(n => n.AId == BasicAgent.Id && n.PId == p.Id); if (!PCT.Id.IsNullOrEmpty()) { cost = PCT.Cost; } SQL = "INSERT INTO UserPay(UId,PId,Cost,IsDel) Select ID," + p.Id + " As PId," + cost + " As Cost, 0 As IsDel From Users where Id in(Select Id From Users Where Agent in(" + AgentIds + "))"; Entity.ExecuteStoreCommand(SQL); } } if (AnsyNext == 1) { //使用删除全部后根据用户表生成,有效解决了因接口关闭或新增加接口,老用户没有配置问题 string SQL = "Delete UserPayAgent Where AId in (" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); foreach (var p in PayConfigList) { double? cost = p.CostUser; UserPayAgent PCT = UserPayAgentList.FirstOrNew(n => n.AId == BasicAgent.Id && n.PId == p.Id); if (!PCT.Id.IsNullOrEmpty()) { cost = PCT.Cost; } SQL = "INSERT INTO UserPayAgent(AId,PId,Cost,IsDel) Select ID," + p.Id + " As PId," + cost + " As Cost, 0 As IsDel From SysAgent where Id in(" + AgentIds + ")"; Entity.ExecuteStoreCommand(SQL); } } if (AnsyCash == 1 || AnsyNext == 1) { APIExtensions.ClearCacheAll(); } BaseRedirect(); }