public TeamEntity GetTeamByID(string teamid, string clientid) { if (string.IsNullOrEmpty(teamid)) { return(null); } var list = GetTeams(clientid); if (list.Where(m => m.TeamID == teamid).Count() > 0) { return(list.Where(m => m.TeamID == teamid).FirstOrDefault()); } TeamEntity model = new TeamEntity(); DataTable dt = SystemDAL.BaseProvider.GetTeamByID(teamid); if (dt.Rows.Count > 0) { model.FillData(dt.Rows[0]); model.Users = OrganizationBusiness.GetUsers(clientid).Where(m => m.TeamID == model.TeamID).ToList(); Teams[teamid].Add(model); } return(model); }
public bool DeleteTeam(string teamid, string userid, string ip, string clientid) { bool bl = SystemDAL.BaseProvider.DeleteTeam(teamid, userid); if (bl) { var model = GetTeamByID(teamid, clientid); var list = OrganizationBusiness.GetUsers(clientid).Where(m => m.TeamID == teamid).ToList(); foreach (var user in list) { user.TeamID = ""; } Teams[clientid].Remove(model); } return(bl); }
public List <TeamEntity> GetTeams(string clientid) { if (Teams.ContainsKey(clientid)) { return(Teams[clientid]); } List <TeamEntity> list = new List <TeamEntity>(); DataTable dt = SystemDAL.BaseProvider.GetTeams(clientid); foreach (DataRow dr in dt.Rows) { TeamEntity model = new TeamEntity(); model.FillData(dr); model.Users = OrganizationBusiness.GetUsers(clientid).Where(m => m.TeamID == model.TeamID).ToList(); list.Add(model); } Teams.Add(clientid, list); return(list); }