public bool insertClient(String fName, String lName, String phone, String country)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO `clients`(`fName`, `lName`, `phone`, `country`) VALUES (@fn,@ln,@phn,@cnt)";

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            command.Parameters.Add("@fn", MySqlDbType.VarChar).Value  = fName;
            command.Parameters.Add("@ln", MySqlDbType.VarChar).Value  = lName;
            command.Parameters.Add("@phn", MySqlDbType.VarChar).Value = phone;
            command.Parameters.Add("@cnt", MySqlDbType.VarChar).Value = country;

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
        }
        public bool insertClient(String fname, String lname, String phone, String country)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO clients(first_name, last_name, phone, country) VALUES (@fnm, @lnm, @phn, @cnt);";

            //@fnm, @lnm, @phn, @cnt
            command.Parameters.Add("@fnm", MySqlDbType.VarChar).Value = fname;
            command.Parameters.Add("@lnm", MySqlDbType.VarChar).Value = lname;
            command.Parameters.Add("@phn", MySqlDbType.VarChar).Value = phone;
            command.Parameters.Add("@cnt", MySqlDbType.VarChar).Value = country;

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
        }
示例#3
0
        public bool addRoom(int number, int type, String phone, String free)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO rooms(number, type, phone, free) VALUES (@num, @tp, @phn, @fr);";

            //@num, @tp, @phn, @fr
            command.Parameters.Add("@num", MySqlDbType.VarChar).Value = number;
            command.Parameters.Add("@tp", MySqlDbType.VarChar).Value  = type;
            command.Parameters.Add("@phn", MySqlDbType.VarChar).Value = phone;
            command.Parameters.Add("@fr", MySqlDbType.VarChar).Value  = free;

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
        }
示例#4
0
        public bool addReservation(int number, int clientId, DateTime dateIn, DateTime dateOut)
        {
            MySqlCommand command     = new MySqlCommand();
            String       insertQuery = "INSERT INTO `reservations`(`roomNumber`, `clientId`, `dateIn`, `dateOut`) VALUES (@num,@cid,@din,@dout)";

            command.CommandText = insertQuery;
            command.Connection  = conn.getConnection();

            command.Parameters.Add("@num", MySqlDbType.Int32).Value = number;
            command.Parameters.Add("@cid", MySqlDbType.Int32).Value = clientId;
            command.Parameters.Add("@din", MySqlDbType.Date).Value  = dateIn;
            command.Parameters.Add("@dout", MySqlDbType.Date).Value = dateOut;

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
        }
        public bool addReserv(int number, int clientId, DateTime dateIn, DateTime dateOut)
        {
            MySqlCommand command  = new MySqlCommand();
            String       addQuery = "INSERT INTO reservations(roomNumber, clientId, DateIn, DateOut) VALUES (@rnm, @cid, @din, @dout);";

            //@rnm, @cid, @din, @dout
            command.Parameters.Add("@rnm", MySqlDbType.VarChar).Value   = number;
            command.Parameters.Add("@cid", MySqlDbType.VarChar).Value   = clientId;
            command.Parameters.Add("@din", MySqlDbType.DateTime).Value  = dateIn;
            command.Parameters.Add("@dout", MySqlDbType.DateTime).Value = dateOut;

            command.CommandText = addQuery;
            command.Connection  = conn.getConnection();

            conn.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                conn.closeConnection();
                return(true);
            }
            else
            {
                conn.closeConnection();
                return(false);
            }
        }