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); }
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); }
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); }