public void Add(MsgUser MsgUser, string AgentId, bool?IsShowSupAgent) { if (MsgUser.UId == 0) { Response.Redirect("/Manage/home/error.html?msg=参数错误~"); return; } string sendUsers = ""; //根据代理商发送 //if (IsState == "0") //{ // int AId = Convert.ToInt32(AgentId); // IList<Users> listUser = new List<Users>(); // //获取代理商 // SysAgent LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == AId).FirstOrNew(); // //是否要显示下级 // if ((bool)IsShowSupAgent) // { // IList<SysAgent> SysAgentList = LowerLevelAgent.GetSupAgent(Entity); // listUser = SysAgentList.GetAgentUsers(Entity); // } // else // { // listUser = LowerLevelAgent.GetAgentUsers(Entity); // } // if (listUser.Count > 1) // { // MsgUser.UId = 0; // foreach (var item in listUser) // { // sendUsers += item.Id + ","; // } // } // else // { // MsgUser.UId = listUser[0].Id; // } //} MsgUser.PId = AdminUser.Id; MsgUser.SendUsers = !string.IsNullOrWhiteSpace(sendUsers) ? "," + sendUsers : sendUsers; MsgUser.AddTime = DateTime.Now; MsgUser.ReadUsers = string.Empty; MsgUser.DeleteUsers = string.Empty; Entity.MsgUser.AddObject(MsgUser); Entity.SaveChanges(); if (string.IsNullOrWhiteSpace(MsgUser.SendUsers)) { MsgUser.PushMsg(Entity); } BaseRedirect(); }
public void Add(MsgUser MsgUser, bool?IsShowSupAgent) { if (MsgUser.UId == 0) { Response.Redirect("/Agent/home/error.html?msg=参数错误~"); return; } IList <Users> listUser = new List <Users>(); string sendUsers = ""; //获取代理商 SysAgent LowerLevelAgent = null; #region 单个用户或者全体商户 处理 //if (MsgUser.UId == 0) //{ // LowerLevelAgent = Entity.SysAgent.Where(s => s.Id == BasicAgent.Id).FirstOrNew(); // //是否要显示下级 // if ((bool)IsShowSupAgent) // { // IList<SysAgent> SysAgentList = LowerLevelAgent.GetSupAgent(Entity); // listUser = SysAgentList.GetAgentUsers(Entity); // } // else // { // listUser = LowerLevelAgent.GetAgentUsers(Entity); // } // if (listUser.Count > 0) // { // MsgUser.UId = 0; // foreach (var item in listUser) // { // sendUsers += item.Id + ","; // } // } //} #endregion MsgUser.PId = AdminUser.Id; //MsgUser.SendUsers = !string.IsNullOrWhiteSpace(sendUsers) ? "," + sendUsers : ",0,"; MsgUser.SendUsers = ""; MsgUser.AddTime = DateTime.Now; MsgUser.ReadUsers = string.Empty; MsgUser.DeleteUsers = string.Empty; Entity.MsgUser.AddObject(MsgUser); Entity.SaveChanges(); if (MsgUser.UId > 0) { MsgUser.PushMsg(Entity); } BaseRedirect(); }