Exemplo n.º 1
0
        public int  Delete_employee(int id)
        {
            //"delete from Employees where id='" + search_textfield.Text + "'";

            string query = "DELETE FROM Employees WHERE id=" + id;

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 2
0
        public Employees Get_employee_id(int id)
        {
            //select id,Name,Phone,Salary,Email from Employees where id LIKE '%" + searc_textBox.Text + "%'";

            string        query  = "select id,Name,Phone,Salary,Email from Employees  WHERE id=" + id;
            SqlDataReader reader = Connection_Database.GetData(query);

            reader.Read();

            Employees emoply = null;

            if (reader.HasRows)
            {
                emoply       = new Employees();
                emoply.Id    = Convert.ToInt32(reader["Id"]);
                emoply.Name  = reader["Name"].ToString();
                emoply.Phone = reader["Phone"].ToString();
            }
            return(emoply);
        }
        public List <User_Entity> GetLogin()
        {
            string             query     = "SELECT  Username,Password FROM User_base";
            SqlDataReader      reader    = Connection_Database.GetData(query);
            User_Entity        login     = null;
            List <User_Entity> loginlist = new List <User_Entity>();
            int count = 0;

            while (reader.Read())
            {
                count = count + 1;
            }
            if (count == 1)
            {
                login.Username = reader["Username"].ToString();
                login.Password = reader["Password"].ToString();
                loginlist.Add(login);
            }
            return(loginlist);
        }
Exemplo n.º 4
0
        public List <Employees> GetAll_employee()
        {
            string        query  = "SELECT * FROM Employees";
            SqlDataReader reader = Connection_Database.GetData(query);

            Employees        employee     = null;
            List <Employees> employeelist = new List <Employees>();

            while (reader.Read())
            {
                employee        = new Employees();
                employee.Id     = Convert.ToInt32(reader["id"]);
                employee.Name   = reader["Name"].ToString();
                employee.Phone  = reader["Phone"].ToString();
                employee.Salary = reader["Salary"].ToString();
                employee.Email  = reader["Email"].ToString();


                employeelist.Add(employee);
            }
            return(employeelist);
        }
Exemplo n.º 5
0
        public List <Admin_entity> GetLogin()
        {
            string              query      = "SELECT  * FROM Admin_base";
            SqlDataReader       reader     = Connection_Database.GetData(query);
            Admin_entity        adminlogin = null;
            List <Admin_entity> loginlist  = new List <Admin_entity>();
            int count = 0;

            while (reader.Read())
            {
                count = count + 1;
            }
            if (count == 1)
            {
                adminlogin.Username = reader["Username"].ToString();
                //               adminlogin.Username = reader["Username"].ToString();
                adminlogin.Pasword = reader["Password"].ToString();

                loginlist.Add(adminlogin);
            }
            return(loginlist);
        }
        // Choch person = new Choch();
        #region Get_destination_method
        public Choch GetBydestination(string destination)
        {
            string        query  = "select Choach_No,Register,Date_Time,Source,Destination,Total_Seat,No_Seat,Seat_available from Choach  where Destination =" + destination;
            SqlDataReader reader = Connection_Database.GetData(query);

            reader.Read();
            Choch chach = null;

            if (reader.HasRows)
            {
                chach              = new Choch();
                chach.Choch_No     = reader["Choach_No"].ToString();
                chach.Registration = reader["Register"].ToString();
                chach.Date_Time    = reader["Date_Time"].ToString();
                chach.Source       = reader["Source"].ToString();
                chach.Destination  = reader["Destination"].ToString();
                chach.Total_Seat   = reader["Total_Seat"].ToString();

                chach.Seat_no        = reader["No_Seat"].ToString();
                chach.Available_Seat = reader["Seat_available"].ToString();
            }
            return(chach);
        }
        public int Add_Choach(Choch choach)
        {
            string query = string.Format("INSERT INTO Choach(Choach_No,Register,Date_Time,Source,Destination,Total_Seat,No_Seat,Seat_available,Amount) VALUES('{0}', '{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", choach.Choch_No, choach.Registration, choach.Date_Time, choach.Source, choach.Destination, choach.Total_Seat, Convert.ToInt32(choach.Seat_no), Convert.ToInt32(choach.Available_Seat), Convert.ToInt32(choach.Amount));

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 8
0
        public int Update_employee(Employees employee)
        {
            string query = "UPDATE Employees SET Name='" + employee.Name + "', Phone='" + employee.Phone + "', Salary='" + employee.Salary + "', Email='" + employee.Email + "' WHERE id=" + employee.Id;

            return(Connection_Database.ExecuteQuery(query));
        }
        public int Delete(string serach)
        {
            string query = "DELETE FROM Employees WHERE id=" + serach;

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 10
0
        public int Edit_seat(Choch seat)
        {
            string query = "UPDATE Choach SET No_Seat=No_Seat+'" + seat.Seat_no + "'  WHERE Choach_No=" + seat.Choch_No;

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 11
0
        //add passenger
        public int Add_passenger(User_Entity passenger)
        {
            string query = string.Format("INSERT INTO Passenger(Name,Phone,Choach_no,Seat_name) VALUES('{0}', '{1}','{2}','{3}')", passenger.Name, passenger.Phone, passenger.Choch_No, passenger.Seat_no);

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 12
0
        public int Addemployee(Employees emp)
        {
            string query = string.Format("INSERT INTO Employees (id,Name,Phone,Salary,Email) VALUES ('{0}', '{1}','{2}','{3}','{4}')", emp.Id, emp.Name, emp.Phone, emp.Salary, emp.Email);

            return(Connection_Database.ExecuteQuery(query));
        }
Exemplo n.º 13
0
        public int Add(User_Entity user)
        {
            string query = string.Format("INSERT INTO User_base(Name,Email,Username,Phone,Password) VALUES('{0}', '{1}','{2}','{3}','{4}')", user.Name, user.Email, user.Username, user.Phone, user.Password);

            return(Connection_Database.ExecuteQuery(query));
        }