public IEnumerable <Setup> Get()
        {
            List <Setup> setups = new List <Setup>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Setup;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Setup newSetup = new Setup();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "SetupID":
                                newSetup.SetupID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "AddressID":
                                newSetup.AddressID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "EquipmentID":
                                newSetup.EquipmentID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "DoctorFirstName":
                                newSetup.DoctorFirstName = (string)DataReader.GetValue(i);
                                break;

                            case "DoctroLastName":
                                newSetup.DoctroLastName = (string)DataReader.GetValue(i);
                                break;

                            case "RoomNumber":
                                newSetup.RoomNumber = ushort.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "Image":
                                newSetup.Image = (string)DataReader.GetValue(i);
                                break;

                            case "SetUpDescription":
                                newSetup.SetUpDescription = (string)DataReader.GetValue(i);
                                break;
                            }
                        }
                        setups.Add(newSetup);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(setups);
        } //connects to server, runs query Select * from Setup and returns a list of Setup objects
示例#2
0
        public IEnumerable <Address> Get()
        {
            List <Address> address = new List <Address>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Address;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Address newAddress = new Address();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "AddressID":
                                newAddress.AddressID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "BuildingName":
                                newAddress.BuildingName = (string)DataReader.GetValue(i);
                                break;

                            case "AddressLine1":
                                newAddress.AddressLine1 = (string)DataReader.GetValue(i);
                                break;

                            case "AddressLine2":
                                newAddress.AddressLine2 = (string)DataReader.GetValue(i);
                                break;

                            case "City":
                                newAddress.City = (string)DataReader.GetValue(i);
                                break;

                            case "State":
                                newAddress.State = (string)DataReader.GetValue(i);
                                break;

                            case "Zipcode":
                                newAddress.Zipcode = (string)DataReader.GetValue(i);
                                break;
                            }
                        }
                        address.Add(newAddress);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(address);
        }
        public IEnumerable <Tech> Get()
        {
            List <Tech> techs = new List <Tech>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Tech;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Tech newtech = new Tech();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "TechID":
                                newtech.TechID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "FirstName":
                                newtech.FirstName = (string)DataReader.GetValue(i);
                                break;

                            case "LastName":
                                newtech.LastName = (string)DataReader.GetValue(i);
                                break;

                            case "JobRole":
                                newtech.JobRole = (string)DataReader.GetValue(i);
                                break;

                            case "Email":
                                newtech.Email = (string)DataReader.GetValue(i);
                                break;

                            case "PhoneNumber":
                                newtech.PhoneNumber = (string)DataReader.GetValue(i);
                                break;

                            case "IsWorking":
                                newtech.IsWorking = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        techs.Add(newtech);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(techs);
        } //connects to server, runs query Select * from Tech and returns a list of Tech objects
        public IEnumerable <Equipment> Get()
        {
            List <Equipment> equipment = new List <Equipment>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Equipment;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Equipment newEquipment = new Equipment();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "EquipmentID":
                                newEquipment.EquipmentID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "LaserID":
                                newEquipment.LaserID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "LensID":
                                newEquipment.LensID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "PhacoID":
                                newEquipment.PhacoID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "ScopeID":
                                newEquipment.ScopeID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "VanID":
                                newEquipment.VanID = int.Parse(DataReader.GetValue(i).ToString());
                                break;
                            }
                        }
                        equipment.Add(newEquipment);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(equipment);
        } //connects to server, runs query Select * from Equipment and returns a list of Equipment objects
示例#5
0
        public IEnumerable <Van> Get()
        {
            List <Van> vans = new List <Van>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Van;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Van newVan = new Van();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "VanID":
                                newVan.VanID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "Brand":
                                newVan.Brand = (string)DataReader.GetValue(i);
                                break;

                            case "Model":
                                newVan.Model = (string)DataReader.GetValue(i);
                                break;

                            case "Length":
                                newVan.Length = (string)DataReader.GetValue(i);
                                break;

                            case "Height":
                                newVan.Height = (string)DataReader.GetValue(i);
                                break;

                            case "InUse":
                                newVan.InUse = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        vans.Add(newVan);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(vans);
        } //connects to server, runs query Select * from Van and returns a list of Van objects
        public IEnumerable <Appointment> Get()
        {
            List <Appointment> appointments = new List <Appointment>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Appointment;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Appointment newAppointment = new Appointment();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "AppointmentID":
                                newAppointment.AppointmentID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "CustomerID":
                                newAppointment.CustomerID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "DateTimeStart":
                                newAppointment.DateTimeStart = DateTime.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "DateTimeEnd":
                                newAppointment.DateTimeEnd = DateTime.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "ShipDate":
                                newAppointment.ShipDate = DateTime.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "IsActive":
                                newAppointment.IsActive = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        appointments.Add(newAppointment);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(appointments);
        } //connects to server, runs query Select * from Customer and returns a list of Customer objects
示例#7
0
        public IEnumerable <Scope> Get()
        {
            List <Scope> scopes = new List <Scope>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Scope;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Scope newScope = new Scope();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "ScopeID":
                                newScope.ScopeID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "Brand":
                                newScope.Brand = (string)DataReader.GetValue(i);
                                break;

                            case "Model":
                                newScope.Model = (string)DataReader.GetValue(i);
                                break;

                            case "ScopeName":
                                newScope.ScopeName = (string)DataReader.GetValue(i);
                                break;

                            case "IsActive":
                                newScope.IsActive = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        scopes.Add(newScope);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(scopes);
        } //connects to server, runs query Select * from Scope and returns a list of Scope objects
示例#8
0
        public IEnumerable <OnCallTechs> Get()
        {
            List <OnCallTechs> onCallTechs = new List <OnCallTechs>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM OnCallTechs;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        OnCallTechs newOnCallTechs = new OnCallTechs();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "OnCallTechID":
                                newOnCallTechs.OnCallTechID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "TechPrimaryID":
                                newOnCallTechs.TechPrimaryID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "TechSecondaryID":
                                newOnCallTechs.TechSecondaryID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "TechTertiaryID":
                                newOnCallTechs.TechTertiaryID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "TechAvailable":
                                newOnCallTechs.TechAvailable = byte.Parse(DataReader.GetValue(i).ToString());
                                break;
                            }
                        }
                        onCallTechs.Add(newOnCallTechs);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(onCallTechs);
        } //connects to server, runs query Select * from OnCallTechs and returns a list of OnCallTechs objects
        public IEnumerable <Phaco> Get()
        {
            List <Phaco> phacos = new List <Phaco>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Scope;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Phaco newPhaco = new Phaco();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "PhacoID":
                                newPhaco.PhacoID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "Brand":
                                newPhaco.Brand = (string)DataReader.GetValue(i);
                                break;

                            case "Model":
                                newPhaco.Model = (string)DataReader.GetValue(i);
                                break;

                            case "PhacoName":
                                newPhaco.PhacoName = (string)DataReader.GetValue(i);
                                break;

                            case "IsActive":
                                newPhaco.IsActive = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        phacos.Add(newPhaco);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(phacos);
        } //connects to server, runs query Select * from Phaco and returns a list of Phaco objects
示例#10
0
        public IEnumerable <Laser> Get()
        {
            List <Laser> lasers = new List <Laser>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Lens;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Laser newLaser = new Laser();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "LenseID":
                                newLaser.LaserID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "LenseName":
                                newLaser.LaserName = (string)DataReader.GetValue(i);
                                break;

                            case "Brand":
                                newLaser.Brand = (string)DataReader.GetValue(i);
                                break;

                            case "Model":
                                newLaser.Model = (string)DataReader.GetValue(i);
                                break;

                            case "IsActive":
                                newLaser.IsActive = (bool)DataReader.GetValue(i);
                                break;
                            }
                        }
                        lasers.Add(newLaser);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(lasers);
        } //connects to server, runs query Select * from Laser and returns a list of Laser objects
        public IEnumerable <Customer> Get()
        {
            List <Customer> customers = new List <Customer>();

            _Connector.Connect();
            MySqlCommand execute = new MySqlCommand("SELECT * FROM Customer;", _Connector.database);

            using (MySqlDataReader DataReader = execute.ExecuteReader())
            {
                do
                {
                    while (DataReader.Read())
                    {
                        Customer newCustomer = new Customer();
                        for (int i = 0; i < DataReader.FieldCount; i++)
                        {
                            switch (DataReader.GetName(i))
                            {
                            case "CustomerID":
                                newCustomer.CustomerID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "SetupID":
                                newCustomer.SetupID = int.Parse(DataReader.GetValue(i).ToString());
                                break;

                            case "OnCallTechsID":
                                newCustomer.OnCallTechsID = int.Parse(DataReader.GetValue(i).ToString());
                                break;
                            }
                        }
                        customers.Add(newCustomer);
                    }
                } while (DataReader.NextResult());
            }
            execute.Dispose();
            _Connector.Disconnect();
            return(customers);
        } //connects to server, runs query Select * from Customer and returns a list of Customer objects