Ejemplo n.º 1
0
        public TeamEntity GetTeamByID(string teamid, string agentid)
        {

            if (string.IsNullOrEmpty(teamid))
            {
                return null;
            }
            var list = GetTeams(agentid);
            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(agentid).Where(m => m.TeamID == model.TeamID).ToList();
                Teams[teamid].Add(model);
            }
            
            return model;
        }
Ejemplo n.º 2
0
        public List<TeamEntity> GetTeams(string agentid)
        {
            if (Teams.ContainsKey(agentid))
            {
                return Teams[agentid];
            }

            List<TeamEntity> list = new List<TeamEntity>();
            DataTable dt = SystemDAL.BaseProvider.GetTeams(agentid);
            foreach (DataRow dr in dt.Rows)
            {
                TeamEntity model = new TeamEntity();
                model.FillData(dr);
                model.Users = OrganizationBusiness.GetUsers(agentid).Where(m => m.TeamID == model.TeamID).ToList();
                list.Add(model);
            }
            Teams.Add(agentid, list);

            return list;

        }