public List<UpcomingsEntity> GetClientUpcomings(string agentid, string clientid) { DataTable dt = new LogDAL().GetClientUpcomings(agentid, clientid); List<UpcomingsEntity> list = new List<UpcomingsEntity>(); foreach (DataRow dr in dt.Rows) { UpcomingsEntity entity = new UpcomingsEntity(); entity.FillData(dr); list.Add(entity); } return list; }
public AgentActionEntity GetAgentActions(string agentid) { string datestr = DateTime.Now.ToString("yyyy-MM-dd"); if (AgentActions.ContainsKey(agentid)) { var obj = AgentActions[agentid]; if (obj.Date == datestr) { return obj; } DataTable dt = new LogDAL().GetAgentActions(datestr + " 00:00:00", agentid); AgentActionEntity model = new AgentActionEntity(); model.Date = datestr; model.Actions = new List<ActionTypeEntity>(); foreach (DataRow dr in dt.Rows) { ActionTypeEntity entity = new ActionTypeEntity(); entity.FillData(dr); model.Actions.Add(entity); } obj = model; return obj; } else { DataTable dt = new LogDAL().GetAgentActions(datestr + " 00:00:00", agentid); AgentActionEntity model = new AgentActionEntity(); model.Date = datestr; model.Actions = new List<ActionTypeEntity>(); foreach (DataRow dr in dt.Rows) { ActionTypeEntity entity = new ActionTypeEntity(); entity.FillData(dr); model.Actions.Add(entity); } AgentActions.Add(agentid, model); return model; } }