示例#1
0
        private async Task <IPagedList <Education_Agent> > LoadTaskDatagridAgent(int pagNumber = 1, int pageSize = 50)
        {
            try
            {
                //Cursor.Current = Cursors.WaitCursor;
                List <Education_Agent> tempUserList = new List <Education_Agent>();
                Cursor.Current = Cursors.WaitCursor;

                if (pageNumber == 0)
                {
                    pageNumber = 1;
                }
                return(await Task.Factory.StartNew(() =>
                {
                    try
                    {
                        if (FrmMain.globalListCertificateAgents == null)
                        {
                            //return dbEntities.Education_Agent
                            //.Include("Education_Service")

                            // .OrderBy(p => p.Agent_Id).ToPagedList(pagNumber, dbEntities.Education_Agent.Count());

                            using (AgentDataAccess dbRep = new AgentDataAccess())
                            {
                                List <Education_Agent> listAgent = dbRep.LoadAllAgents();
                                return listAgent.OrderBy(p => p.Agent_Id).ToPagedList(pagNumber, listAgent.Count());
                            };
                        }
                        else
                        {
                            return FrmMain.globalListCertificateAgents.ToPagedList(pagNumber, FrmMain.globalListCertificateAgents.Count);;
                        }
                    }
                    catch (Exception ex)
                    {
                        return null;
                    }
                }));
            }
            catch (StackOverflowException ex)
            {
                Logger.LogError(ex, "UC Education_Formation");
                throw;
            }
        }
        public List <AgentEntity> LoadAgentData()
        {
            IAgent agent = new AgentDataAccess();

            return(agent.GetAgentDetails());
        }