Ejemplo n.º 1
0
        public Complain Getcomplain(string cId)
        {
            Complain c     = null;
            string   query = "SELECT * from Complains WHERE CId = '" + cId + "'";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                c         = new Complain();
                c.CId     = sdr["CId"].ToString();
                c.Csub    = sdr["Csub"].ToString();
                c.Cbody   = sdr["Cbody"].ToString();
                c.CuserId = sdr["CuserId"].ToString();
            }

            dcc.CloseConnection();
            return(c);
        }
Ejemplo n.º 2
0
        public Tenant GetTenant(string tId)
        {
            Tenant t     = null;
            string query = "SELECT * from Tenants WHERE TId = '" + tId + "'";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                t             = new Tenant();
                t.TId         = sdr["TId"].ToString();
                t.Tname       = sdr["Tname"].ToString();
                t.TphnNumber  = sdr["TphnNumber"].ToString();
                t.Rent        = Convert.ToDouble(sdr["Rent"].ToString());
                t.Institution = sdr["Institution"].ToString();
            }

            dcc.CloseConnection();
            return(t);
        }
Ejemplo n.º 3
0
        public Applications GetApplication(string s)
        {
            Applications a     = null;
            string       query = "SELECT * from Applications WHERE AppId = '" + s + "'";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                a           = new Applications();
                a.AppId     = sdr["AppId"].ToString();
                a.AppuserId = sdr["Appuserid"].ToString();
                a.Astatus   = sdr["Astatus"].ToString();
                a.Appsub    = sdr["Appsub"].ToString();
                a.Appbody   = sdr["Appbody"].ToString();
            }

            dcc.CloseConnection();
            return(a);
        }
Ejemplo n.º 4
0
        public Employee GetEmployee(string empId)
        {
            Employee emp   = null;
            string   query = "SELECT * from Employees WHERE EmpId = '" + empId + "'";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                emp             = new Employee();
                emp.EmpId       = sdr["EmpId"].ToString();
                emp.Name        = sdr["Name"].ToString();
                emp.PhnNumber   = sdr["PhnNumber"].ToString();
                emp.Salary      = Convert.ToDouble(sdr["Salary"].ToString());
                emp.Designation = sdr["Designation"].ToString();
            }

            dcc.CloseConnection();
            return(emp);
        }
        public Airport SearchByString(string text)
        {
            string             query = "SELECT * from Airport WHERE Name = '%" + text + "%' OR City LIKE '%" + text + "%'";
            Airport            air1  = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                air1             = new Airport();
                air1.AirportId   = Convert.ToInt32(sdr["AirportId"]);
                air1.AirportName = sdr["Name"].ToString();
                air1.City        = sdr["City"].ToString();
            }
            dcc.CloseConnection();
            return(air1);
        }
Ejemplo n.º 6
0
        public Airplane getAirplanes(string airplaneId)
        {
            string             query = "SELECT * from Airplane WHERE AirplaneId  = '" + airplaneId + "'";
            Airplane           air   = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                air              = new Airplane();
                air.AirplaneId   = sdr["AirplaneId"].ToString();
                air.AirplaneName = sdr["AirplaneName"].ToString();
                air.Capacity     = Convert.ToInt32(sdr["Capacity"]);
            }
            dcc.CloseConnection();
            return(air);
        }
Ejemplo n.º 7
0
        public AllUsers GetUser(string userId)
        {
            string             query = "SELECT * from UserInfo WHERE UserId  = '" + userId + "' or UserType Like '" + userId + "' or UserName Like '" + userId + "' ";
            AllUsers           a     = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                a          = new AllUsers();
                a.UserId   = sdr["UserId"].ToString();
                a.UserName = sdr["UserName"].ToString();
                a.UserType = Convert.ToString(sdr["UserType"]);
            }
            dcc.CloseConnection();
            return(a);
        }
Ejemplo n.º 8
0
        public Login GetUser(string id, string password)
        {
            Login  l     = null;
            string query = "SELECT * from Login WHERE Id = '" + id + "' AND Password = '******'";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                l          = new Login();
                l.Id       = sdr["Id"].ToString();
                l.Password = sdr["Password"].ToString();
                l.Role     = Convert.ToInt32(sdr["Role"]);
            }

            dcc.CloseConnection();

            return(l);
        }
        public Airport GetAirports(string airportId)
        {
            string             query = "SELECT * from Airpprt WHERE AirportId = '" + airportId + "'";
            Airport            air1  = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                air1             = new Airport();
                air1.AirportId   = sdr["AirportID"].ToString();
                air1.AirportName = sdr["AirportName"].ToString();
                air1.City        = sdr["City"].ToString();
                air1.Airportcode = sdr["AirportCode"].ToString();
            }
            dcc.CloseConnection();
            return(air1);
        }
Ejemplo n.º 10
0
        public List <Airplane> GetAllAirplanes()
        {
            string          query   = "SELECT * from Airplane";
            List <Airplane> airList = new List <Airplane>();

            DatabaseConnection dcc = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                Airplane air = new Airplane();
                air.AirplaneId   = sdr["AirplaneId"].ToString();
                air.AirplaneName = sdr["AirplaneName"].ToString();
                air.Capacity     = Convert.ToInt32(sdr["Capacity"]);

                airList.Add(air);
            }
            dcc.CloseConnection();
            return(airList);
        }
Ejemplo n.º 11
0
        public List <AllUsers> GetAllUsers()
        {
            string          query    = "SELECT * from UserInfo";
            List <AllUsers> userList = new List <AllUsers>();

            DatabaseConnection dcc = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                AllUsers a = new AllUsers();
                a.UserId   = sdr["UserId"].ToString();
                a.UserName = sdr["UserName"].ToString();
                a.UserType = Convert.ToString(sdr["UserType"]);

                userList.Add(a);
            }
            dcc.CloseConnection();
            return(userList);
        }
Ejemplo n.º 12
0
        public AllUsers GetUserById(int uid)
        {
            string             query = "SELECT * from AllUsers WHERE UserId  = " + uid + " ";
            AllUsers           au    = new AllUsers();
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                //au = new AllUsers();
                au.UserId       = Convert.ToInt32(sdr["UserId"]);
                au.UserFullName = sdr["Fullname"].ToString();
                au.UserName     = sdr["Username"].ToString();
                au.UserType     = Convert.ToString(sdr["UserType"]);
                au.UserPassword = sdr["Password"].ToString();
                au.UserQuestion = sdr["Question"].ToString();
            }
            dcc.CloseConnection();
            return(au);
        }
        public Flight GetFlight(string flightId)
        {
            string             query = "SELECT * from Flight WHERE FlightID = '" + flightId + "' or AirlineName LIKE '%" + flightId + "%'  ";
            Flight             f     = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                f             = new Flight();
                f.FlightId    = sdr["FlightID"].ToString();
                f.AirlineName = sdr["AirlineName"].ToString();
                f.Source      = sdr["Source"].ToString();
                f.Destination = sdr["Destination"].ToString();
                f.Arrival     = Convert.ToString(sdr["Arrival"]);
                f.Departure   = Convert.ToString(sdr["Departure"]);
                f.Cost        = Convert.ToInt32(sdr["Cost"]);
            }
            dcc.CloseConnection();
            return(f);
        }
        public List <BookedSeats> getBookedTicket(int bId)
        {
            string             query = "SELECT * from BookedSeats WHERE BookTicketId  = " + bId + "";
            BookedSeats        b     = null;
            List <BookedSeats> bList = new List <BookedSeats>();
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            if (sdr.Read())
            {
                b = new BookedSeats();
                b.BookedSeatId = Convert.ToInt32(sdr["BookedSeatsId"]);
                b.Seats        = sdr["Seats"].ToString();
                b.BookTicketId = Convert.ToInt32(sdr["BookTicketId"]);
                b.FlightId     = Convert.ToInt32(sdr["FlightId"]);

                bList.Add(b);
            }
            dcc.CloseConnection();
            return(bList);
        }
        public List <Airport> GetAllAirports()
        {
            string         query   = "SELECT * from Airport";
            List <Airport> airList = new List <Airport>();

            DatabaseConnection dcc = new DatabaseConnection();

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                Airport air1 = new Airport();

                air1             = new Airport();
                air1.AirportId   = Convert.ToInt32(sdr["AirportId"]);
                air1.AirportName = sdr["Name"].ToString();
                air1.City        = sdr["City"].ToString();

                airList.Add(air1);
            }
            dcc.CloseConnection();
            return(airList);
        }
Ejemplo n.º 16
0
        public Admin GetAdmins(string adminId)
        {
            string             query  = "SELECT * from Admin WHERE Name LIKE '%" + adminId + "'% OR Username LIKE '" + adminId + "'";
            Admin              a      = null;
            string             query2 = "SELECT * FROM Passengers WHERE AdminId = " + adminId + "";
            DatabaseConnection dcc    = new DatabaseConnection();

            dcc.ConnectWithDB();


            float y;

            try
            {
                y = Convert.ToInt32(adminId) / 2;
                y = 1;
            }
            catch (Exception er) { y = -10; }

            if (y + 1 >= 1)
            {
                SqlDataReader    sdr2  = dcc.GetData(query2);
                List <Passenger> pList = new List <Passenger>();
                //id
                if (sdr2.Read())
                {
                    a          = new Admin();
                    a.AdminId  = Convert.ToInt32(sdr2["AdminId"]);
                    a.Username = sdr2["Username"].ToString();
                    a.Name     = sdr2["Name"].ToString();
                    a.Email    = sdr2["Email"].ToString();
                    a.Gender   = Convert.ToString(sdr2["Gender"]);
                    a.Address  = sdr2["Address"].ToString();
                    a.Age      = Convert.ToInt32(sdr2["Age"]);
                    a.Question = sdr2["Question"].ToString();
                    a.Password = sdr2["Password"].ToString();
                }
                dcc.CloseConnection();
                return(a);
            }
            else
            {
                SqlDataReader    sdr   = dcc.GetData(query);
                List <Passenger> pList = new List <Passenger>();
                if (sdr.Read())
                {
                    a          = new Admin();
                    a.AdminId  = Convert.ToInt32(sdr["AdminId"]);
                    a.Username = sdr["Username"].ToString();
                    a.Name     = sdr["Name"].ToString();
                    a.Email    = sdr["Email"].ToString();
                    a.Gender   = Convert.ToString(sdr["Gender"]);
                    a.Address  = sdr["Address"].ToString();
                    a.Age      = Convert.ToInt32(sdr["Age"]);
                    a.Question = sdr["Question"].ToString();
                    a.Password = sdr["Password"].ToString();
                }
                dcc.CloseConnection();
                return(a);
            }
        }
Ejemplo n.º 17
0
        public Passenger GetPassengers(string userId)
        {
            Passenger p = null;

            string             query  = "SELECT * FROM Passengers WHERE Name LIKE '%" + userId + "%' " + " OR Username LIKE '%" + userId + "%' " + " OR Email LIKE '%" + userId + "%' ";
            string             query2 = "SELECT * FROM Passengers WHERE PassengerId = " + userId + "";
            DatabaseConnection dcc    = new DatabaseConnection();

            dcc.ConnectWithDB();


            float y;

            try
            {
                y = Convert.ToInt32(userId) / 2;
                y = 1;
            }
            catch (Exception er) { y = -10; }

            if (y + 1 >= 1)
            {
                SqlDataReader    sdr2  = dcc.GetData(query2);
                List <Passenger> pList = new List <Passenger>();
                //id
                if (sdr2.Read())
                {
                    p             = new Passenger();
                    p.PassengerId = Convert.ToInt32(sdr2["PassengerId"]);
                    p.Pusername   = sdr2["Username"].ToString();
                    p.Pname       = sdr2["Name"].ToString();
                    p.Pemail      = sdr2["Email"].ToString();
                    p.Pgender     = sdr2["Gender"].ToString();
                    p.Paddress    = sdr2["Address"].ToString();
                    p.Page        = Convert.ToInt32(sdr2["Age"]);
                    p.Pquestion   = sdr2["Question"].ToString();
                    p.Ppassword   = sdr2["Password"].ToString();

                    pList.Add(p);
                }
                dcc.CloseConnection();
                return(p);
            }
            else
            {
                SqlDataReader    sdr   = dcc.GetData(query);
                List <Passenger> pList = new List <Passenger>();
                if (sdr.Read())
                {
                    p             = new Passenger();
                    p.PassengerId = Convert.ToInt32(sdr["PassengerId"]);
                    p.Pusername   = sdr["Username"].ToString();
                    p.Pname       = sdr["Name"].ToString();
                    p.Pemail      = sdr["Email"].ToString();
                    p.Pgender     = sdr["Gender"].ToString();
                    p.Paddress    = sdr["Address"].ToString();
                    p.Page        = Convert.ToInt32(sdr["Age"]);
                    p.Pquestion   = sdr["Question"].ToString();
                    p.Ppassword   = sdr["Password"].ToString();

                    pList.Add(p);
                }
                dcc.CloseConnection();
                return(p);
            }
        }
Ejemplo n.º 18
0
        public Flight GetFlight(string flightId)
        {
            string             query = "SELECT * from Flight WHERE AirlineName LIKE '%" + flightId + "%'  ";
            Flight             f     = null;
            DatabaseConnection dcc   = new DatabaseConnection();

            dcc.ConnectWithDB();

            string query2 = "SELECT * from Flight WHERE FlightId = " + flightId + "";

            float y;

            try
            {
                y = Convert.ToInt32(flightId) / 2;
                y = 1;
            }
            catch (Exception er) { y = -10; }

            if (y + 1 >= 1)
            {
                SqlDataReader sdr2   = dcc.GetData(query2);
                List <Flight> fList2 = new List <Flight>();
                //id
                if (sdr2.Read())
                {
                    f             = new Flight();
                    f.FlightId    = Convert.ToInt32(sdr2["FlightId"]);
                    f.AirlineName = sdr2["AirlineName"].ToString();
                    f.Source      = sdr2["Source"].ToString();
                    f.Destination = sdr2["Destination"].ToString();

                    f.Departure = Convert.ToString(sdr2["Departure"]);
                    f.Cost      = Convert.ToInt32(sdr2["Cost"]);

                    fList2.Add(f);
                }
                dcc.CloseConnection();
                return(f);
            }
            else
            {
                SqlDataReader sdr   = dcc.GetData(query);
                List <Flight> fList = new List <Flight>();
                if (sdr.Read())
                {
                    f             = new Flight();
                    f.FlightId    = Convert.ToInt32(sdr["FlightId"]);
                    f.AirlineName = sdr["AirlineName"].ToString();
                    f.Source      = sdr["Source"].ToString();
                    f.Destination = sdr["Destination"].ToString();

                    f.Departure = Convert.ToString(sdr["Departure"]);
                    f.Cost      = Convert.ToInt32(sdr["Cost"]);

                    fList.Add(f);
                    //Console.WriteLine("s");
                }
                dcc.CloseConnection();
                return(f);
            }


            dcc.CloseConnection();
            return(f);
        }