Пример #1
0
        //public IQueryable<Attendee> GetAttendees()
        //{
        //    var _db = new ClarityClientConference.Models.ClarityContext();
        //    var attendingClients = _db.Database.SqlQuery<int>("SELECT DISTINCT ClientId FROM dbo.Attendee");
                
        //        //("Select ClientID from Attendees").ToList<int>();
        //    IQueryable<Attendee> query = _db.Attendees;
        //    return query;
        //}

        public List<int> GetClientIds()
        {
            var _db = new ClarityClientConference.Models.ClarityContext();
            var attendingClients = _db.Database.SqlQuery<int>("SELECT DISTINCT ClientID FROM Attendees");

            return attendingClients.ToList<int>();
        }
Пример #2
0
        public List <Attendee> GetAttendeesForClient(int cid)
        {
            var _db       = new ClarityClientConference.Models.ClarityContext();
            var attendees = _db.Database.SqlQuery <Attendee>("SELECT * FROM Attendees WHERE ClientID = @cid", new SqlParameter("cid", cid)).ToList <Attendee>();

            return(attendees.ToList());
        }
Пример #3
0
        //public IQueryable<Attendee> GetAttendees()
        //{
        //    var _db = new ClarityClientConference.Models.ClarityContext();
        //    var attendingClients = _db.Database.SqlQuery<int>("SELECT DISTINCT ClientId FROM dbo.Attendee");

        //        //("Select ClientID from Attendees").ToList<int>();
        //    IQueryable<Attendee> query = _db.Attendees;
        //    return query;
        //}

        public List <int> GetClientIds()
        {
            var _db = new ClarityClientConference.Models.ClarityContext();
            var attendingClients = _db.Database.SqlQuery <int>("SELECT DISTINCT ClientID FROM Attendees");

            return(attendingClients.ToList <int>());
        }
Пример #4
0
        public List<Attendee> GetAttendeesByClient()
        {
            var attendeeList = new List<Attendee>();
            var _db = new ClarityClientConference.Models.ClarityContext();
            var clientIdList = GetClientIds();
            foreach (var cid in clientIdList)
            {
                var attendees = _db.Database.SqlQuery<Attendee>("SELECT * FROM Attendees WHERE ClientID = @cid", new SqlParameter("cid", cid)).ToList<Attendee>();
                if (attendees != null)
                {
                    attendeeList.AddRange(attendees);
                }
            }

            return attendeeList;
        }
Пример #5
0
        public List <Client> GetAttendingClients()
        {
            var clientList   = new List <Client>();
            var _db          = new ClarityClientConference.Models.ClarityContext();
            var clientIdList = GetClientIds();

            foreach (var cid in clientIdList)
            {
                var client = _db.Database.SqlQuery <Client>("SELECT * FROM Clients WHERE ClientID = @cid", new SqlParameter("cid", cid)).FirstOrDefault();
                if (client != null)
                {
                    clientList.Add(client);
                }
            }

            return(clientList);
        }
Пример #6
0
        public List <Attendee> GetAttendeesByClient()
        {
            var attendeeList = new List <Attendee>();
            var _db          = new ClarityClientConference.Models.ClarityContext();
            var clientIdList = GetClientIds();

            foreach (var cid in clientIdList)
            {
                var attendees = _db.Database.SqlQuery <Attendee>("SELECT * FROM Attendees WHERE ClientID = @cid", new SqlParameter("cid", cid)).ToList <Attendee>();
                if (attendees != null)
                {
                    attendeeList.AddRange(attendees);
                }
            }

            return(attendeeList);
        }
Пример #7
0
        protected void registerBtn_click(object sender, EventArgs e)
        {
            // validate data first
            String attendeeName = name.Text;
            String attendeeEmail = email.Text;
            String attendeeCompany = client.Text;

            // Get clientID from textbox (error if not found)
            var _db = new ClarityClientConference.Models.ClarityContext();
            var cid = _db.Database.SqlQuery<int>("SELECT DISTINCT ClientID FROM Clients WHERE Name = @attendeeCompany", new SqlParameter("attendeeCompany", attendeeCompany)).FirstOrDefault();
            if (cid < 1)
            {
                // Client not found
                successLabel.Text = "Company was not found in Clarity's client database.  Is there a misspelling?";
            }
            else
            {
                InsertAttendee(attendeeName, attendeeEmail, cid);
                successLabel.Text = "Registration successful!";
            }      
        }
Пример #8
0
        protected void registerBtn_click(object sender, EventArgs e)
        {
            // validate data first
            String attendeeName    = name.Text;
            String attendeeEmail   = email.Text;
            String attendeeCompany = client.Text;

            // Get clientID from textbox (error if not found)
            var _db = new ClarityClientConference.Models.ClarityContext();
            var cid = _db.Database.SqlQuery <int>("SELECT DISTINCT ClientID FROM Clients WHERE Name = @attendeeCompany", new SqlParameter("attendeeCompany", attendeeCompany)).FirstOrDefault();

            if (cid < 1)
            {
                // Client not found
                successLabel.Text = "Company was not found in Clarity's client database.  Is there a misspelling?";
            }
            else
            {
                InsertAttendee(attendeeName, attendeeEmail, cid);
                successLabel.Text = "Registration successful!";
            }
        }
Пример #9
0
        public List<Client> GetAttendingClients()
        {
            var clientList = new List<Client>();
            var _db = new ClarityClientConference.Models.ClarityContext();
            var clientIdList = GetClientIds();
            foreach (var cid in clientIdList)
            {  
                var client = _db.Database.SqlQuery<Client>("SELECT * FROM Clients WHERE ClientID = @cid", new SqlParameter("cid", cid)).FirstOrDefault();
                if (client != null)
                {
                    clientList.Add(client);
                }        
            }

            return clientList;
        }
Пример #10
0
 public List<Attendee> GetAttendeesForClient(int cid)
 {
     var _db = new ClarityClientConference.Models.ClarityContext();
     var attendees = _db.Database.SqlQuery<Attendee>("SELECT * FROM Attendees WHERE ClientID = @cid", new SqlParameter("cid", cid)).ToList<Attendee>();
     return attendees.ToList();
 }