public bool Reserve(Customer customer, Car car) { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "InsertCustomer"; objCommand.Parameters.AddWithValue("@firstName", customer.firstName); objCommand.Parameters.AddWithValue("@lastName", customer.lastName); objCommand.Parameters.AddWithValue("@age", customer.age); objCommand.Parameters.AddWithValue("@email", customer.email); objCommand.Parameters.AddWithValue("@address", customer.address); objCommand.Parameters.AddWithValue("@phoneNumber", customer.phoneNumber); objDB.DoUpdateUsingCmdObj(objCommand); SqlCommand objCommandReserve = new SqlCommand(); objCommandReserve.CommandType = CommandType.StoredProcedure; objCommandReserve.CommandText = "Reserve"; objCommandReserve.Parameters.AddWithValue("@carID", car.carID); int result = objDB.DoUpdateUsingCmdObj(objCommandReserve); if (!(result <= 0)) return true; else return false; }
public DataSet GetRentalCarAgencies(string city, string state) { SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "GetRentalCarAgencies"; objCommand.Parameters.AddWithValue("@city", city); objCommand.Parameters.AddWithValue("@state", state); DBConnect objDB = new DBConnect(); return objDB.GetDataSetUsingCmdObj(objCommand); }
public string GetUserFullName(string email) { DataSet myDS = new DataSet(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "GetUserFullName"; objCommand.Parameters.AddWithValue("@email", email); DBConnect objDB = new DBConnect(); myDS = objDB.GetDataSetUsingCmdObj(objCommand); string firstName = myDS.Tables[0].Rows[0]["firstName"].ToString(); string lastName = myDS.Tables[0].Rows[0]["lastName"].ToString(); return firstName + " " + lastName; }
public bool CheckForEmail(string email) { DataSet myDS = new DataSet(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "CheckForEmail"; objCommand.Parameters.AddWithValue("@email", email); DBConnect objDB = new DBConnect(); myDS = objDB.GetDataSetUsingCmdObj(objCommand); if (myDS.Tables[0].Rows.Count <= 0) return true; else return false; }
public bool AddUser(User newUser) { SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "AddUser"; objCommand.Parameters.AddWithValue("@firstName", newUser.firstName); objCommand.Parameters.AddWithValue("@lastName", newUser.lastName); objCommand.Parameters.AddWithValue("@email", newUser.email); int hashPass = newUser.password.GetHashCode(); objCommand.Parameters.AddWithValue("@password", hashPass.ToString()); DBConnect objDB = new DBConnect(); int result = objDB.DoUpdateUsingCmdObj(objCommand); if (!(result <= 0)) return true; else return false; }
public DataSet FindCars(Requirements requirements, string city, string state) { SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "FindCars"; objCommand.Parameters.AddWithValue("@price", requirements.price); objCommand.Parameters.AddWithValue("@gps", requirements.gps); objCommand.Parameters.AddWithValue("@type", requirements.type); objCommand.Parameters.AddWithValue("@carClass", requirements.carClass); objCommand.Parameters.AddWithValue("@electric", requirements.electric); objCommand.Parameters.AddWithValue("@passengers", requirements.passengers); objCommand.Parameters.AddWithValue("@luggage", requirements.luggage); objCommand.Parameters.AddWithValue("@doors", requirements.doors); objCommand.Parameters.AddWithValue("@mileage", requirements.mileage); objCommand.Parameters.AddWithValue("@city", city); objCommand.Parameters.AddWithValue("@state", state); DBConnect objDB = new DBConnect(); return objDB.GetDataSetUsingCmdObj(objCommand); }
public bool ValidateLogin(string email, string password) { int hash = password.GetHashCode(); password = hash.ToString(); DataSet myDS = new DataSet(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "ValidateLogin"; objCommand.Parameters.AddWithValue("@email", email); objCommand.Parameters.AddWithValue("@password", password); DBConnect objDB = new DBConnect(); myDS = objDB.GetDataSetUsingCmdObj(objCommand); if (myDS.Tables[0].Rows.Count == 1) return true; else return false; }